Try this:
int start() { if(OpenOrders()==0){ // will only open new order when there is no existing open order if(BuySignal==true){ OrderSend(Symbo;(),OP_BUY,.....); } if(SellSignal==true){ OrderSend(Symbol(),OP_SELL,.....); } } } // end of int start() {} part of code // Insert this code after int start() {} part of code int OpenOrders() { int _total=0; for (int i=0; i<OrdersTotal(); i++) { if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) if((OrderSymbol()==Symbol())) _total++; } return(_total); }
Thanks.
How about something very simple and effective:
int init() { return(0); } int deinit() { return(0); } int start() { if(OrdersTotal()>0 ) { return(0); } //your code here return(0); }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
It's possible when an EA opens an order, keep JUST that order?
I mean, I want that, whean an EA opens an order, keep that order until S/L or T/P is reached, and just to open positions where there are no orders opened.
Thanks in advance.