Hello there,
I have the choice of either using a fixed stop loss or as the recent lowest low. It works as desired. Also plotting on chart works fine (BTW didn't knew that this lowest-low stop loss works as trailing as well )
The idea is to choose the same option for profit taking by riding with the trend until the condition is met, or using a fixed percentage value.
Pine Script disagrees with me. The problem occurs at the "limit" parameter.
Pine Script demands a float and says I'm offering him a bool.
Does the "stop" and "limit" parameters do not accept the same variable type?
Thanks for the answer.
///////////
longStop = useStr ? ta.lowest(low, lookb) : strategy.position_avg_price * (1-SL_proc)
longProfit = useStr ? ta.crossunder(ta.ema(close,10), ta.ema(close, 20)) : strategy.position_avg_price * (1+TP_proc)
if strategy.position_avg_price > 0
strategy.exit(id = "close", stop = longStop, limit = longProfit)