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