Hi
I am trying to get the market value at 10.10am using the 5min timeframe, but my code returns the time from 10.05. Can anyone help please??
I use the following variables…
marketopentime = 080000 //market open time
marketclosetime = 163000 //market close time
stratstarttime = 101000 //start time of strategy in HHMMSS format
risktime = 101500 //time that stop can be calculated and applied
validitytime = 102000 //stop time of strategy in time format (HHMMSS)
Then I do the following logic check…
if time >= stratstarttime and time < risktime then
// Check and enter trade param
stratopen = open
But when I graph the “stratopen” value it returns the open value from the 10.05 candle, not the required 10.10 candle.
Any help please?
Thanks.
Welcome to the forums. Please use the ‘Insert PRT code’ button when putting code in your posts. I will tidy your post up for you! 🙂
I would advise reading the documentation here:
https://www.prorealcode.com/prorealtime-documentation/
There is a whole section on Time and Date.
Also try using the GRAPH instruction with TIME and then you will see exactly what is returned for TIME for each bar.
Maybe you should consider OPENTIME?
OllieB,
You should try to move everything 5 mins early (stratstartime=100500), or maybe using stratstartime= opentime=101000
Regards.
Thanks, I will do some research.
Thanks.
I tried that but the trade didn’t trigger. And I was interested in understanding the workings of PRT as to why the seemingly simple logic isn’t working.
Replace time < risktime with
time <= risktime