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 »


Syntax


public MSR(Bars bars, int period1, int period2, string description)
public static MSRSeries(Bars bars, int period1, int period2,)

Parameter Description

barsA Bars object
period1First lookback period
period2Second lookback period

Description

The MSR oscillator by David Varadi is a normalized support and resistance indicator that captured the typical or middle price over a short to intermediate time frame.

References


Calculation

The indicator is calculated using the following formula:

MSR = (10-day median of (H, L, C) – 20-day MAX (H, L, C))/(20-day MAX (H, L, C)) then take the 252-day percentrank of MSR or percentile ranking

Example

This example shows a primitive trading system based on the MSR indicator. Long trades are triggered when the MSR crosses above 0.5 and the system exits when the MSR crosses below 0.5:


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 MSRStrategy : WealthScript { private StrategyParameter paramPer1; private StrategyParameter paramPer2; public MSRStrategy() { paramPer1 = CreateParameter("Period 1", 10, 2, 300, 1); paramPer2 = CreateParameter("Period 2", 20, 3, 300, 1); } protected override void Execute() { //MSR= (10-day median of (H, L, C) – 20-day MAX (H, L, C))/(20-day MAX (H, L, C)) //then take the 252-day percentrank of MSR or percentile ranking int per1 = paramPer1.ValueInt; int per2 = paramPer2.ValueInt; MSR msr = MSR.Series( Bars,per1,per2 ); ChartPane msrp = CreatePane( 30,true,true ); HideVolume(); PlotSeries( msrp, msr, Color.Blue, LineStyle.Solid, 2 ); PercentRank pr = PercentRank.Series(msr,252); PrcRank pc = PrcRank.Series(msr,252); ChartPane p = CreatePane( 30,true,true ); PlotSeries( p, pr, Color.Red, LineStyle.Solid, 2 ); PlotSeries( p, pc, Color.Blue, LineStyle.Solid, 2 ); DrawHorzLine( p, 0.5, Color.Red, LineStyle.Dashed, 1 );

for(int bar = 252; bar < Bars.Count; bar++) { if (IsLastPositionActive) { if( CrossUnder( bar, pr, 0.5d ) ) SellAtMarket( bar+1, LastPosition ); } else { if( CrossOver( bar, pr, 0.5d ) ) BuyAtMarket( bar+1 ); } } } } }

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.

Used under license from FMR Corp. Copyright 2008 FMR Corp. All rights reserved.


ScrewTurn Wiki. Some of the icons created by FamFamFam.