I would like to use a dynamic comment in Pine Script strategy.exit using a string variable. Does anyone know if this is possible?
From researching this i have the impression it may be possible but cannot get it to work. There is not much info guiding how to do this other than 1 post i found on Stack Overflow. Following this post I have tried the following, but only the content in ” ” prints as the comment, and not the variable string content.
I would be grateful if somebody can enlighten me if this is possible, and if so …. what i am doing wrong with the below code or how can this be best achieved?
thankyou so much 🙂
var string BullEngulf_Order_Desc = na
BullEngulf_Order_Desc := if Long_BullEngulf_2
"Long Entry: Bull_Engulf 2"
else if Long_BullEngulf_3
"Long Entry: Bull_Engulf 3"
else if Long_BullEngulf_4
"Long Entry: Bull_Engulf 4"
strategy.exit('Exit Long', from_entry = 'Long_BullEngulf', qty = strategy.position_size, limit = BullEngulfingTP, stop = BullEngulfingSL, oca_name = "Long1_Exit", comment_profit = "Bkt Profit: "+(BullEngulf_Order_Desc), comment_loss = "Bkt SL: "+(BullEngulf_Order_Desc))