(Disclaimer: These strategies were showcased as part of our educational webinar – Creating a MACD Strategy on PHI 1 (6th November 2020). The purpose of sharing these strategies is purely educational. Please do not consider these for investment purpose)

**1. MACD Strategy**

**Original Source: ****View Video**

You will find the entry and exit condition in this video which you can create using PHI 1’s Strategy Creator in the Form Code (No coding required)

**2. Guppy Multiple Moving Averages Strategy**

**Original Source: ****View Video**

Since this one is a complex strategy, we have created this one using PHI 1’s Strategy Creator in the Code Mode.

Here’s the code for the same. You can try it out for free

**INIT**

# short term moving averages

self.sema1 = EMA(close,period=3)

self.sema2 = EMA(close,period=5)

self.sema3 = EMA(close,period=8)

self.sema4 = EMA(close,period=10)

self.sema5 = EMA(close,period=12)

self.sema6 = EMA(close,period=15)

# long term moving averages

self.lema1 = EMA(close,period=30)

self.lema2 = EMA(close,period=35)

self.lema3 = EMA(close,period=40)

self.lema4 = EMA(close,period=45)

self.lema5 = EMA(close,period=50)

self.lema6 = EMA(close,period=60)

# confirmation long term moving average

self.conf_lema = SMA(close,period=200)

# ATR

self.atr = ATR()

————————————

**STEP**

# entry

if self.position.size == 0:

list_sema = [self.sema1[0], self.sema2[0], self.sema3[0], self.sema4[0], self.sema5[0], self.sema6[0]]

list_lema = [self.lema1[0], self.lema2[0], self.lema3[0], self.lema4[0], self.lema5[0], self.lema6[0]]

if min(list_sema) > max(list_lema) and low[0] > self.conf_lema[0] and min(list_sema) > self.conf_lema[0] and min(list_lema) > self.conf_lema[0]:

# buy_bracket(limitprice=close[0] + self.atr*8, price=close[0], stopprice=close[0] – self.atr*4)

buy()

#exit

if self.position.size > 0:

list_sema = [self.sema1[0], self.sema2[0], self.sema3[0], self.sema4[0], self.sema5[0], self.sema6[0]]

list_lema = [self.lema1[0], self.lema2[0], self.lema3[0], self.lema4[0], self.lema5[0], self.lema6[0]]

if min(list_sema) <= max(list_lema) or low[0] <= self.conf_lema[0]:

square_off()

**How to use this code on PHI 1**

- Copy & Paste the Init code in the – Enter initialize code here section
- Copy & Paste the Step code in the – Enter step code here section
- Click Run And Save

If you need any help or have any questions, then please **schedule a demo **session with us and we will help you out.

**Happy Trading,**

Team PHI 1