Hi!
I want to buy one contract in the DOW when it breaks above the high of the pre-market (high of 13:00-14:00 in my time zone). I only want it to take one order and tried using tradeindex, but now it is not taking any order. Help would be greatly appreciated!
I have tried:
defparam cumulateorders=false
// breakout on DOW take one order per day after 14:00 at the high of the 13:00-14:00 hour bar
timeframe(1hour)
c1 = (longonmarket=0)
c2 = time>140000 and time<150000
c3 = high[1]
c4 = tradeindex=0
if c1 and c2 and c3 and c4 then
buy 1 contract at c3 stop
endif
Sincerely
/Mikael
The 1-hour timeframe executes strategies only once in an hour, 13, 14, 15, etc… so there can’t be any time >14 and <15.
Line 5 should read either:
c2 = time>=140000 and time<=150000
or (which seems to be a better choice):
c2 = time=150000
Of course you will have to add a condition to exit a trade, or it will remain open forever.