Log in to see Cloud of Tags

Wealth-Lab Wiki

TASC 2012-02 | Trend, Momentum, Volatility, and Volume (TMV) (Star)

RSS

Traders' Tip text

Below is the C# code for Wealth-Lab 6 that plots the indicators and does color highlighting used in Barbara Star's TMV template. The Strategy is available for instant download from Wealth-Lab's "Open Strategy" dialog. Keep in mind that the breakout and retracement opportunities suggested by the template are to be found in trending markets.

Image

Figure 1.A Wealth-Lab 6.3 chart showing the highlighting according to the TMV template using Daily data of Crude Oil futures contract. The bottom pane visualizes the Volume Oscillator (OscV) featured in the article.


WealthScript Code (C#)



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

namespace WealthLab.Strategies { public class TMV_1202Star : WealthScript { protected override void Execute() { DataSeries K1 = KeltnerLower.Series( Bars, 13, 13 ); DataSeries K2 = KeltnerUpper.Series( Bars, 13, 13 ); ADX adx = ADX.Series( Bars,10 ); SMA sma = SMA.Series( Close,8 ); DataSeries OscV = (SMA.Series( Volume,20 ) - Volume)/SMA.Series( Volume,20 ) * 100; OscV.Description = "Volume Oscillator"; DataSeries cci = CCI.Series( Bars, 13 );

ChartPane cPane = CreatePane( 30, true, true ); ChartPane oPane = CreatePane( 30, false, true ); SetBarColors( Color.DarkGray,Color.DarkGray ); PlotSeries( PricePane, SMA.Series( Close,13 ), Color.Red, LineStyle.Solid, 1); PlotSeriesFillBand( PricePane, K1, K2, Color.Red, Color.Empty, LineStyle.Solid, 1); PlotSeriesOscillator( oPane, OscV, 50, -50, Color.Blue, Color.Red, Color.Empty, LineStyle.Histogram, 2); PlotSeries( oPane, OscV, Color.Black, LineStyle.Solid, 2); PlotSeries( cPane, cci, Color.Purple, LineStyle.Histogram, 3 ); DrawHorzLine( cPane, -100, Color.Red, LineStyle.Dashed, 1 ); DrawHorzLine( cPane, 100, Color.Blue, LineStyle.Dashed, 1 ); for(int bar = GetTradingLoopStartBar(30); bar < Bars.Count; bar++) { bool adxPriceRising = adxbar > adxbar-1 && Closebar > smabar; bool adxPriceFalling = adxbar > adxbar-1 && Closebar < smabar; if( adxPriceRising ) SetBarColor( bar, Color.LightGreen ); else if( adxPriceFalling ) SetBarColor( bar, Color.Red ); } } } }

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.