Testing a trading approach centered on the PVI indicator on Microsoft stock with the aim of surpassing the stock’s performance. The Positive Volume Index is an accumulated metric utilizing volume shifts to identify areas where institutional investors may be active.

The PVI aids in evaluating the vigor of a trend and potentially confirming price reversals, applicable not only to individual securities but also to popular market indices.

Today, I’m examining a strategy for Microsoft that incorporates the Positive Volume Indicator alongside the Relative Strength Indicator. The strategy is straightforward, highlighting the efficacy of simplicity in trading strategies and the potential for success without resorting to complex machine learning models. Let’s delve deeper!

“In the financial realm, rising volume signals optimism, propelling stock prices upward and setting the stage for prosperity.” — Richard D. Wyckoff

Dear Friends,

We value your input and strive to tailor our content to best suit your needs. To ensure we're delivering the most convenient and engaging experience, we're seeking your opinion on the frequency of our newsletter.

Please take a moment to cast your vote: would you prefer a daily newsletter, providing you with frequent updates and insights, or a weekly newsletter, offering a more comprehensive roundup of the week's highlights?

Your feedback is invaluable in helping us shape our newsletter to better serve you. Thank you for your participation!

The Positive Volume Index Formula

When computing the Positive Volume Index (PVI) for today, we consider the chosen price series, which could be, for instance, the Close Price. If today’s volume exceeds yesterday’s volume, we employ the first formula; otherwise, we utilize the second formula.

Let’s Get In To It

1. Load packages, download data and calculate Technical Indicators.

msft_prices = pd.read_csv('path_to_the_file/msft_1hour_data.csv')

msft_prices['date'] = pd.to_datetime(msft_prices['date'])

msft_prices = msft_prices.set_index('date')

msft_prices['pvi'] = pandas_ta.pvi(close=msft_prices['close'],
                                   volume=msft_prices['volume'],
                                   length=20)

msft_prices['rsi'] = pandas_ta.rsi(close=msft_prices['close'],
                                      length=20)

msft_prices['rsi_lag_1'] = msft_prices['rsi'].shift()

msft_prices

2. Define The Trading Signal Long & Short.

msft_prices['signal_1'] = msft_prices['pvi'].diff().apply(lambda x: 1 if x>1 else (-1 if x<-1 else np.nan))

msft_prices['signal_2'] = msft_prices.apply(lambda x: 1 if (x['rsi_lag_1']<50)&(x['rsi']>50)
                         else (-1 if (x['rsi_lag_1']>50)&(x['rsi']<50) else np.nan), axis=1)

MSFT Stock Price & 2 Signals

Here’s the strategy breakdown based on the plotted signals:

  • Long signals are denoted by green triangles, while short signals are represented by red triangles.

Strategy Conditions:

  • If Signal_1 equals 1 AND Signal_2 equals 1, we enter a LONG position.

  • If Signal_1 equals -1 AND Signal_2 equals -1, we enter a SHORT position.

Take Profit and Stop Loss:

  • Take Profit is set at 2%.

  • Stop Loss is set at 2%.

Intraday Expectations:

  • Intraday strategies typically aim to capture short-term movements, necessitating tight take profit and stop loss levels.

3. Plot the results

Returns chart

Sharpe ration: 0.92

The strategy started with a portfolio value of $100,000 and ended with a final portfolio value of $126,312, yielding approximately a 26.3% return over the past two years.

While the strategy appears promising, there’s room for enhancement. Additional filters can be incorporated to weed out unfavorable trades or refine signal conditions. Discovering effective strategies demands meticulous effort and attention to detail.

Interestingly, despite the prevailing hype surrounding Machine Learning (ML) and advanced techniques, it’s evident that a super complex model isn’t necessarily required to generate potential returns. Many individuals are keen on implementing ML strategies, assuming they can easily integrate ML into their trading strategies. However, it’s worth noting that the process is more intricate than simply relying on automated solutions like ChatGPT. Success in trading demands a comprehensive approach and a thorough understanding of market dynamics.

Earn Free Gifts 🎁

You can get free stuff for referring friends & family to our newsletter 👇

1000 referrals - Macbook Pro M2 💻

100 referrals - A $100 giftcard 💳

5 referals - 2023 Model Book With Fundamental & Tech analysis

{{rp_personalized_text}}

Cope & Paste this link: {{rp_refer_url}}

Keep Reading