Page 1 of 1

Alert

Posted: Fri Jun 25, 2021 4:38 am
by Polk
Any know how i can make one alert for many coins?

I have one alert RSI 30%
How i can use this pinescript for alert my 50 coin in list?

I want to list all coin no scrip and not go 1 for 1 coins e make um new alert

it's is possible?

tks all

and sorry for bad english

Re: Alert

Posted: Mon Jun 28, 2021 9:39 am
by CanYouCatchMe01
This worked. I made a script that can plot multiple RSI lines of different symbols. The colour of the plot is green if the RSI value is below 30, and red if it is above 70. You can just copy the rows and add more symbols. I think the maximum number of stocks to plot is 40. You should also be able to add Alerts in the get_color_rsi().

Image

Code: Select all

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © CanYouCatchMe

//@version=4
study("My Script")

get_color_rsi(value) =>
    c = color.blue
    if (value < 30)
        //Alert: buy
        c:=color.green
    else if (value > 70)
        //Alert: sell
        c:=color.red
    c //Returning color

rsi_value = rsi(security("BTCUSD", timeframe.period, close), 14)
plot(rsi_value, color=get_color_rsi(rsi_value))

rsi_value := rsi(security("OMXS30", timeframe.period, close), 14) //Note: You need a := when assigning rsi_value again.
plot(rsi_value, color=get_color_rsi(rsi_value))

rsi_value := rsi(security("DAX", timeframe.period, close), 14)
plot(rsi_value, color=get_color_rsi(rsi_value))
I tried to make a string array of many symbols and then plotting them. When I tried to get a value from the array it returned a variable of the type "series[string]". The plot function only accepts a "sting", not a "series[string]".

The code that did not work:

Code: Select all

var a = array.new_string()
array.push(a, "OMXS30")
plot(security(array.get(a,0), timeframe.period, close)) //Error: "Cannot call 'security' with 'symbol'=series[string]. The argument should be of type: string"