Log in to see Cloud of Tags

Wealth-Lab Wiki

TASC 2016-08 | The Middle-High-Low Range Moving Average (Apirine)

RSS

Traders' Tip text

The middle-high-low moving average by Vitali Apirine is a double smoothed indicator. It's simply a moving average applied to the middle of the high-low range. Like any moving average which helps determine the direction of a trend, it can be applied following same guidelines for using a moving average. Although our rendition uses either SMA or EMA to smooth the raw MHA, power users can utilize any of the many moving averages already available in Wealth-Lab.

Image

Figure 1 illustrates the application of the system's rules on the Daily chart of “RUT (Russell 2000)

After updating the TASCIndicators library to v2016.07 or later, the MHLMA indicator can be found under the TASC Magazine Indicators group. It can be plotted on a chart and be used as an entry or exit condition in a Rule-based Strategy without having to program a line of code yourself.

The Wealth-Lab Strategy lets you choose between SMA or EMA to build the MHLMA as well as to set the highest/lowest range and smoothing lookback periods interactively through "parameter sliders" on the bottom left of the screen.

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

namespace WealthLab.Strategies { public class TASC201608 : WealthScript { private StrategyParameter slider1; private StrategyParameter slider2; private StrategyParameter slider3; public TASC201608() { slider1 = CreateParameter("MHL Period",3,2,300,20); slider2 = CreateParameter("MA Period",10,2,300,20); slider3 = CreateParameter("SMA(0) or EMA (1)",0,0,1,1); } protected override void Execute() { int movAvgPeriod = slider2.ValueInt; bool isEMA = slider3.ValueInt == 0 ? false : true; var mhl = MHLMA.Series(Bars,slider1.ValueInt,slider2.ValueInt, isEMA ? WhichMA.EMA : WhichMA.SMA); DataSeries ema = EMA.Series(Close,movAvgPeriod,EMACalculation.Modern); DataSeries sma = SMA.Series(Close,movAvgPeriod);

PlotSeries(PricePane,mhl,Color.Red,LineStyle.Solid,1); PlotSeries(PricePane,isEMA ? ema : sma,Color.DarkGreen,LineStyle.Solid,1);

for(int bar = GetTradingLoopStartBar(1); bar < Bars.Count; bar++) { if (IsLastPositionActive) { if( CrossUnder(bar,isEMA?ema:sma,mhl) ) SellAtMarket(bar+1, LastPosition); } else { if( CrossOver(bar,isEMA?ema:sma,mhl) ) BuyAtMarket(bar+1, isEMA.ToString()); } } } } }

Eugene
Wealth-Lab team
www.wealth-lab.com

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.