can someone help how to to teach an ea when xxx amount of open orders reached than do not open trades for the rest of the day and start on next day.
I am counting my openorders right now like this.
i have an input like this:
than i check this
this is working well if ordersprofit > takeprofitinput ea is closing all trades.
i need now a function or code snippet that ea will not open any trades and beginn opening trades on next day.
someone any idea?
i thought about a bool tradeallowed and set it to false if CloseAllPositions function is called.but how can i code it to set it to true when next trading day begin..
or something like i put an input startnextday -->> so stop trading after closeall and start on startnextday input. someone an idea
I am counting my openorders right now like this.
Inserted Code
double Open_Orders_Profit() { double openordersprofit = 0; RefreshRates(); int Total=OrdersTotal(); if(Total>0) { for(int i=Total-1; i>=0; i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==TRUE) { if(OrderSymbol()==Symbol() && OrderMagicNumber() == magicNumber) { openordersprofit +=OrderProfit()+OrderSwap()+OrderCommission(); } } } } return(openordersprofit); }
i have an input like this:
Inserted Code
input double TakeProfitInput = 100;
than i check this
Inserted Code
if(Open_Orders_Profit()>=TakeProfitInput) { CloseAllPositions(); }
this is working well if ordersprofit > takeprofitinput ea is closing all trades.
i need now a function or code snippet that ea will not open any trades and beginn opening trades on next day.
someone any idea?
i thought about a bool tradeallowed and set it to false if CloseAllPositions function is called.but how can i code it to set it to true when next trading day begin..
or something like i put an input startnextday -->> so stop trading after closeall and start on startnextday input. someone an idea