EA opening positions at the same price
Hi there,
i am having a hard time trying to figure out why this script below is opening more than one position, as you can see, it opens a sell order when all the criteria are true, the problem is, when price hits stop(high) or take profit(lowestprice) and goes back to order price(close) it reopens the position. What can i do to change that,i need a insight, if anybody read this and reply, thank you so far.
try this
if((OrdersTotal()==0)&&(PositionsTotal()==0) && ((high>higheastprice)&&(close<open)&&(open<higheastprice)&&(signal==0)&&(signal1==0)&&(signal2==0)&&(signal3==0)&&(signal4==0)&&(signal5==0))) { trade.SellStop(0.10,close,_Symbol,high,lowestprice,ORDER_TIME_DAY,0,0); } }
if signal is valid, it will still open position.
MQL4 (in Strategy Tester) - double testing of entry conditions - Strategy Tester - Expert Advisors and Automated Trading - MQL5 programming forum
int CandleTime; datetime Time[]; ArraySetAsSeries(Time,true); CopyTime(_Symbol,PERIOD_H4,0,2,Time); CandleTime = ArrayMaximum(Time,0,2); MqlRates TimeInformation[]; ArraySetAsSeries (TimeInformation, true); int data=CopyRates(Symbol(),PERIOD_H4,0,2,TimeInformation); datetime candletime = TimeInformation[CandleTime].time+300; Comment(" Expiration: ",candletime); if((OrdersTotal()==0)&&(PositionsTotal()==0) && ((high>higheastprice)&&(close<open)&&(open<higheastprice)&&(signal==0)&&(signal1==0)&&(signal2==0)&&(signal3==0)&&(signal4==0)&&(signal5==0))) { trade.SellLimit(0.10,close,_Symbol,high,lowestprice,ORDER_TIME_SPECIFIED,candletime,0); } }

Hi there,
i am having a hard time trying to figure out why this script below is opening more than one position, as you can see, it opens a sell order when all the criteria are true, the problem is, when price hits stop(high) or take profit(lowestprice) and goes back to order price(close) it reopens the position. What can i do to change that,i need a insight, if anybody read this and reply, thank you so far.