Hi ! i need afl code for below strategy:
1.There is two contract one is Near month and another is Far month.
2. If Z score= +a , then sell n-lot near month contract and buy n-lot far month contract at same time without delay.
3. Unwinding all contract if Z score = between b & c.
4. If Z score= -a , then buy n-lot near month contract and sell n-lot far month contract at same time without delay.
5. Unwinding all contract if Z score = between d & e.
Note: 1. a, b, c, d & e are the any numeric values.
2. For every 1 min two current price (for two contracts) noted and from that current ratio is calculated.
3. Z score = [current ratio - average ratio of last 30 ratio]/ standard deviation of last 30 ratio. So z score for every one
minute needed.
Please help.....