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

Modified on 2010/03/14 17:13 by Eugene — Categorized as: Knowledge Base

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 ); } } }

Highlights: