Testing a Strategy - Any mistakes in the coding?

Hello experts,
I want to buy or sell TSLA based on a simple strategy. In Set 1 I have conditions for buy(close above or below 5EMA in 1 minute) and exit(Leg exit or Leg TSL). In Set 2 I have conditions for sell and exit. I want the strategy to take second set position only if the first set is exited. So I used Net Qty keyword. Please can anyone let me know if there are any errors in this.

Looks good.
If it is not working you can try use ‘Net Quantity =! 0’ in exit conditions instead of ‘Traded instrument’

USE ; open position=0 in AND mode

In the first line of exit condition, there is just one condition on the left side which traded instrument name, nothing on the right side. Will this work?

Not sure. Try paper trading

As per my understanding, this condition will not work. Not sure why you kept traded instrument name in your exit condition without qualifying it with a value on the right side.

Yes, this is the correct way of checking. Better to use open position rather than net quantity.