add new addposmode, like last candle was bullish / bearish

 

i would like to add a new step-mode

like if last candle was bullish or bearish open new buy position / new sell position

something like:

addposmode==5 &&  Bid>=highestshort+pipstep && last-candle (1h timeframe) was bearsih

addposmode==5 &&   Bid<=lowestshort-pipstep && last-candle (1h timeframe) was bearish


i got that code:

   if(addpositions)
     {
      if(count(OP_BUY)>0)
        {
        double MA11 = iMA(Symbol(),PERIOD_H1,MV1,0,MODE_SMA,PRICE_CLOSE,0);
        double MA12 = iMA(Symbol(),PERIOD_H1,MV2,0,MODE_SMA,PRICE_CLOSE,0);
        
         if(reversesignals)selladdstatus=false;else buyaddstatus=false;
         
         if(((addposmode==0 && Ask<=lastbuyopenprice-pipstep*pt*MathPow(pipstepfactor,count(OP_BUY)))
            || (addposmode==1 && Ask>=lastbuyopenprice+pipstep*pt*MathPow(pipstepfactor,count(OP_BUY)))
            || (addposmode==2 && (Ask<=lastbuyopenprice-pipstep*pt*MathPow(pipstepfactor,count(OP_BUY))
            || Ask>=lastbuyopenprice+pipstep*pt*MathPow(pipstepfactor,count(OP_BUY))))

            || (addposmode==3 && Ask>=highestlong+(Ask*pipstep)*pt*MathPow(pipstepfactor,count(OP_BUY)))
            || (addposmode==3 && Ask<=lowestlong-(Ask*pipstep)*pt*MathPow(pipstepfactor,count(OP_BUY)))




            && (signalfilter==false || (signalfilter && ((reversesignals==false && signal1==1)
            || (reversesignals==false && signal2==2)))))buy=true;
        }
      if(count(OP_SELL)>0)
        {
         if(reversesignals)buyaddstatus=false;else selladdstatus=false;
         if(((addposmode==0 && Bid>=lastsellopenprice+pipstep*pt*MathPow(pipstepfactor,count(OP_SELL)))
            || (addposmode==1 && Bid<=lastsellopenprice-pipstep*pt*MathPow(pipstepfactor,count(OP_SELL)))
            || (addposmode==2 && (Bid>=lastsellopenprice+pipstep*pt*MathPow(pipstepfactor,count(OP_SELL))
            || Bid<=lastsellopenprice-pipstep*pt*MathPow(pipstepfactor,count(OP_SELL)))))

            || (addposmode==3 && Bid>=highestshort+(Bid*pipstep)*pt*MathPow(pipstepfactor,count(OP_SELL)))
            || (addposmode==3 && Bid<=lowestshort-(Bid*pipstep)*pt*MathPow(pipstepfactor,count(OP_SELL)))


            && (signalfilter==false || (signalfilter && ((reversesignals==false && signal2==2)
            || (reversesignals==false && signal1==1)))))sell=true;
        }
     }
 

christion:


something like:

addposmode==5 &&  Bid>=highestshort+pipstep && last-candle (1h timeframe) was bearsih

addposmode==5 &&   Bid<=lowestshort-pipstep && last-candle (1h timeframe) was bearish

then you got the conditions already, what's the question ?

obviously to detect a bearish candle : its close price is lower that its open price. bullish : close is higher that open.

PS. what's highestshort and lowestshort ?

 
Code2219 or probably 2319:

then you got the conditions already, what's the question ?

obviously to detect a bearish candle : its close price is lower that its open price. bullish : close is higher that open.

PS. what's highestshort and lowestshort ?

Lowestshort:

If there are more than a view open-sell-positions so will be the lowestshort the price of the lowest sell-position.

 
ask mql4 related questions here.