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

[EquisMetaStock Group] CBL Trailing Stop Loss, drawn for "x" periods only



PureBytes Links

Trading Reference Links

Below is a CBL formula that I wish to use for trailing stop loss,
acknowledgements and thanks to Trader Online and those that contributed to
this. I have included one extra lookback day in the formula to enhance it's
reliability.

A seemingly tiny issue I would like to solve, is that I'm only interested in
the most recent data, and don't need to see a line across the whole chart (A
secondary minor problem to this is that on some charts from the first
displayed period the line starts from zero which compresses the scaling of
the chart).

Hence I would like only to have the formula draw the last 13 periods (as 13
is the lookback period I use for the last high day).

So I need to add to this function something like a wrapper (a FOR or WHILE
funtion in C), which simply says:

"for last x periods, do this:"


HighDays := Input("Enter # days to cover lastHIGH for CBL calc'n:", 3, 55,
13);

If(HIGH < HHV(HIGH, HighDays), {then ...}PREV, {previous CBLhi, else...}
If(Ref(L,-2) < Ref(L,-1) AND Ref(L,-2) < L AND
Ref(L,-1) < L, {then ...} Ref(L,-2),   {2nd day back low, else...}
If((Ref(L,-3)< Ref(L,-2) AND
Ref(L,-3) <Ref(L,-1) AND
Ref(L,-3) < L) AND
(Ref(L,-2)< L OR
Ref(L,-1) < L),{then ... } Ref(L,-3), {3rd day back low, else...}
If((Ref(L,-4)<Ref(L,-3) AND
Ref(L,-4) < Ref(L,-2) AND
Ref(L,-4)< Ref(L,-1) AND
Ref(L,-4) < L) AND
(Ref(L,-3)< L OR
Ref(L,-2)< L OR
Ref(L,-1) < L), {then... }
Ref(L,-4), {4th day back low, else...}
If((Ref(L,-5)<Ref(L,-4) AND
Ref(L,-5) < Ref(L,-3) AND
Ref(L,-5) < Ref(L,-2) AND
Ref(L,-5) < Ref(L,-1) AND
Ref(L,-5) < L) AND
(Ref(L,-4)< L OR
Ref(L,-3) < L OR
Ref(L,-2) < L OR
Ref(L,-1) < L), {then ...}
Ref(L,-5), {5th day back low, else...}
If((Ref(L,- 6 )<Ref(L,- 5) AND
Ref(L,- 6 ) < Ref(L,- 4) AND
Ref(L,- 6 ) < Ref(L,- 3) AND
Ref(L,- 6 ) < Ref(L,- 2) AND
Ref(L,- 6 ) < Ref(L,- 1) AND
Ref(L,- 6 ) < L) AND
(Ref(L,- 5 )< L OR
Ref(L,- 4 ) < L OR
Ref(L,- 3 ) < L OR
Ref(L,- 2 ) < L OR
Ref(L,-1) < L), {then ...} Ref(L,- 6 ), { 6th day back low, else...}
PREV ))))))

If anyone can think of a way to achieve this, it could be applied to any
indicator where only the recent past is of relevance (such as a SL), and
would keep the clutter away from the rest of the primary chart data.

Many thanks,  Mike


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs from home.
Over 14,500 titles. Free Shipping
& No Late Fees. Try Netflix for FREE!
http://us.click.yahoo.com/ybSovB/hP.FAA/3jkFAA/BefplB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/