>> MSymbol = WriteIf( MidSym="GM", "^GSPC", "^NDX"); >> I get an error here .....................^ >> something about incorrect type
You need "==" to compare values or strings. "=" is assignment. GP --- In [email protected], "marketmonk777" <[EMAIL PROTECTED]> wrote: > > Okay, I am making some good progress. > > I use the following line to extract a portion of the ATC name > > MidSym = StrMid(Symbol, 1, 2); > I have it offset by 1 character to remove the ~ (tilde?). > > Now I am stumped in that I can't figure out how to use the WriteIf > function: > > MSymbol = WriteIf( MidSym="GM", "^GSPC", "^NDX"); > I get an error here .....................^ > something about incorrect type > > MSymbol will be a variable that contains my market index symbol based > on which ATC code I have currently selected. > > if ATC name is ~NDX005MA > my MidSym returns ND > and I want MSymbol to be assigned ^NDX so it will plot the Nasdaq 100 > Index. > > Likewise if MidSym is GM then plot ^GSPC (SP500) > and if MidSym is RU then plot ^RUT (Russell 2000) > etc. > > So if some kind soul can give me a hint as how to perform string > comparison and an if-then coding I would be grateful. > > MM >
