R
Joined
Likes
7

Profile posts Latest activity Postings About

  • Try this afl. hope this helps you.




    _SECTION_BEGIN("Automatic Trend");
    x = Cum(1);

    perchg = 0.3*LastValue( Highest( ROC( Low, 50 ) ));

    startvalue = LastValue( Trough( Low, perchg, 1 ) );
    endvalue1 = LastValue( Trough( Low, perchg, 2 ) );

    startbar = LastValue( ValueWhen( Low == startvalue, x, 1 ) );
    endbar = LastValue( ValueWhen( Low == endvalue1, x, 1 ) );

    Aa = (endvalue1-startvalue)/(endbar-startbar);
    b = startvalue;

    trendline = Aa * ( x - startbar ) + b;

    Plot( Close, "Price", colorBlue, styleCandle );
    Plot( IIf( x >= endbar, trendline, Null ), "Trendline", colorRed );
    _SECTION_END();
  • Loading…
  • Loading…
  • Loading…