I am using GUI controls to show and hide a line plot, at the 6th button (guicheck6 ), i am seeing this error
M = LastVisibleValue( Close );
LVBI = LastVisibleValue( BarIndex() );
CompIndex = Foreign( "^NSEI", "C" ); // Comparing other indices
N500 = Foreign( "Nifty 500", "C" ) / CompIndex;
Auto = Foreign( "Nifty Auto", "C" ) / CompIndex;
Bank = Foreign( "Nifty Bank", "C" ) / CompIndex;
Commodities = Foreign( "Nifty Commodities", "C" ) / CompIndex;
Energy = Foreign( "Nifty Energy", "C" ) / CompIndex;
FinServ = Foreign( "Nifty Financial Services", "C" ) / CompIndex;
FMCG = Foreign( "Nifty FMCG", "C" ) / CompIndex;
HCare = Foreign( "Nifty Healthcare Index", "C" ) / CompIndex;
Consumption = Foreign( "Nifty India Consumption", "C" ) / CompIndex;
IT = Foreign( "Nifty IT", "C" ) / CompIndex;
Media = Foreign( "Nifty Media", "C" ) / CompIndex;
Metal = Foreign( "Nifty Metal", "C" ) / CompIndex;
Midcap50 = Foreign( "Nifty Midcap 50", "C" ) / CompIndex;
Pharma = Foreign( "Nifty Pharma", "C" ) / CompIndex;
PBank = Foreign( "Nifty Private Bank", "C" ) / CompIndex;
PSBank = Foreign( "Nifty PSU Bank", "C" ) / CompIndex;
Realty = Foreign( "Nifty Realty", "C" ) / CompIndex;
Services = Foreign( "Nifty Services Sector", "C" ) / CompIndex;
// Plotting
Plot( MA( FMCG, 4 ), "FMCG", colorGold, styleLine | styleOwnScale | styleNoLabel );
Plot( MA( HCare, 4 ), "HCare", colorGreen, styleLine | styleOwnScale | styleNoLabel );
Plot( MA( Consumption, 4 ), "Consumption", colorGrey40, styleLine | styleOwnScale | styleNoLabel );
Plot( MA( IT, 4 ), "IT", colorGrey50, styleLine | styleOwnScale | styleNoLabel );
Plot( MA( Media, 4 ), "Media", colorIndigo, styleLine | styleOwnScale | styleNoLabel );
Plot( MA( Metal, 4 ), "Metal", colorLavender, styleLine | styleOwnScale | styleNoLabel );
Plot( MA( Midcap50, 4 ), "Midcap50", colorLightBlue, styleLine | styleOwnScale | styleNoLabel );
Plot( MA( Pharma, 4 ), "Pharma", colorLightGrey, styleLine | styleOwnScale | styleNoLabel );
Plot( MA( Realty, 4 ), "Realty", colorLime, styleLine | styleOwnScale | styleNoLabel );
Plot( MA( Services, 4 ), "Services", colorOrange, styleLine | styleOwnScale | styleNoLabel );
Plot( MA( N500, 4 ), "N500", colorAqua, styleLine | styleOwnScale | styleNoLabel );
AutoToggle = GuiToggle( "Auto", 1, 5 , 30, 70, 20, 1 );
guicheck1 = GuiGetCheck( 1 );
GuiSetColors( 1, 5, 0, colorWhite, colorGrey40, 0, colorWhite, colorGreen, 0, colorWhite, colorGold, 0 );
if( guicheck1 )
{
Plot( MA( Auto, 4 ), "Auto", colorBlue, styleLine | styleOwnScale | styleNoLabel );
}
BankToggle = GuiToggle( "Bank", 2, 5 , 60, 70, 20, 1 );
guicheck2 = GuiGetCheck( 2 );
GuiSetColors( 2, 5, 0, colorWhite, colorGrey40, 0, colorWhite, colorGreen, 0, colorWhite, colorGold, 0 );
if( guicheck2 )
{
Plot( MA( Bank, 4 ), "Bank", colorBlueGrey, styleLine | styleOwnScale | styleNoLabel );
Plot( MA( PBank, 4 ), "PBank", colorLightOrange, styleLine | styleOwnScale | styleNoLabel );
Plot( MA( PSBank, 4 ), "PSBank", colorLightYellow, styleLine | styleOwnScale | styleNoLabel );
}
CommToggle = GuiToggle( "Commodities", 3, 5 , 90, 70, 20, 1 );
guicheck3 = GuiGetCheck( 3 );
GuiSetColors( 3, 5, 0, colorWhite, colorGrey40, 0, colorWhite, colorGreen, 0, colorWhite, colorGold, 0 );
if( guicheck3 )
{
Plot( MA( Commodities, 4 ), "Commodities", colorBrightGreen, styleLine | styleOwnScale | styleNoLabel );
}
EnergyToggle = GuiToggle( "Energy", 4, 5 , 120, 70, 20, 1 );
guicheck4 = GuiGetCheck( 4 );
GuiSetColors( 4, 5, 0, colorWhite, colorGrey40, 0, colorWhite, colorGreen, 0, colorWhite, colorGold, 0 );
if( guicheck4 )
{
Plot( MA( Energy, 4 ), "Energy", colorBrown, styleLine | styleOwnScale | styleNoLabel );
}
FinServToggle = GuiToggle( "FinServ", 5, 5 , 150, 70, 20, 1 );
guicheck5 = GuiGetCheck( 5 );
GuiSetColors( 5, 5, 0, colorWhite, colorGrey40, 0, colorWhite, colorGreen, 0, colorWhite, colorGold, 0 );
if( guicheck5 )
{
Plot( MA( FinServ, 4 ), "FinServ", colorDarkYellow, styleLine | styleOwnScale | styleNoLabel );
}
//FMCGToggle= GuiToggle( "FMCG", 6, 5 , 180, 70, 20, 1 );
//guicheck6 = GuiGetCheck(6);
//GuiSetColors( 6, 5, 0, colorWhite, colorGrey40, 0, colorWhite, colorGreen, 0, colorWhite, colorGold, 0 );
//if( guicheck6 )
//{
// Plot(MA(FMCG, 4), "FMCG", colorBlue, styleLine|styleOwnScale|styleNoLabel);
//}