Previous Bar Trailing Stop - page 4

 
mladen:

stevenpun

Without knowing the whole code, I can not tell what is happening

I just adding the code above to the ea .

Here is the ea i try to  adding the bar checking .

Can you check is that correct ?

Thank for your time and helping .

 
mladen:

stevenpun

Without knowing the whole code, I can not tell what is happening

So is that can adding bar direction checking option to the ea above ?

(Example : 2 bar with same direction only active trailing stop .)

 
stevenpun:

So is that can adding bar direction checking option to the ea above ?

(Example : 2 bar with same direction only active trailing stop .)

Replace the CheckBarDir() function with this :

bool CheckBarDir()
   {
      for (int i=OrdersTotal()-1; i>=0; i--)
      if (OrderSelect(i, SELECT_BY_POS,MODE_TRADES))  
         {  
            if (OrderType() == OP_BUY)  if(Open[BarCheck] < Close[BarCheck]) return(true); 
            if (OrderType() == OP_SELL) if(Open[BarCheck] > Close[BarCheck]) return(true); 
         }      
   return(false);
   }
And try it out then
 
mladen:

Replace the CheckBarDir() function with this :

And try it out then
Yes , you are genius :)
 
Could somebody help me? I dont know why its not working good. SL trailing stop are based on HIGH/LOW candle, but i want to miss high/low candle of opposite direction (for example to avoid out in inside bar formation)... But unfortunatelly its move on high candle even opposite direction candle.
 
skyler1234321:
Could somebody help me? I dont know why its not working good. SL trailing stop are based on HIGH/LOW candle, but i want to miss high/low candle of opposite direction (for example to avoid out in inside bar formation)... But unfortunatelly its move on high candle even opposite direction candle.
Did yoy try modification of code by Mladen ?
bool CheckBarDir()
   {
      for (int i=OrdersTotal()-1; i>=0; i--)
      if (OrderSelect(i, SELECT_BY_POS,MODE_TRADES))  
         {  
            if (OrderType() == OP_BUY)  if(Open[BarCheck] < Close[BarCheck]) return(true); 
            if (OrderType() == OP_SELL) if(Open[BarCheck] > Close[BarCheck]) return(true); 
         }      
   return(false);
   }
 

Anybody - pls modify Mladen code to enable the user to choose option : "limit of steps". 

Last Mladen code published here - is attached.

Limit of steps would be limit of candles trailed with SL.

Example - if i choose "2" it means that the SL will trail only two candles and after that no trailing.

 
Mladen Rakic:

stevenpun

Here is the new mt4 compatible version : high_low_trailing_stop_1.01_nmc.mq4

Its been a while I guess since this indicator has been looked at but would it be possible to have the option to only trail either down or up bars?


Thanks

 

Hello

It is interesting

I have some idea, can we make EA Crossing MA with trailing stop based on fibonacci level

Example,

Buy order

Open buy when open candle below MA and close candle above MA

The opening price was set as fibonacci level 1.00 and  SL set at low candle as fibonacci level 0

when price reach at fibo level 1.618, SL move to level 1.00

when price reach at fibo level 2.618, SL move to level 1,618

and when price reach at fibo level 4.236, SL move to level 2.618

 
Will this work with Renko charts ?
Reason: