I have a pine script strategy, which does simple buy/sell orders using:
strategy.entry("Long", strategy.long, when = cond1)
strategy.entry("Short", strategy.short, when = cond2)
strategy.close("Long", when = cond3)
strategy.exit(id="TrailStop", stop=shortStopPrice)
Now I am setting up a Tradingview alert which needs to output specific information.
I can output buy or sell using {{strategy.order.action}}, but I also need to output the words close or open. Do you know how I can get this value in the alert message box? Does it exist in some sort of standard variable of strategy? Or can I assign it in the script and call it in the alert box?
Update: based on the answer of bjorn-mistiaen, I added a comment. It works fine for .entry and .exit, but not for .close:
strategy.close(id = "Long", when = cond3, comment="test")
returns:
Hoovering the function shows me that comment is a valid argument though. I don't really understand the debug error message.
