I tried to write a strategy script in the Pine editor.
- The strategy.entry() is working as I expected.
- But the strategy.exit() is not working as per my logic.
- My exit calculation is high minus low of the previous candle.
I am new to Pine. Below is my code. Can someone point out what is wrong?
Short = ( ( close[1] > open[1] ) and ( high < high[1] ) and ( close < low[1] ) )
if ( Short )
Target = high[1] - low[1]
Loss = high[1] - low[1]
strategy.entry("Enter Short", strategy.short, 1, when = window() )
strategy.exit("Enter Short", "Enter Short", stop=Loss, limit=Target, when = window())