Log in to see Cloud of Tags

Wealth-Lab Wiki

Indicators | How to Plot ROC of multiple symbols on same chart

Suppose your task is to plot ROC - or any other indicator - of all the symbols from a DataSet in one single pane. For example, you have IBM, AAPL, INTC in a DataSet, and you would like to plot ROC for each one of them on top of each other.

With Wealth-Lab .NET, it's easily possible. Here's a short code snippet:

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

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { Random r = new Random(); private Color RandomColor() { Color randomColor = Color.FromArgb(r.Next(255), r.Next(255), r.Next(255)); return randomColor; }

protected override void Execute() { string clickedSym = Bars.Symbol; List<DataSeries> rocList = new List<DataSeries>(); foreach( string ds in DataSetSymbols ) { //if( ds != clickedSym ) rocList.Add( ROC.Series( GetExternalSymbol( DataSetSymbols[DataSetSymbols.IndexOf(ds)], true ).Close, 10 ) ); }

HideVolume(); ChartPane rocPane = CreatePane( 100, true, true ); foreach( DataSeries ds in rocList ) PlotSeries( rocPane, rocList[rocList.IndexOf(ds)], RandomColor(), LineStyle.Solid, 1 ); } } }


  • You need to loop over the DataSet's symbols (see: DataSetSymbols)
  • Add each symbol's ROC (or another indicator) to the List of DataSeries created before (see: rocList)
  • Then, you loop by that List and plot each series
  • Look up the helpful List.IndexOf method in MSDN
  • RandomColor is self-descriptive

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.