Do you know how I can simplify this logical expression? I am trying to fix it for hours, but I can't.
if (trade_dur == 0 and ( ( is_short # Red candle (for longs) and row[OPEN_IDX] < row[CLOSE_IDX] # Red candle and trade.open_rate > row[OPEN_IDX] # trade-open above open_rate and close_rate < row[CLOSE_IDX] # closes below close ) or ( not is_short # green candle (for shorts) and row[OPEN_IDX] > row[CLOSE_IDX] # green candle and trade.open_rate < row[OPEN_IDX] # trade-open below open_rate and close_rate > row[CLOSE_IDX] # closes above close ) )):
row[OPEN_IDX] == row[CLOSE_IDX],trade.open_rate == row[OPEN_IDX], and/orclose_rate == row[CLOSE_IDX]?