Reputation: 1
As per my code below are buy and sell signals
buySignal = low < lower[1] and close > lower and close > open or close > upper and ta.crossover(rsiValue,rsiOverbought) and close > open
sellSignal = high > upper[1] and close < upper and close < open or close < lower and ta.crossunder(rsiValue,rsiOversold) and close <open
It is plotted on chart correctly also
But when try to enter below
strategy.entry("Enter Long", strategy.long, stop=buySignal,limit=buySignal + 15 * syminfo.mintick, oca_name="entries", oca_type=strategy.oca.cancel)
It gives error saying that
Cannot call 'operator +' with argument 'expr0'='buySignal'. An argument of 'series bool' type was used but a 'simple float' is expected.
Logic is that it enter Long if buySignal conditions are met then it should trigger stop limit order with current candle high + 15 (Buffer points) and stop loss = previous candle low - 15 (Buffer Points)
Can anyone help me in this?
Upvotes: 0
Views: 38
Reputation: 3108
The current candle high is 'high'.
The previous candle low is 'low[1].
Change ;
strategy.entry("Enter Long", strategy.long, stop=buySignal,limit=buySignal + 15 * syminfo.mintick, oca_name="entries", oca_type=strategy.oca.cancel)
To :
strategy.entry("Enter Long", strategy.long, stop=low[1] - 15* syminfo.mintick, limit=high + 15 * syminfo.mintick, oca_name="entries", oca_type=strategy.oca.cancel)
Upvotes: 0