Forum

Trying to program a function that closes half a position then moves the stop loss to break even (MQL4)

So for my strategy I want to close half of the open position when it hits a TP1 value and then I want the remaining order to be modified so that the new stop loss is set at the open price . The code below is what I have, but I'm not sure how to make it work using the OrderSelect and OrderModify

Problem with using || (or) function in MQL4

if ( ( iOpen ( NULL ,Timeframe, 1 ) <= SMAS1 && iClose ( NULL ,Timeframe, 1 ) > (SMAS1 + gap) && ( iHigh ( NULL ,Timeframe, 1 ) - SMAS1) < ATR && iHigh ( NULL ,Timeframe, 0 ) > ( iHigh ( NULL ,Timeframe, 1 ) + gap) ) ||