using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using WealthLab.ChartStyles; /* Note */namespace WealthLab.Strategies { public class MyStrategy : WealthScript { StrategyParameter _scale; StrategyParameter _level; StrategyParameter _pctRev; public MyStrategy() { _scale = CreateParameter("Scale", 1, 1, 10000, 1); _level = CreateParameter("Level (disabled)", 0, 0, 10000, 100); _pctRev = CreateParameter("Reverse %", 10, 1, 25, 1); } protected override void Execute() { double rev = _pctRev.Value; BarChartStyle bcs = null; try { bcs = (BarChartStyle)ChartStyle; } catch { DrawLabel(PricePane, "Please switch to Bar (OHLC) Chart Style", Color.Red); return; } int b = bcs.LeftEdgeBar; DataSeries mVPT = new DataSeries(Bars, "Modified VPT"); DataSeries avg4 = (Open + High + Low + Close) / 4d; _level.Value = avg4b; DataSeries avg4_1 = avg4 >> 1; DataSeries change = (avg4 - avg4_1) / avg4_1; // changed from *= (Volume / 50000d); // to compensate a little for diverse ranges of Volume change *= ( Volume / Math.Pow(10, Math.Log10(SMA.Value(Bars.Count - 1, Volume, 50))) ); for (int bar = b; bar < Bars.Count; bar++) { mVPTbar = ( mVPTbar - 1 + changebar ); } mVPT *= _scale.Value; mVPT += _level.Value; PlotSeries(PricePane, mVPT, Color.Teal, LineStyle.Solid, 2); } } }