Hi, quick question, how can I get my code to only trade between certain hours of the day? I’d like my system to start trading at 9am then stop at 15pm. I have tried to use the ‘CurrentTime’ example listed in the ProRealTime Documentation but when I copy paste the code into my code it doesn’t work, I get a red line under ‘Return’.
Here’s my code;
defparam CUMULATEORDERS = false
IF (CurrentTime = 090000) THEN
WakeUp = 1
ELSE
WakeUp = 0
ENDIF
RETURN WakeUp
EMA25 = ExponentialAverage[45](close)
EMA50 = ExponentialAverage[200](close)
cBuy = (EMA25 crosses over EMA50)
cSell = (EMA25 CROSSES under EMA50)
Percentage = 7
Bull = close > (DClose(1) * (1 + (Percentage/100)))
Bear = close < (DClose(1) * (1 - (Percentage/100)))
IF Bull and cBuy THEN
BUY 1 Contract AT Market
ENDIF
IF Bear and cSell THEN
SELLSHORT 1 Contract AT Market
ENDIF
set target %profit 3
set stop %loss 0.75
Thanks in advance
You don’t need Return and you are not using WakeUp in your code?
Try this
https://www.prorealcode.com/documentation/flatafter/
Hi, Thanks for the help but I figured it out.
I’ll delete this post now to avoid any confusion.