Parameter properties display problems with ParamToggle

I wonder whether anyone else has encountered the following situation: Whenever I use two or more ParamToggle statements the display order in the Parameters properties window gets messed up. In this simple example of 3 MAs the default settings are 'Yes' - Display MA and everything looks fine (Screenshot 1). When I switch all 3 to 'No' the order gets out of sync (SS 2). Leaving the settings at 'No', when I exit and restart AB it remains messed up but in a different way (SS 3). Clicking on Reset all lines them up correctly again. Any ideas why this is happening?

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

_SECTION_BEGIN("EMA 1");
pd = Param("EMA 1 Period", 13, 2, 50, 1);
if (ParamToggle("Display EMA 1", "No|Yes", 1))
{
	Plot(EMA(C, pd), _DEFAULT_NAME(), ParamColor("Color", colorWhite), ParamStyle("Style"));
}
_SECTION_END();

_SECTION_BEGIN("EMA 2");
pd = Param("EMA 2 Period", 50, 2, 100, 1);
if (ParamToggle("Display EMA 2", "No|Yes", 1))
{
	Plot(EMA(C, pd), _DEFAULT_NAME(), ParamColor("Color", colorYellow), ParamStyle("Style"));
}
_SECTION_END();

_SECTION_BEGIN("EMA 3");
pd = Param("EMA 3 Period", 100, 2, 200, 1);
if (ParamToggle("Display EMA 3", "No|Yes", 1))
{
	Plot(EMA(C, pd), _DEFAULT_NAME(), ParamColor("Color", colorCustom12), ParamStyle("Style"));
}
_SECTION_END();



You shouldn't put Param* statements inside a conditional like if. See Parameters - Conditionally set No | Yes ParamToggle() to No - #4 by Tomasz

1 Like

Thanks for your reply. I have put PT outside 'if' but the problem persist.

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

_SECTION_BEGIN("EMA 1");
pd = Param("EMA 1 Period", 13, 2, 50, 1);
pt = ParamToggle("Display EMA 1", "No|Yes", 1);
if (pt == 1)
{
	Plot(EMA(C, pd), _DEFAULT_NAME(), ParamColor("Color", colorWhite), ParamStyle("Style"));
}
_SECTION_END();

_SECTION_BEGIN("EMA 2");
pd = Param("EMA 2 Period", 50, 2, 100, 1);
pt = ParamToggle("Display EMA 2", "No|Yes", 1);
if (pt == 1)
{
	Plot(EMA(C, pd), _DEFAULT_NAME(), ParamColor("Color", colorYellow), ParamStyle("Style"));
}
_SECTION_END();

_SECTION_BEGIN("EMA 3");
pd = Param("EMA 3 Period", 100, 2, 200, 1);
pt = ParamToggle("Display EMA 3", "No|Yes", 1);
if (pt == 1)
{
	Plot(EMA(C, pd), _DEFAULT_NAME(), ParamColor("Color", colorCustom12), ParamStyle("Style"));
}
_SECTION_END();


8a37212222c380e9e935e55c259cb448f1033c11_2_264x500

Looks like you are editing a formula already inserted in a chart AND INSTEAD of clicking APPLY you are clicking save

Hit Reset All in parameters and use apply

No, you still have ParamColor and ParamStyle statements inside the Plot statement, which is inside the if block.

Thanks for your suggestion. Actually, I always click APPLY , never SAVE when making changes.

Thanks a lot. That did the trick. I should have been more attentive to that sneaky little asterisk.