Name: mql4.png Views: 20 Size: 140.9 KB

We now come to the condition of entering into the deal, whether selling or buying, as in the following picture.

Name: 2021-03-02_12-46-57.png Views: 20 Size: 37.4 KB

We sell if parabolic is greater than the current candle, and we buy if parabolic is less than the current candle.
So it will be a condition of buying.


PHP Code:

Code:
 if (sar1<Open[1]&&sar2<Open[1])
And the condition of selling

PHP Code:

Code:
if (sar1>Open[1]&&sar2>Open[1])
Then we will need to add the order to open the deal when these conditions are met and add the stop loss and the target.
As for the purchase, it will be as follows.


PHP Code :

Code:
  if (sar1<Open[1]&&sar2<Open[1]){
        if(StopLoss==0){SL=0;}else{SL=Ask-StopLoss*Point;}
           if(TakeProfit==0){TP=0;}else{TP=Ask+TakeProfit*Point;}
           
            OrderSend(Symbol(),OP_BUY,Lots,Ask,3,SL,TP,"MR.dollar EA",MagicNumber,0,Blue);
          
             
          
       }
If we observe the two variables SL, TP
We set target TP equal to current price + TakeProfit * pip value
For example, the current price is 1.4000, and the target is 30 points, then the result will be
1.4000 + 30 * 0.0001 = 1.4000 + 0.0030 = 1.4030, which is the goal we want
And vice versa in the case of sale
We define the TakeProfit and StopLoss variables in the EXP external variants
Define the variables SL and TP in the START function