Reputation: 1
Actually I am working on alert (Pine script 4) for a customized strategy name as 'magicline".
This magicline shows in green, black or red when price of instrument goes up, remain flat and goes down respectively. I want to create buy or sell alert based on the color above mentioned. Can some body help me. I am new to this pine script, and down know much about it.
The problem I am facing is sometimes it works and alert continuously. and sometime it is not showing any thing.
Looking for your help. Our effort in pine is stated below
// alert for magicline
greenColor = (magicline == 1)
alertcondition(condition=greenColor, title="Buy", message="green buy")
redColor = (magicline != 1)
alertcondition(condition=redColor, title="Sell", message="red sell")
Thanks n Regards Gazi
Upvotes: 0
Views: 80
Reputation: 8779
Use debugging code like this to show you if your conditions are true when you expect them to be:
plotchar(greenColor, "greenColor", "▲", location.top)
plotchar(redColor, "redColor", "▼", location.bottom)
Upvotes: 0