I have tried many other alternatives and it never goes to the ELSE statement to then play the next IF statement
it the," id str.contains(orderIds, '1') == false and array.get(openOrder1, 1) == 0 " that doesn't go to the next else statement...
and if it did work I get weird errors where the strategy closes a " 1 " order WITH a "C2" limit order like HOW?? to fix this you can change strategy.order to strategy.entry BUT THEN the ELSE statement doesn't work so the code doesn't try to do the ELSE IF statement just like the first problem
else
if str.contains(orderIds, '2') == false and array.get(openOrder2, 1) == 0
var line[] imbalancedUpMidLines = array.new_line()
var line[] imbalancedUpMidLines2 = array.new_line()
orderIds = ""
for idx = 0 to strategy.opentrades - 1
strSuffix = idx == strategy.opentrades - 1 ? "" : ", "
orderIds += strategy.opentrades.entry_id(idx) + strSuffix
//Show result on the chart
//label.new(bar_index, high, orderIds)
var float [] limitClose1 = array.new_float(2,0)
var float [] limitClose2 = array.new_float(2,0)
var float [] openOrder1 = array.new_float(2,0)
var float [] openOrder2 = array.new_float(2,0)
if entry_signal_all
if str.contains(orderIds, '1') == false and array.get(openOrder1, 1) == 0
array.push(imbalancedUpMidLines, line.new(x1=bar_index, y1=high, x2=bar_index+20, y2=high, extend=extend.right, color = color.red))
strategy.order(id = '1', direction= strategy.long, qty = 0.1, limit = atrBandBot)
line.new(x1=bar_index, y1=high, x2=bar_index+20, y2=high, extend=extend.right, color = color.red)
array.set(limitClose1, 1, high)
array.set(openOrder1, 1, 1)
else
if str.contains(orderIds, '2') == false and array.get(openOrder2, 1) == 0
array.push(imbalancedUpMidLines2, line.new(x1=bar_index, y1=high, x2=bar_index+20, y2=high, extend=extend.right, color = color.red))
strategy.order(id = '2', direction= strategy.long, qty = 0.1, limit = atrBandBot)
line.new(x1=bar_index, y1=high, x2=bar_index+20, y2=high, extend=extend.right, color = color.red)
array.set(limitClose2, 1, high)
array.set(openOrder2, 1, 1)
if array.get(openOrder1, 1) == 1
if str.contains(orderIds, '1') == true
strategy.exit(id = "C1", from_entry= '1', limit=array.get(limitClose1, 1))
array.set(openOrder1, 1, 0)
if array.get(openOrder2, 1) == 1
if str.contains(orderIds, '2') == true
strategy.exit(id = "C2", from_entry= '2', limit=array.get(limitClose2, 1))
array.set(openOrder2, 1, 0)