2

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

vitruvius
  • 15,740
  • 3
  • 16
  • 26
trkk
  • 21
  • 1

1 Answers1

0

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

vitruvius
  • 15,740
  • 3
  • 16
  • 26
  • Thanks for the reply, i already added the symbols as shown in the image using input.string. i can't however use the different crossover and crossunder values for each symbol – trkk Aug 09 '22 at 22:53
  • What is the problem? Is it getting data from those other tickers? – vitruvius Aug 10 '22 at 08:03