Exiting positions based on indicator positions, not pips

 

Hey MQL5 team! 

Im trying to write a simple condition into an EA where the take profit will trigger if the Parabolic SAR reverses instead of reaching a specific pip count.


Brand new to this so Im not sure if this is possible. 


Current basic code is below for the buy trade setup:

if(LastSARValue < CurrentOpen)

  {

trade.Buy( 0.1,_Symbol, Ask, (Ask-25*_Points), (LastSARValue > CurrentOpen),_Symbol);

}


Stop loss is set to 25 points and it enters the trade when the  Parabolic SAR is below the open of a new candle which is what I want.


Thanks in advance for any help!