Duplicate: Variables getting shared between 2 different analysis window

Hi,

I have created 2 separate AFL, first one named "GAP UP DOWN STRATEGY 1.0 - BACKTEST" and the second one "GAP UP DOWN STRATEGY 1.0 - EXECUTION". As the name suggests I use one for backtesting purpose and the latter one for just execution as I am sending orders to exchange. Though they are 2 different AFL, when used via analysis window, variables are getting shared in between them. Refer to the below code. These are the param variables declared in both AFL with the same name. Will this cause the problem? Should the runtime be referring them separately? Or am I making any mistake? Please help. Both AFL has almost the same code.

OPEN_ABOVE = Param("OPEN ABOVE / BELOW (%)", 2);
STOPLOSS_PERCENT = Param("STOP LOSS (%)", 1);
TARGET_PERCENT = Param("TARGET (%)", 3);
PRICE_ABOVE = Param("Price Above ?", 50, 0, 1000, 10);
VOLUME_ABOVE = Param( "Volume Above ?", 300000, 0, 1000000, 50000 );
AVERAGE_VOLUME_ABOVE = Param("Average Volume Above ?", 300000, 0, 1000000, 50000 );
AVERAGE_VOLUME_DAYS = Param("Average Volume Days ?", 3, 2, 50, 1);

Thanks and Regards,
Vinay

What you observe is by design and not new.
Param* were made for charts (originally).
Param* are dependent on chart ID.
Chart ID value is zero in all analysis windows.

Quote

1 Like

@vinaykumar, please, read also this @Tomasz answer.

1 Like

FYI (again and with example), using unique param namimg still leads to interference issue.

E.g. analysis window one has following code:


p1 = Param( "This is Param p1", 1, 1, 20, 1 );

_TRACEF( "p1: %g", p1);


p2 = Param( "Just another Param  p2", 2, 1, 20, 1 );

_TRACEF( "p2: %g", p2);

Now change param in analysis 1 to e.g. 10.

Then got to analysis 2 and change param to e.g. 8.

Now go back to analysis 1 and open param window there.

You will see that it got reset back to default value of 1.

Then go back to analysis 2 and you will see it got reset back to default value of 2.

All that despite of unique naming.

1 Like

That is not interference. Params with given ID that are unused by formula are removed. If you again use the formula that uses removed parameter it will obviously get the default value.

1 Like

This thread is a duplicate of: Changing Param in Backtest

DO NOT create duplicate threads.