Now, if we have to change the common parameter “periods” value to, let’s say 21 for both the indicators, then, we have to right click on each pane and change it twice.
One way is to write them both into the same AFL, using a parameter and condition to display each one in a separate pane. Then insert the code twice to the chart and alter the display parameter for each. It’s described in detail on this thread: Plotting two custom indicators of same AFL into two different panes
You can then have a single parameter that is used as the input period in both cases.
You can use static variable. In one pane define the parameter you want to share
// Pane 1
periods = Param("periods", 10, 1, 100 );
StaticVarSet("sharedparam", periods );
Plot( CCI( periods ), _DEFAULT_NAME(), colorWhite, ParamStyle("Style") );
in second pane just read the static variable
periods = StaticVarGet("sharedparam");
// use periods
Plot( RSI( periods ), _DEFAULT_NAME(), colorWhite, ParamStyle("Style") );
RequestTimedRefresh( 1 );
This way you can share any number of parameters between any number of charts. Note that “sharedparam” is a global static variable visible from everywhere, so make sure it is unique for what you want to share.