try this...

function Howlong( indicator, Length )
// a length of 0 will place a dot at the last bar
{

    Start = LastValue( Cum( 1 ) - Length ) == Cum( 1 );
    Start2 =  Cum( Start ) == 1;
    x = ValueWhen( Start2 , indicator, 1 ) ;
    return x;
}

LBPeriod = Param("Lookback Period",50,5,200,1);
HHValue = LastValue( Ref( HHV( H, LBPeriod ), -1 ) );
HHPoint = BarsSince( H == HHValue );

Plot( C, "", colorRed, 64 );
trigger = LastValue( Cross( C , HHValue ) );

if ( trigger  )
{
    Plot( Howlong( HHValue , HHPoint ), "", colorYellow, 1 );
}

Best regards
Rick 
--- In [email protected], "tradinghumble" <sharp...@...> wrote:
>
> I would like have a trendline every time the Close is higher than the last 50 
> closes... the trendline should be drawn from the point all the way to the 
> right of the chart.
> 
> Can anyone please point me in the right direction?
>


Reply via email to