Hi – I’m very new to this, so please forgive me for my ignorance. I am trying to code a simple strategy that looks at the price of the FTSE yesterday just before close, so at 16:29:59, and takes the difference from today’s opening price at 08:00:01.
Can anyone please help me with how I do this? I have spent quite a while looking at the TIME function, and OPEN and CLOSE, but I can’t work it out.
Many thanks.
Since you want to compute the difference between two adjacent bars, you can simply write
IF IntradayBarIndex = 0 then //on the very first bar of the new day...
Difference = open - close[1] //...compute the difference between CURRENT open and PREVIOUS close
ENDIF
this solution works with every intraday TF.
If you need to have exactly the values at 16:29:59 and at 08:00:01, you’ll have to use the 1-second TF and write this piece of code:
IF time = 162929 THEN
ClosingPrice = close
ENDIF
IF time = 080001 then
Difference = open - ClosingPrice
ENDIF
That’s completely brilliant, Roberto, thank you so much.
Helen
This is not really a PRT Platform issue but more of ProOrder auto-trading issue. Now that Robert has provided the solution I have moved it across to the ProOrder section of the Forum where it is a bit more relevant. Please try to post in the correct section of the forum when you have future requests or questions so that you will find the best chance of an answer. 🙂
@ robertogozzi
does this work in 1min timeframe too? or just in intraday?
thx for help!
1 minute IS intraday, so it will work perfectly.