问题
I am hoping someone help me.I know this is probably really simple, but I couldn't figure it out.
In a pivots script , it has the user can input the pivot type:
pivotType = input(title="Pivot Type", options=["Daily", "Intraday", "Weekly"], defval="Daily")
In the alert message, I want it to state the pivot type hit when the alert goes off. I want the message to say "Daily Pivot level hit", or "Weekly Pivot level hit". I tried the following below, but it didn't appear to work.:
alertcondition(condition=cross(close, r1), title="All Pivots Alert", message="A {{pivotType}} Pivot level hit")
I tried the format above, but it didn't appear to work. What do I need code in to have the pivotType be displayed as part of the message?
Thank you very much for your help!!
回答1:
It's not currently possible to include dynamic text in alertcondition()
message text. See Is it possible to use a string that varies as an argument to the alertcondition() function’s message= parameter? for more details.
You could use this technique to plot a varying numeric value corresponding to each of your conditions: How can I include values that change in my alerts?
来源:https://stackoverflow.com/questions/62938813/tradingview-alerrt-message-question-alertcondition-custom-message-question