in v5 of pine Script i have below strategy and i want to exit whenever my stop or limit reached but sometimes they've ignored. i want to achieve 0.5 percent for stoploss and takeprofit but i've get 0.5,2.2 or higher.
IsLong() =>
strategy.position_size > 0
IsShort()=>
strategy.position_size < 0
currEntryPrice_short = strategy.opentrades.entry_price(strategy.opentrades - 1)
curTpPrice_short = (currEntryPrice_short *(100 - v3takeprofit_input))/100
currStopPrice_short = (currEntryPrice_short * (100 + v3stoploss_input))/100
if low <= curTpPrice_short and IsShort()
strategy.exit("Take Profit Hit", "Short", limit =curTpPrice_short)
if high >= currStopPrice_short and IsShort()
strategy.exit("Stop Loss Hit", "Short", stop=currStopPrice_short)
currEntryPrice = strategy.opentrades.entry_price(strategy.opentrades - 1)
curTpPrice = (currEntryPrice * (100 + v3takeprofit_input))/100
currStopPrice = (currEntryPrice *(100 - v3stoploss_input))/100
if low <= currStopPrice and IsLong()
strategy.exit("Stop Loss Hit", "Long", limit=currStopPrice)
if high >= curTpPrice and IsLong()
strategy.exit("Take Profit Hit", "Long", stop=curTpPrice)