Comment on Code your Technical Analysis strategy

Nithin Kamath commented on 08 May 2013, 08:22 AM

NEHALMay 7 2013, 5:04 pm
Zerodha,

Can you please help me to develop code for following criteria?

1. buy = average of 15 period highest price & 15 period lowest price is greater than average of 30 period highest price & 30 period lowest price
2. sell = average of 15 period highest price & 15 period lowest price is lower than average of 30 period highest price & 30 period lowest price

Thanks in advance.

Nehal
[ Click to thank ]Zerodha replyMay 8 2013, 1:50 pm
Buy:
SET H = MAXOF (MAX (HIGH, 14), REF (HIGH, 15))
SET L = MINOF (MIN (LOW, 14), REF (LOW, 15))
SET AVG = (H+L)/2
SET H1 = MAXOF (MAX (HIGH, 29), REF (HIGH, 30))
SET L1 = MINOF (MIN (LOW, 29), REF (LOW, 30))
SET AVG1 = (H1 + L1)/ 2
AVG > AVG1

Sell:

SET H = MAXOF (MAX (HIGH, 14), REF (HIGH, 15))
SET L = MINOF (MIN (LOW, 14), REF (LOW, 15))
SET AVG = (H+L)/2
SET H1 = MAXOF (MAX (HIGH, 29), REF (HIGH, 30))
SET L1 = MINOF (MIN (LOW, 29), REF (LOW, 30))
SET AVG1 = (H1 + L1)/ 2
AVG < AVG1

View the full comment thread »