0

I want to send alert on tradingview with color change. This is an indicator named Trix. But dont have alert options. i try to add alert condition but dont work.

study(title="TRIX (Custom)", shorttitle="TRIX (Custom)") length = input(6, minval=1) out = 10000* change(ema(ema(ema(log(close), length), length), length)) upColour = #33CC33 downColour = #FF5555 hline(0, title="Zero") plot(out, color = out[1] > out ? downColour : upColour) *alertcondition(upColour, title="Buy", message="green buy") alertcondition(downColour, title="Sell", message="red sell")* 

1 Answer 1

1

Try to do this

alertcondition(out[1] <= out , title="Buy", message="green buy") alertcondition(out[1] > out , title="Sell", message="red sell") 

added an option based on the comment

alertcondition(out[2] > out[1] and out[1] <= out , title="Buy", message="green buy") alertcondition(out[2] <= out[1] and out[1] > out , title="Sell", message="red sell") 
Sign up to request clarification or add additional context in comments.

3 Comments

it worked, thank you very much. Just an other question, can we do this like ; give a buy signal if the color changes.
this way alarm triggered on every bar. i want to give alert only if color changes. Like this; if the color change red to green give buy signal. Other way sell signal. Thanks again.
Added a response.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.