## Strategies from PHI 1’s Webinar – Creating a MACD Strategy on PHI 1 (6th November 2020)

(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)

#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()

READ :   7 reasons PHI 1 is a unique algo trading platform

### How to use this code on PHI 1

1. Copy & Paste the Init code in the – Enter initialize code here section
2. Copy & Paste the Step code in the – Enter step code here section
3. 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.

Team PHI 1

## Q & A – Creating a MACD Strategy on PHI 1 (Webinar)

(Disclaimer: This Q&A session was 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)

Q.1. What if I deploy a strategy on multiple symbols? If Symbol 1 matches the condition, then what happens to other Symbols?

A. If Symbol 1 matches the conditions in your strategy, then the system will generate a signal for Signal 1 only, not for any other Symbols. Even if you deploy the same strategy for multiple symbols, each symbol functions as an independent one and there’s no dependency on other symbols.

If your broker account has enough balance, the system will generate and execute signals whenever the conditions are met for each symbol.

READ :   3 Trading Strategies You Can Code and Backtest on PHI 1 Right Now

Q.2. For how much duration can I run a strategy?

A. It’s up to you. You can run it forever or you can decide an end date for it and the strategy will run as per your instructions.

Q.3. If there is a tweak in my mind that is not possible within the form mode, can your team code it for me?

A. If you want to add an additional condition or make a change to the time period or your exit conditions, then you can do it from the Form Code itself.

If you think it is a complex one, and it is not possible from the Form Code, then you also have access to the Code Mode. You can edit it from the Code Mode as well.

We do realize that not all traders are familiar with coding syntax, so yes, if you need any assistance, do let us know and we will help you out.

Q.4. Can I add an ATR based stop loss?

A. Yes, you can

Q.4 Do I have to pay to try these strategies in PHI 1?

A. No. Both Creation Modes – Form Mode and Code Mode are available on the free plan. The only restriction is the number of strategies you can create at once.

READ :   7 reasons PHI 1 is a unique algo trading platform

Q.5. Is my strategy private? Or is it visible to other users as well?

A. Your account activity and strategy are completely private and only accessible to you. We encrypt all user information with the best in class encryption service. So, be assured that your strategy is only with you, not even us.

Q.6. Can I deploy this on Options?

A. Yes. You can.

Q.7 Which language do you use to code a strategy in PHI 1?

A. We use Python, but to code a strategy you just need to be aware of basic Python Syntax.

(Click here to watch the complete recording of the webinar)

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