Statistical Arbitrage Presentation by PHI 1 at Finbridge Algorithm Conference (Nov 2020)

Sharing a copy of our Statistical Arbitrage Presentation last week at Finbridge Algorithm Conference

View/ Download from here – Statistical Arbitrage in Algo Trading 

Speaker: Gaurav Mahajan       

  • The Math/ Logic behind the Strategy.
  • How to implement it
  • Selection of Securities to run
  • Risk/Reward Characteristics of the Strategy.
  • How to Construct a Long/Short Hedged Portfolio.
Tagged : / / / / / /

How to automate your trading strategy using PHI 1?

A trading strategy is a plan aimed at generating profits by taking a long or short position. Essentially, a trading strategy comprises a set of pre-defined rules followed by traders to make trading decisions.

A good trading strategy is one that factors in risk tolerance, specific objectives, time horizon, and even tax implications.

A well-researched and -executed trading strategy can help traders achieve profitable returns. You can also fully automate the signal generation and execution of a trading strategy via an algorithmic trading strategy.

With an automated trading strategy, the trader no longer has to monitor stock prices or punch in orders manually. Programming is often an important skill in developing algorithmic strategies.

Here’s how you can automate your trading strategy using PHI 1:

1. Hypothesis Formation/Strategy Formation

Hypothesis formation is all about what you think about the market. It is primarily an educated guess (based on confidence levels) about market behavior and the factors causing this behavior.

Thus, if you think the market is trending lower, you may want to short an asset and if you think the market is trending higher, you may want to go long on the asset—all this is based on statistical analysis.

To validate the hypothesis/assumption, you will need to perform hypothesis testing—a statistical method to test the claim, idea, or guess. In hypothesis testing, one needs to analyze the behaviour of samples (a small representative set) to draw insights about the entire population (a larger set).

Example: You may want to invest in stock only if it has given average returns of 15% annually. You check that for the past 5 years, the stock has given average returns of 18% with a standard deviation of 3%. Would you still invest in this stock? Hypothesis testing helps in such decision-making.

The most common steps used in hypothesis formation are to define the hypothesis, set the criteria, calculate the statistic, and reach a conclusion

2. Coding your Strategy

Once you have decided on your strategy, you need to code the logic of your strategy onto a platform. This would include instructions related to trade entry and exit points, decisions on take profit, putting in the stop loss condition, etc.

Many other factors such as trade size, trading capital also need to be factored in, basis your risk profile. PHI 1’s advanced strategy creator allows you to create, test, and analyze any strategy without restrictions, even if it’s an arbitrary one.

Further, with its Multi-Symbol Strategy Creator, you can create all possible quant strategies, be it Mean Reversion, Momentum, Day Trading, Multi-Frequency, Arbitrage Strategies, Pairs Trading, Seasonality/Calendar based Strategies, Forward Curve, and much more.

More than 125 technical indicators are already built-in and ready to use with a single line of code, and the user can define any new price- and volume-based indicator.

Moreover, PHI 1’s team is always there for any support you may need with strategy creation on our platform through interesting webinars, insightful content, and our comprehensive learn section.

You can start creating your strategies on PHI 1 without any coding knowledge. If you want to build an advanced one like Quant or Price-Action based, then you need to have basic knowledge of Python syntax. You can start right away with these trading strategies on PHI 1.

MultiSymbol Strategy Creator

3 Back-testing and Optimization

Back-testing is an essential tool to analyze the strategies you create based on historical data. This is because if the results of backtesting meet your criteria, it elevates your confidence levels while trading in the live market.

And if the results are less favorable, it’s a loss averted! You can always modify, adjust, and optimize your strategy to achieve a more desirable result.

Unlike most tools available in the market, PHI 1 enables bulk backtesting, an essential feature to identify scenarios where your strategy may underperform.

Further, PHI 1 offers scenario grading wherein you can get a score on your strategies in multiple market scenarios such as market crash and volatility, further adding to your confidence.

Scenario Grading

4. Simulator Testing

Now that you’re done with back-testing and optimizing your strategy, it is recommended that you test your strategy in a simulated (virtual trading) environment.

This can give you a crystal clear picture of how your strategy will perform in the live market. You can identify any bugs or edge conditions that might be present in the strategy code and refine your code accordingly.

PHI 1 offers the ability to simulate trades or perform forward-testing so you can gain the confidence of trading with your strategies in the live market!

Simulation

5. Live Trading

PHI 1 empowers a trader right from brainstorming a trading hypothesis to back- and forward-testing it. But wait, there’s more, once you’re ready to trade in the live market, PHI 1 helps you seamlessly deploy and closely monitor your trades too!

Moreover, with PHI 1’s multi-broker integration, you don’t have to be limited to a specific broker. The choice is yours. Even if one broker is having a downtime, you never miss a trade again! Multiple brokers also help you get the best rates.

PHI 1 assists traders throughout their trading strategy creation and execution journey.

Multibroker

Along with its unique features such as custom screeners and advanced risk controls, you are set free from the mundane, daily tasks that would otherwise cost you a lot of time and money. PHI 1 is, therefore, your complete solution to automated trading.

Unleash your trading superpowers with PHI 1. Try PHI 1 for free!

Tagged : / / / / / /

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)

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

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

Trading Strategies_Webminar

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

Tagged : / / / / / / / /

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.

Take a free trial today ! Tagged : / / / / / / / /