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

RE: [amibroker] Getting values from another pane



PureBytes Links

Trading Reference Links

Paul,

 

I’m assuming that you mean sharing variable values.   

 

I share variable values between panes and charts using global variables.   Here’s some code that sets and reads the “gOverlayMktCapBool” variable using the chart parameter value “OverlayMktCapBool”:

 

//Set Global Variable (sending pane/chart)

OldOverlayMktCapBool= StaticVarGet( "gOverlayMktCapBool" );

if (    IsEmpty(OldOverlayMktCapBool)

   OR OldOverlayMktCapBool != OverlayMktCapBool

   )

   {

   StaticVarSet( "gOverlayMktCapBool", OverlayMktCapBool);

   AB = CreateObject("Broker.Application");

   AB.RefreshAll(); // refreshes other charts

 

   }

 

//GetGlobal Value (receiving pane/chart

MktCapBool= StaticVarGet("gOverlayMktCapBool");

 

In the “sending” pane, the first piece of code checks to see if the “gOverlayMktCapBool” variable has not been set or that the new value is not equal to the old value.   If either condition is met, it calls “StaticVarSet” to set the global variable.   This ensures that you are not setting the global variable every time the sending chart refreshes.

 

In the receiving pane, “StaticVarGet” retrieves the value.

 

One caveat is that AB is event-driven.   I.e., you need to have one of two “events” occur for the receiving pane to execute the “StaticVarGet” function to get the data:

 

1)       Click on the receiving chart.  Clicking any pane on the chart causes it to refresh.

2)       Exec the “RefreshAll()” method of the Broker.Application object.  This refreshes all charts.

 

In the code above, if the "gOverlayMktCapBool" variable is set, it execs the “RefreshAll()” method to cause all charts to refresh.  That works well except that sometimes it takes 1-2 seconds (system dependent) to refresh all charts automatically.   Again this occurs only when the variable value changes.

 

Regards,

 

Dan.

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Paul Yarwood
Sent: Saturday, January 28, 2006 9:08 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Getting values from another pane

 

I know this is simple but I can't find any reference to it
Can values be shared from one pane to another and how is it done.





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