Log in to see Cloud of Tags

Wealth-Lab Wiki

Intraday / Multi-Time Frame | Compressed price series alignment

RSS
To align data from higher time frames within a chart, previous versions of Wealth-Lab had a special "Synchronization" dialog with these three options:

  1. Compressed Bar Available on Last Bar of Period (default behavior)
  2. Compressed Bar Available on the First Bar of Period
  3. PREVIOUS Compressed Bar Available on the First Bar of Period


As the familiar Synchronization dialog was left out of Wealth-Lab 6 for the purpose of simplification, here's an example by the Wealth-Lab author, Dion Kurczek, that demonstrates how synchronization can be performed in the Strategy. Paste this code in a new Strategy window and run it on a minute-based chart to see all the three synchronization options:


using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
 
namespace WealthLab.Strategies
{
	public class MyStrategy : WealthScript
	{
		protected override void Execute()
		{
			if( Bars.Scale == BarScale.Minute )
			{
				SetScaleDaily();
				DataSeries option2 = Bars.High; 	option2.Description = "High (option2)";
				DataSeries option3 = option2 >> 1;	option3.Description = "High (option3)";
				RestoreScale();
				option2 = Synchronize( option2 );
				option3 = Synchronize( option3 );
				DataSeries option1 = option3 << 1;	option1.Description = "High (option1)";
				option1[Bars.Count-1] = option2[Bars.Count-1];
				PlotSeries( PricePane, option2, Color.Blue, LineStyle.Solid, 4 );
				PlotSeries( PricePane, option3, Color.Red, LineStyle.Solid, 2 );
				PlotSeries( PricePane, option1, Color.Black, LineStyle.Solid, 1 );
			} else
			{
				DrawLabel( PricePane, "Switch to minutes" );
			}
		}
	}
}

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.