Sandoson
Pine Script Rookie
Pine Script Rookie
Posts: 2
Joined: February 7th, 2023

Thoughts on Repainting

longCondition = ta.change(Result) != 0 and Result > 0
shortCondition = ta.change(Result) != 0 and Result < 0

if longCondition
strategy.entry('Buy', strategy.long, alert_message = OpenLONGCode)
else if shortCondition
strategy.close('Short', 'Close', alert_message = CloseSHORTCode, immediately = true)

if shortCondition
strategy.entry('Sell', strategy.short, alert_message = OpenSHORTCode)
else if longCondition
strategy.close('Long', 'Close', alert_message = CloseLONGCode, immediately = true)

This for me has alleviated the same exit as entry under TYPE in strategy tester.... (strategy.exit is stop,limit,Take_profit).

i am aware you can put a delay in 'Alert' 'Message' but not sure how it would be written with alert_message already there ...


"{
{{strategy.order.alert_message}}
}"

Return to “Introductions”