What will be sample code for following simple strategy for PI

Buy when, all following conditions are satisfied,

MACD (6-13-5) is bullish.

AND

Stochastic Oscillator (15-5-3) bullish

AND

  1. 1st Bullish candle occurred with High-Low >0.145% [Ex: 12.5 pt when nifty @8600] 2. Next 2nd candle retracement <62% i.e CLOSE of next candle not less than 62% of H-L from High of previous candle. 3. Buy must be triggered on next 3rd candle(latest candle) @opening after previous 2nd candle is closed with above 62% retracement condition satisfied.

Similar opposite condition for sell.

Thanks in advance.

Buy:

SET A = MACDSignal(16, 13, 5, SIMPLE)
SET B = MACD(16, 13, 5, SIMPLE)
CROSSOVER(A, B) = TRUE
AND SOPK(15, 5, 3, SIMPLE) > 80 AND SOPD(15, 5, 3, SIMPLE) > 80

Sell:

SET A = MACDSignal(16, 13, 5, SIMPLE)
SET B = MACD(16, 13, 5, SIMPLE)
CROSSOVER(B, A) = TRUE
AND SOPK(15, 5, 3, SIMPLE) < 80 AND SOPD(15, 5, 3, SIMPLE) < 80
2 Likes