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

[amibroker] Tick Counter Code Not Working



PureBytes Links

Trading Reference Links

Hi,

In trying to get a tick counter to work, I add the following code:

Reset = Param("Reset Static Variables",0,0,1,1);

if( IsEmpty(StaticVarGet("IsInitialized")) OR Reset)
 {
 StaticVarSet("TickCounter",0);
 StaticVarSet("PrevVol",0);
 StaticVarSet("IsInitialized",1);
 }
 LastVol = LastValue(Volume);
 PrevVol = StaticVarGet("PrevVol");
 NewTick = PrevVol != LastVol;

 if( NewTick )
 {
 TickCount = StaticVarGet("TickCounter");
 TickCount = IIf(TickCount>41, 0, TickCount);
 StaticVarSet("TickCounter",++TickCount);
 StaticVarSet("PrevVol",LastVol);
 }

TickCount = StaticVarGet("TickCounter");
Plot(100+TickCount,"",IIf(TickCount 
>=33,colorGreen,colorRed),styleNoLine);


I get the desired label location with corrent coloring but the value 
in the label doesn't seem to have any relationship to the ticks 
being used to draw my tick chart.  First of all the label value is 
incrementing by two instead of by one.  Second, it overflows many 
times before getting a new bar on the chart.  Please let me know how 
to make this work properly.  Having tick charts but no tick counter 
is very frustrating.

Thx,





Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

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