I am relatively new to Pine Script and I am trying to create a script that would alert me whenever the price of a stock reaches certain levels. Here is my code: study(title="Price Alert", overlay=true) alertcondition(title='Price Alert', message='The price ...Read more
I am relatively new to Pine Script and I am trying to create a script that would alert me whenever the price of a stock reaches certain levels. Here is my code:
study(title="Price Alert", overlay=true)
alertcondition(title='Price Alert', message='The price of this stock has reached 100', condition=close > 100)
However, when I try to compile this code, I get an error message that says “Script could not be translated from null”. I have tried looking through the Pine Script documentation and searching online for solutions, but I haven’t been able to find anything that addresses this issue. Can someone with more experience in Pine Script help me figure out what is causing this error and how to fix it?
In addition to the code above, I have also tried creating a similar script that would alert me when the price reaches a certain moving average, but I am still encountering the same error message. Here is the code for that script:
study(title="MA Alert", overlay=true)
ma = sma(close, 20)
alertcondition(title='MA Alert', message='The price of this stock has crossed its 20-period moving average', condition=close > ma)
Any assistance with resolving this error would be greatly appreciated. Thank you in advance for your help!
Explore the significant historical events that shaped Turkey on our website. It's a journey into the past.
Explore the significant historical events that shaped Turkey on our website. It’s a journey into the past.
See less