I have been trying to figure this out for days now and I know the answer is going to be so simple...
I want to enter a position when multiple conditions are true. No errors are created when compiling script but no buys and sells appear on the chart as they should (perhaps something else is wrong in the code??). I have tried many things but here is my latest attempt.
//@version=3
strategy("Easy BTC Trading", overlay=true,pyramiding = 0, default_qty_type = strategy.percent_of_equity, default_qty_value = 10)
Multiple = input(2, minval=0,step=0.01)
ATR1 = atr(21)*Multiple
volumeavg = (volume[2]+volume[3]+volume[4])/3
highest = highest(high,5)
lowest = lowest(low,5)
long1 = high > highest
long2 = volume[1] >= volumeavg*2
go_long = high > highest and volume[1] > volumeavg*2
exit_long = low < lowest
strategy.entry("Long",strategy.long, when = go_long)
strategy.exit("Exit long","Long", profit = 5, stop = strategy.position_avg_price - ATR1, when = exit_long)
go_long? I would try by replacing the attempted booleanANDoperation with some if-then statements... - not2qubit