Download MetaTrader 5

Mixing trailing stops with breakeven stop

To add comments, please log in or register
Publish your article and thousands of people all over the world will read it!
Mo
65
Mo 2014.01.31 02:26 
Hi all,


I use a couple of long and short 'MAs' for trailing stops. I am trying code out the following

Buy scenario :

1. price is above, price breaks short ma downside - close trade

2. If breakeven is triggered, then get out when long term Ma is triggered to the downside (ignoring short term ma - for possible break out situations)

3. Get out if longterm ma breaks downside. This is used from longer term trends that are in consolidation when I entered, breakeven stop is not triggered and also the short term ma is trading above the my entry.

code:

 if (  short_ma<0 ) {
         
       
          closebuy=true;
  } else if ( BreakEvenStop>0 && long_ma<0) {
          
          closebuy=true;
            
      }else {
   if ( long_ma<0) {

       closebuy=true;

}

Code is currently not working :). Along with the overall logic, I am pretty sure I not invoking BreakEvenStop properly. BreakEvenStop should be triggered for the condition to return true.

whroeder1
14514
whroeder1 2014.01.31 03:22  

zzdream:

1. price is above, price breaks short ma downside - close trade

2. If breakeven is triggered,

3. Get out if longterm ma breaks downside.

  1. Where have you set the SL to the "short ma" so it closes at "short ma downside - close trade?"
  2. Where have you set the SL to breakeven when "breakeven is triggered"
  3. Where have you set the SL to the "longterm ma" so it "get's out if longterm ma breaks downside"
Show the code where you set your SL to the maximum of these conditions.
Mo
65
Mo 2014.01.31 13:29  
Thanks for replying,

Don't have access to any code right now .
So, 1 . One Candle trading below short ma, get out.
2. 20 + pips breakeven 'kicks in'. No risk at this point
3. One Candle trading below long ma, get out.

How would you test against the Breakevenstop. Ie If Breakevenstop 'kicks in' (profit target reached)then ..do something?
To add comments, please log in or register