Pine script input menu

Viewed 87

I'm making an indicator with a built in menu with long and short signals ( crossover, crossunder) how do i use different values for the crossover and crossunder for each crypto pair to change long and short signal for each coin when selected from the menu.

enter image description here

1 Answers

You can use either input.symbol() so that the user can choose any ticker id, or use input.string() and provide some pre-defined ticker ids.

Then do a string comparison (e.g. if the ticker is BTC) and use whatever values you want to use for the crossover() and crossunder().

//@version=5
indicator("My script")

ticker_symbol = input.symbol("", "Symbol")
ticker_str = input.string("BTC", "Ticker", ["BTC", "ETH", "XRP"])
plot(close)

enter image description here

Related