Comment on Code your Technical Analysis strategy

Nithin Kamath commented on 02 May 2013, 12:54 PM

Vincent asked this on an email:

I TRIED TO WRITE THE CODE AND FAILED. PLEASE TRY TO HELP ME AND TELL ME HOW TO SAVE.
FOR BUY SIGNAL
1) EMA5 CROSSING EMA6 FROM BELOW AND THE PRICE IS ABOVE EMA5:
PARABOLIC SAR CROSSING BELOW PRICE.
FOR SELL SIGNAL:
2) EMA6 CROSSING BELOW EMA5:
PARABOLICSABOVE
ALSO I WANT THE POP UP MESSAGE OF THE STOCK WHICH SATISFIES THE CONDITION.
REGARDS,

Answer:

Buy:
EMA (CLOSE,5) > EMA (CLOSE, 6) AND REF (EMA(CLOSE, 5),1) < REF(EMA(CLOSE,6),1) AND CLOSE > EMA(CLOSE,5) AND PSAR (CLOSE,0.02,0.2) < CLOSE.

Sell:
EMA (CLOSE,5) < EMA (CLOSE, 6) AND REF (EMA(CLOSE, 5),1) > REF(EMA(CLOSE,6),1) AND CLOSE < EMA(CLOSE,5) AND PSAR (CLOSE,0.02,0.2) > CLOSE

Buy exit: 0

Sell exit: 0

You will have to run this strategy individually for stocks, there is no option to run a screener. What you will have to do is, take live the same strategy individually for the various stocks you are tracking. Blog http://www.zerodha.com/z-connect/blog/view/managing-your-script shows you how to take live and setting alert preferences.

View the full comment thread »