Wealth-Lab Wiki

API ChartStyles Community Components Community Indicators IndexDefinitions Knowledge Base Misc Optimizers Pending Deletion PosSizers Providers Standard Indicators TASC Traders Tips TASCIndicators Tutorial Videos Visualizers
RSS

Navigation


Quick Search
»
Advanced Search »


TASC 2020-08 | The Compare Price Momentum Oscillator (CPMO) Part 1 (Apirine)

RSS

Traders' Tip text

The Compare Price Momentum Oscillator (CPMO) by Vitali Apirine is not really a new indicator. It's rather an approach to put the DecisionPoint Price Momentum Oscillator (PMO) in an intermarket context.

Specifically, author uses the CPMO to compare momentum of different indexes. For example, it's believed that the S&P 500 rises when consumer discretionary (IXY) outperforms consumer staples (IXR) and vice versa.

As a reference we include a simplistic Strategy which produces buy signals when the PMO of IXY crosses above the PMO of IXR. The opposite event (a crossunder) generated a sell signal. Wealth-Lab users can find PMO in the Community Indicators library.


Image

Figure 1. On the daily chart, consumer discretionary (IXY) and consumer staples (IXR) are plotted along with the S&P 500 ETF (SPY).


On the daily chart, consumer discretionary (IXY) and consumer staples (IXR) are plotted along with the S&P 500 ETF (SPY).

WealthScript Code (C#)

On a closing note, simply download public strategies from Wealth-Lab (hit Ctrl-O and choose "Download...") to get the trading system code below:

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using Community.Indicators;

namespace WealthLab.Strategies { public class TASCAug2020 : WealthScript { private StrategyParameter slider1; private StrategyParameter slider2;

public TASCAug2020() { slider1 = CreateParameter("PMO period 1",35,2,300,20); slider2 = CreateParameter("PMO period 2",20,2,300,20); }

protected override void Execute() { var ls = LineStyle.Solid; var ixy = GetExternalSymbol("IXY", true).Close; var ixr = GetExternalSymbol("IXR", true).Close; var pmo_ixy = PMO.Series(ixy, slider1.ValueInt, slider2.ValueInt); var pmo_ixr = PMO.Series(ixr, slider1.ValueInt, slider2.ValueInt); int xoBar = -1, xuBar = -1;

ChartPane panePMO = CreatePane( 40, true, true); HideVolume(); PlotSeries( panePMO, pmo_ixy, Color.Green, ls, 1); PlotSeries( panePMO, pmo_ixr, Color.Red, ls, 1);

for(int bar = GetTradingLoopStartBar( Math.Max(pmo_ixy.FirstValidValue, pmo_ixr.FirstValidValue)); bar < Bars.Count; bar++) { bool xo = CrossOver( bar, pmo_ixy, pmo_ixr); bool xu = CrossUnder( bar, pmo_ixy, pmo_ixr);

if (xo) { xoBar = bar; DrawCircle( panePMO, 15, bar, pmo_ixy[bar], Color.Green, LineStyle.Solid, 1, true); }

if (xu) { xuBar = bar; DrawCircle( panePMO, 15, bar, pmo_ixy[bar], Color.Red, LineStyle.Solid, 1, true); }

SetBackgroundColor( bar, (xoBar > xuBar) ? Color.FromArgb(20, Color.Green) : Color.FromArgb(20, Color.Red)); if (xoBar == xuBar) SetBackgroundColor( bar, Color.Transparent); if (xoBar == xuBar) continue;

if (IsLastPositionActive) { Position p = LastPosition; if (xu) SellAtMarket( bar + 1, p, "Trend change"); } else { if (xoBar > xuBar) BuyAtMarket( bar + 1); } } } } }

Gene Geren (Eugene)
Wealth-Lab team

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.


ScrewTurn Wiki. Some of the icons created by FamFamFam.