Previous Bar Trailing Stop - page 4

To add comments, please log in or register
FxSteven
174
FxSteven  
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 .

FxSteven
174
FxSteven  
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 .)

Mladen Rakic
105835
Mladen Rakic  
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
FxSteven
174
FxSteven  
mladen:

Replace the CheckBarDir() function with this :

And try it out then
Yes , you are genius :)
skyler1234321
9
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.
fxcommentary
1208
fxcommentary  
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);
   }
fxcommentary
1208
fxcommentary  

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.

ab1000
23
ab1000  
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

Krisma Freddy
22
Krisma Freddy  

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

To add comments, please log in or register