[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trend Definition



PureBytes Links

Trading Reference Links

I was wondering if somebody might be able to confirm that the  code is doing
what I expect.

I am attempting to define a trend in the following terms. If a market has 12
consecutive closes above/below the trailing close of 24 days ago, the trend
is in place. The trend is in place until the close is below/above the
trailing 24 day close.

I am using this method to determine which markets have been the trendiest in
the past and define that in a total amount of days.

If anybody has another method to define a trend I would love to hear it.


Input:Consec(12);
Vars:LTrend(0),STrend(0),trendy(0);
IF MRO(Close <= Close[24],Consec,1) = -1 Then LTrend =1;
IF MRO(Close >= Close[24],Consec,1) = -1 Then STrend =1;

If LTrend=1 and Momentum(close,24) > 0 then Trendy=Trendy+1;
If  Momentum(close,24) < 0 then LTrend=0;

If STrend=1 and  Momentum(close,24) < 0 then Trendy=Trendy+1;
If  Momentum(close,24) > 0 then STrend=0;

Plot1(Trendy,"trenddays");