Author Topic: Trailing Stop ATR  (Read 14943 times)

morgen

  • Newbie
  • *
  • Posts: 1
    • View Profile
Trailing Stop ATR
« on: May 18, 2010, 08:54:44 am »
Is there somebody who can put on Wisestocktrader "Trailing Stop ATR" formula, BASED ON " k* ATR" AND " HH AND LL"  FROM 3 DAYS AGO, for AmiBroker?
Thank You!

administrator

  • Administrator
  • Full Member
  • *****
  • Posts: 200
    • View Profile
Re: Trailing Stop ATR
« Reply #1 on: May 18, 2010, 08:14:11 pm »
I don't have the other trailing stops you asked for but here is the ATR trailing stop loss
Code: [Select]
// ATR Trailing stop - stevo 2006
// When stop line drops exit is triggered.
multiplier = Param( "ATR Multiplier", 2, 0, 10, 0.1 );
myATR = multiplier * ATR( 15 ); // calculate ATR
initial = C - myATR; // raw stop - not racheted

stop[ 0 ] = Close[ 0 ];

for ( i = 1 ; i < BarCount; i++ )
{
    if ( Close[ i ] > stop[ i - 1] )
    {
        temp = Close[ i ] - myATR[ i ];

        if ( temp > stop[ i - 1 ] )
            stop[ i ] = temp;
        else
            stop[ i ] = stop[ i - 1 ];
    }
    else
        stop[ i ] = initial[ i ];
}

Plot( stop, "ATR Stop", colorRed, styleLine );

Sell = C < Ref( stop, -1 );

PlotShapes( IIf( stop < Ref( stop, -1 ), shapeDownArrow, Null ), colorOrange, 0, H );