Margnilien
Pine Script Rookie
Pine Script Rookie
Posts: 1
Joined: November 6th, 2020

Help with my script

Hi.

I have written a basic script to be able to quickly draw my horizontal lines for (support/ resistance) on a chart. Is there a way to make a script be stock symbol specific. I don’t want say $fb horizontal lines showing on the $sq chart?

Thanks

User avatar
Matthew
Site Admin
Site Admin
Posts: 92
Joined: July 1st, 2020
Location: Australia
Contact: Website Facebook Twitter TradingView Profile

Re: Help with my script

Hi Margnilien!

There are a few ways to achieve that. The easiest way I can think of would be to hard-code a check, something like this:

Code: Select all

horizontalLine = XXX
if syminfo.tickerid != "FB"
    horizontalLine := na

plot(horizontalLine)
That would change your horizontalLine value to "na" and plot nothing to the chart if the current market symbol is not "FB". Hope that helps :)

Return to “Pine Script Q&A”