Re-entry condition

Want to code -B& C
A) Shorted 20 lot CE & PE at ATM say when NIFTY 50 is at 16400 .-coding done.
B) 1.When Nifty either goes to ATM+ 100(16500) or ATM-100(16300)-2 lot should be squared off.
2.When Nifty either goes to ATM+ 200(16600) or ATM-200(16200)-3 lot should be squared off.

C) 1.When market comes back to ATM+ 100(16500) or ATM-100(16300)-3 lot should be added back.
2.When market comes back to ATM-16400 -2 lot should be added back.

Thus progressive reduction in lot with movement away from original ATM and progressive adding back of same lot once market progress towards original ATM.

Please send this to [email protected]