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

Re: [amibroker] Re: Tick Counter Code Not Working



PureBytes Links

Trading Reference Links

Hello,

To "localize" static variable simply use the name that depends on ChartID.

For example:
StaticVarGet("TickCounter" +GetChartID());
StaticVarSet("TickCounter"+GetChartID(),++TickCount);

BTW: tick and minute counter will be available as a special AFL function
in next release.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "bj012859" <byronjames@xxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Sunday, June 19, 2005 6:15 PM
Subject: [amibroker] Re: Tick Counter Code Not Working


> Thank you hoolee0820.  I was running two charts: 41tick & 3min.  
> Maybe that is the problem.  I will look at localizing the varibles.  
> Thanks,
> 
> bj012859
> 
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "hoolee0820" <hoolee0820@xxxx> 
> wrote:
>> Appears to be good coding to me, so I can't offer specfic help. 
> But 
>> my understanding is that Static Variables are global, you will 
> have 
>> to "localize" TickCounter, otherwise, if there are 2 or more 
> charts 
>> running, all new ticks in all charts are adding to the same 
>> TickCounter.
>> 
>> Not sure if this helps.
>> 
>> HL
>> 
>> --- In amibroker@xxxxxxxxxxxxxxx, "bj012859" <byronjames@xxxx> 
> wrote:
>> > 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
> 
> 
> 
> 
> 
> 
>


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/