Build Trading View code to trigger trades using Heikin Ashi Candles Sticks

Job ID: 34410139

Budget: ₹1,500 – ₹12,500 INR

This trading rules are for India, Nifty and Bank Nifty options using Trading View charts.
At the open of the day at 9:15 AM, wait for the first two 3 minute Heiking Ashi candles and follow the below rules,

Entry rule:
1. If the first two 3 minute candles are green, then buy Call Option at the nearest at the money strike price for 5 quantity for the current week expiry.
2. If the first two 3 minute candles are red, then buy Put Option at the nearest at the money strike price for 5 quantity for the current week expiry.

Exit rule:
1.1 If the next two 3 minute candles are red, then exit the Call Buy position at the market price.
2.1 If the next two 3 minute candles are green, then exit the Put Buy position at the market price.

Continue the next trades:
1.1.1 After exiting the Call Buy position at 2 red candles, enter a new position of Put Buy for the nearest at the money strike price for 5 quantity for the current week expiry.
2.1.1 After exiting the Put Buy position at 2 green candles, enter a new position of Call Buy for the nearest at the money strike price for 5 quantity for the current week expiry.

Run this logic in loop till 3 PM.
The last trade which remains open, needs to be squared off at 3:15 PM, using the above rules and do not enter a new trade. If the exit rule is not fulfilled then exit the position at the market price at 3:15 PM.