MarcParticipant
Average
HI together,
I wanted to open a trade at hour x and want to close order at hour y.
The code looks fine (I think), but a lot more orders were opened.
Is there a reason why and can anybody help me how to enter trades only within tradingwindow mentioned in the code?
Defparam Cumulateorders = False
n = 1
IF NOT ONMARKET AND DayOfWeek = 4 and HOUR > 8 THEN
BUY n SHARES AT MARKET nextbaropen
endif
IF ONMARKET AND DayOfWeek = 4 and HOUR > 11 THEN
SELL n SHARES AT MARKET nextbaropen
endif
Pls attached a trade overview
Yeah … isn’t below what you want (= not > ) else you’ll be opening trades at 12, 14 etc and closing every alternate hour at 13 15 etc.
IF NOT ONMARKET AND DayOfWeek = 4 and HOUR = 8 THEN
BUY n SHARES AT MARKET nextbaropen
endif
IF ONMARKET AND DayOfWeek = 4 and HOUR = 11 THEN
SELL n SHARES AT MARKET nextbaropen
endif