StaticVarSet incorrect type error


I am trying to initialize a static varible with StaticVarSet and encountered an incorrect type error. The following code has an error message with
StaticVarSet(“BoughtSym”, symbol, 1)) -

“Error 5. 2nd argument of the StaticVarSet() call has incorrect type. The function expected a NUMBER here, but found a STRING.”

Any comment would be appreciated.
Thank you.

symbol    = ParamStr( "First Symbol", "AAPL" );								

if (Nz(StaticVarGet("BoughtSym")) == 0.0) 	// Initialize BoughtSym
   	StaticVarSet("BoughtSym", symbol, 1));

If I use StaticVarSetText and StaticVarGetText instead, then I have an incorrect type error for StaticVarGet(“BoughtSym”)

symbol  = "AAPL";							

if (Nz(StaticVarGet("Bought" + symbol)) == 0.0) 	// Initialize BoughtAAPL
   	StaticVarSet("Bought" +  symbol, 1);

Thank you Aron.

I couldn’t make it work.

What I want is that the static variable Bought remembers the symbol already bought and want to check if the highest ranked symbol for the next rebalancing is the same as the one already bought.

For TEXTS you should use proper StaticVarGetText/StaticVarSetText and use TEXT comparison.

symbol    = ParamStr( "First Symbol", "AAPL" );								

if ( StaticVarGetText("BoughtSym") == "" ) 	// Initialize BoughtSym
   	StaticVarSetText("BoughtSym", symbol, 1);