PureBytes Links
Trading Reference Links
|
At 1:40 PM -0600 9/6/99, Brent wrote:
>What I need is for them to start again with the number 1 after they
>reach 9 instead of what they do now. (Which is to continue to put 9's
>on the chart.) Your help is appreciated.
>
>Brent
>
>BTW, I realize that a more efficient or elegant method to do this
>count may exist, but this is what I came up with.
You are correct. There is a more elegant solution. Probably the most
elegant its to use the "MRO" function to find the last case where the
condition was NOT true.
The code below does this and uses the "Mod" function to cycle the
count when it reaches greater than 9 as you requested.
Bob Fulks
----------------
Input: Price(Close);
Vars: CBars(0),
Counter(0),
Stren(0),
String1(""),
TextLoc(0);
CBars = MRO(Price < Price[1], 20, 1);
if CBars > 0 then begin
Counter = Mod(CBars, 10);
String1 = NumToStr(Counter, 0);
Value3 = Text_New(Date[Stren], Time, High[Stren], String1);
TextLoc = Text_SetStyle(Value3, 2, 1);
if GetBackGroundColor=Tool_White then
Value4=Text_SetColor(Value3,Tool_Red)
else
Value4=Text_SetColor(Value3,Tool_White);
end;
if FALSE then Plot1(Close, "1");
|