Optuma Forums › Optuma Scripting › using LAST() for extended hours › Reply To: using LAST() for extended hours

- Topics: 5
- Replies: 332
- Posts: 337
Hi,
I’d setup a 15min watchlist and use a variation of the script i referenced earlier to find the price when the out of market hours ends to compare with the main sessions close.
To do this you’d use the PriceatSignal() function, but for that to work you need to set a Boolean trigger to mark when the out of session zone starts and ends. That will give us the price points which we can then use to calculate the % difference between.
The final script would look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
//Find the full bar date with intraday decimals V1 = BARDATE() ; //Find the daily bar date, without decimals V2 = ROUND(V1, DECIMALTYPE=0) ; //Reduce bar date to intraday range only V3 = V1 - V2; //Identify Out of Session Range V4 = (V3 < 0.395555) and (V3 > -0.333); //Find Closing Prices at End of Session and End of Of Out of Session V5 = V4 CrossesAbove 0.5; V7 = V4 CrossesBelow 0.5; V6 = V5[-1]; V8 = V7[-1]; RES1 = PRICEATSIGNAL(V6); RES2 = PRICEATSIGNAL(V8) ; //Calculate % Gain or Loss FNL = 100 * (RES2 - RES1)/RES1; //Show Result NONZERO(IF(V7 == 1, FNL,0)) |
The final result would look like this:
You can see how the Show View displays the % change each day, comparing the close of the main session with the close of the out of session activity. The values line up with a manual measurement of the same ranges.
I’ve attached an example workbook (which uses live USA Equities data) for you to review. It may not be exactly what you are after but should give you a foundation to build on.
Attachments:
You must be logged in to access attached files.