Enrty / exit in set 2, based on position in set 1

I have a condition to buy future in set 1
now in set 2 I have following condition:


If true, an ATM put is bought with current week expiry.

Basically, I buy nifty future in set 1 and exit if certain conditions are met as specified in set 1 exit.
Now in set 2, if a position exists in set 1 and (15 minute candle makes a new low or time is more than 1520), i want to buy atm put.
In set 2 exit, the net quantity in set 1 is 0 or (15 minute candle makes a new high and time is less than 1520)

similarly, in set 3 i sell future and buy call in set 4 based on net quantity in set 3.
Issues:
Entry occurs in set 2, at 1520 without a position in set 1.
exit does not happen when condition is met in set 2 exit

set 2 exit condition:

Looks like ‘net quantity’ not working. Use ‘position details’ to find set1 quantity. It should work.

Thanks for your reply, you are right “net quantity” is the culprit.

  1. Position details does not give me an option to select Futures as Instrument type.
  2. I don’t see an option to find set wise quantity. say set1 quantity
  3. Question: if I have few strategies running buying and selling “Nifty Future”, will this affect Net Quantity(traded instrument name,1,1,1) in my current strategy? question arises because it is looking for count of “traded instrument name”, which is constant across strategies, I guess.
    Thanks

  1. I have not tried for futures. I think by setting Instrument Type as All ( as you shown above) it may capture futures values also
  2. oh yes. Position Details fetches values at strategy level. Not set level
  3. The values from current strategy only. It won’t consider other strategies.

Thanks
set 1 is buying and set 2 is selling, so I am going to try “net Quantity” with >0 and <0 comparisons instead of == 0

I see a cross talk between two sets. For the same underlying, I am buying futures in one set and options in other. Last repaired price takes whichever was traded last and ends in comparing options price to futures price and results in erroneous decisions!