I need a function to prevent EA from opening new orders if the opening price of the previous order is less than X pips away.
EX : Distance = 30 Pips ;
Open buy first order in - Price > 1.000
Signal for New Buy - Price > 1.015 - dont open
Signal for new Buy - Price > 1.030 - Open.
I have a code for time, where it only opens a new order after X time of the previous order, I want the same code but using X pips from the opening of the last order..
EX : Distance = 30 Pips ;
Open buy first order in - Price > 1.000
Signal for New Buy - Price > 1.015 - dont open
Signal for new Buy - Price > 1.030 - Open.
I have a code for time, where it only opens a new order after X time of the previous order, I want the same code but using X pips from the opening of the last order..
Inserted Code
extern int Wait = 30; int TradeWait(){ int wait=0; int total=OrdersTotal(); for (int i = total - 1; i >= 0; i --) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if(OrderMagicNumber() == MagicNumber && OrderSymbol()==Symbol()) { if(OrderOpenTime() + (Wait*60) > TimeCurrent()) wait=1; } } return (wait); }