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

Re: [amibroker] Re: Synchronization problem between panes using Static array variables



PureBytes Links

Trading Reference Links

Hello,

Actually the visual order of panes is not the same as refresh ordering,
since the window that receives the click is the first one to refresh,
then the rest is refreshed in the creation order.

So it is best to use RequestTimedRefresh for its simplicity and reliability
if you use end-of-day database (rt databases refresh automatically)

Also you need to understand that static variables are global (shared),
so if more than one pane writes to the same variable - one would overwrite the other.

Therefore you need to ensure uniqueness of variable names that you are using
for different windows if you don't want overwriting one by another.
That's why I wrote that for EOD much simpler approach is using #include.
That way you have one code and use it anywhere without duplication
and you have headache-free solution without conflicting names, figuring out
refresh order etc etc.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Thomas Ludwig" <Thomas.Ludwig@xxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, March 13, 2009 4:44 PM
Subject: Re: [amibroker] Re: Synchronization problem between panes using Static array variables


> On Friday 13 March 2009 16:03:46 Barry Scarborough wrote:
>> I just wrote a CCI indicator that will pass the statics as I wrote. I wrote
>> a MA program that will accept it. This will cause a buy/sell signal and I
>> use plot shapes to see the buy and sell signals in the MA indicator. I ran
>> it on 1, 5 and 15 minute charts and changed tickers. I can change the
>> tickers and time frames and it works perfectly.
>>
>> But one thing you need to know is that AB scans your indicators top to
>> bottom so the input indicators have to be on top and the receiving ones
>> below it.
> 
> Barry, I changed the order of the panes accordingly but that didn't help.
> So RequestTimedRefresh is still the only solution that works.
> 
> Greetings,
> 
> Thomas
>>
>> One real easy way to test it is to use printf() and write the values you
>> are receiving to the interpretation window in the receiving indicator. Then
>> check the value received with the sending chart.
>>
>> Barry
>>
>> --- In amibroker@xxxxxxxxxxxxxxx, Thomas Ludwig <Thomas.Ludwig@xxx> wrote:
>> > Barry,
>> >
>> > thanks for your hints. Unfortunately, they didn't solve my problem. On
>> > the contrary, now even scrolling through dates doesn't cause a
>> > re-calculation any more.
>> >
>> > Greetings,
>> >
>> > Thomas
>> >
>> > On Friday 13 March 2009 14:51:30 Barry Scarborough wrote:
>> > > I assume when you switch between symbols you want to preserve the data
>> > > relative for each symbol. If so the names must be unique. Have you
>> > > tried using a prefix to differentiate the symbols when you switch them?
>> > > Try this and see if it works when you change tickers.
>> > >
>> > > StaticVarSet(name() + "varccibuysignals", Buy1);
>> > >
>> > > If you also switch time frames add the interval,
>> > >
>> > > VarPfx = name() + numtostr(interval, 1, false);
>> > > StaticVarSet(VarPfx + "varccibuysignals", Buy1);
>> > >
>> > > This will give your static vars a unique name between tickers and
>> > > times.
>> > >
>> > > Barry
>> > >
>> > > --- In amibroker@xxxxxxxxxxxxxxx, Thomas Ludwig <Thomas.Ludwig@> wrote:
>> > > > Hello,
>> > > >
>> > > > I've implemented this new feature in AB in a certain layout. I'm
>> > > > using a variable CCI in one pane and plot the signals in the other.
>> > > >
>> > > > So in the one pane I defined:
>> > > >
>> > > > [...]
>> > > > StaticVarSet("varccibuysignals", Buy1);
>> > > > StaticVarSet("varccisellsignals", Sell1);
>> > > > StaticVarSet("varcci", varcci(Avg,n));
>> > > >
>> > > > and in the other one:
>> > > > [...]
>> > > > varccibuysig = StaticVarGet("varccibuysignals");
>> > > > varccisellsig = StaticVarGet("varccisellsignals");
>> > > > varcci = StaticVarGet("varcci");
>> > > > PlotShapes(varcciBuysig*shapeUpTriangle,colorGreen,0,L,-25);
>> > > > PlotShapes(varcciSellsig*shapeDownTriangle,colorRed,0,H,-25);
>> > > > Varccicolor=IIf(Varcci>0,colorGreen,colorRed);
>> > > > Plot(2,"",Varccicolor,styleArea|styleOwnScale,0,100,0);
>> > > > Plot( 3,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
>> > > >
>> > > > This works very well - with one exception: If I scroll through my
>> > > > symbols tree to plot other symbols with this layout, the signals in
>> > > > the second pane are not properly updated/synchronized. Only if I
>> > > > scroll through dates in the scroll bar at the bottom, the signals are
>> > > > re-calculated. I guess it's a caching problem. How can
>> > > > programmatically avoid it? I have tried using
>> > > > RequestTimedRefresh( 1 ); and that works. But since I'm not a
>> > > > real-time trader (only EOD) I wonder if that makes much sense and if
>> > > > there is a simpler solution.
>> > > >
>> > > > I have a probably similar problem (that has nothing to do with static
>> > > > array variables) in another layout. In one of its sheets I'm
>> > > > calculating several market indicators (zscores for put/call-ratio,
>> > > > VIX, VXN, etc.) using the Foreign() function. If I click this sheet
>> > > > for the first time not all of these indicators are properly
>> > > > displayed. Only after scrolling through dates or switching to another
>> > > > sheet and switching back they are displayed as they should.
>> > > >
>> > > > Any help would be appreciated.
>> > > >
>> > > > Greetings,
>> > > >
>> > > > Thomas
>> > >
>> > > ------------------------------------
>> > >
>> > > **** IMPORTANT PLEASE READ ****
>> > > This group is for the discussion between users only.
>> > > This is *NOT* technical support channel.
>> > >
>> > > TO GET TECHNICAL SUPPORT send an e-mail directly to
>> > > SUPPORT {at} amibroker.com
>> > >
>> > > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
>> > > http://www.amibroker.com/feedback/
>> > > (submissions sent via other channels won't be considered)
>> > >
>> > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> > > http://www.amibroker.com/devlog/
>> > >
>> > > Yahoo! Groups Links
>>
>> ------------------------------------
>>
>> **** IMPORTANT PLEASE READ ****
>> This group is for the discussion between users only.
>> This is *NOT* technical support channel.
>>
>> TO GET TECHNICAL SUPPORT send an e-mail directly to
>> SUPPORT {at} amibroker.com
>>
>> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
>> http://www.amibroker.com/feedback/
>> (submissions sent via other channels won't be considered)
>>
>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> http://www.amibroker.com/devlog/
>>
>> Yahoo! Groups Links
>>
>>
>>
> 
> 
> ------------------------------------
> 
> **** IMPORTANT PLEASE READ ****
> This group is for the discussion between users only.
> This is *NOT* technical support channel.
> 
> TO GET TECHNICAL SUPPORT send an e-mail directly to 
> SUPPORT {at} amibroker.com
> 
> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
> http://www.amibroker.com/feedback/
> (submissions sent via other channels won't be considered)
> 
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> Yahoo! Groups Links
> 
> 
> 


------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

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

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/