Hi guys,
I am trying to create a program which leaves only 2 limit orders per day i.e. 1 long and 1 short. If long is triggered, the other gets cancelled and vice versa. But the question is how can I run it only once a day? If I run the program on 1h timeframe, it gets re-executed another hour if NOT ONMARKET. I just don’t want another execution that day. Is it possible via some function like tradeprice or something? Your help is appreciated.
Regards
Here is an example code using the function.
once maxOrders = 3
if intradayBarIndex = 0 then //reset orders count
ordersCount = 0
endif
if longTriggered then //check if an order has opened in the current bar
ordersCount = ordersCount + 1
endif
//——————————————————————————–
if close crosses over average[50,0](close) and not longOnMarket and ordersCount < maxOrders then
buy 1 contract at market
endif
set target pProfit 100
set stop pLoss 100
|