Log in to see Cloud of Tags

Wealth-Lab Wiki

Intraday / Multi-Time Frame | GetIntradayBar and the similar functions



Wealth-Lab 5 does not include functions like GetIntradayBar or GetWeeklyBar, previously used to access compressed Data Series in a higher time frame. The purpose of these functions was to take a Bar number and convert it to the corresponding bar in the compressed Data Series interval. For example, it allowed to get the correct bar of data in a 15 minute compressed Data Series from a 1 minute chart.

Referencing the synchronized series on a bar-by-bar basis in Version 5 could simply be done using RestoreScale and Synchronize - the WL6 equivalents to RestorePrimarySeries and IntradayFromCompressed. Nonetheless, if you need those functions for compatibility when porting a ChartScript from Wealth-Lab 4, you'll find the code snippets below helpful:

Code Example 1: GetIntradayBar

Font font = new Font("Arial", 7, FontStyle.Regular); SetScaleCompressed(15); DataSeries CompBar = new DataSeries(Bars, "Compressed Bar Numbers"); // initialize a DataSeries for (int bar = 0; bar < Bars.Count; bar++) // load the bar numbers CompBarbar = bar; DataSeries CompressedClose = Close; // Compressed series for test RestoreScale();

// Synch the bar numbers with the base time frame (here's your "function") DataSeries GetIntradayBar = Synchronize(CompBar); for(int bar = 0; bar < Bars.Count; bar++) { int b = (int)GetIntradayBarbar; AnnotateBar(b.ToString("0"), bar, true, Color.Black, Color.Transparent, font); AnnotateBar(CompressedCloseb.ToString("0.00"), bar, false, Color.Black, Color.Transparent, font); }

Code Example 2: GetWeeklyBar

// Workaround for GetWeeklyBar

SetScaleWeekly(); DataSeries CompBar = new DataSeries(Bars, "Compressed Bar Numbers"); // initialize a DataSeries for (int bar = 0; bar < Bars.Count; bar++) CompBarbar = bar;

// Weekly EMA DataSeries wk_ema = EMA.Series( Bars.Close, 10, EMACalculation.Modern );


DataSeries wk_ema_synchedToIntraday = Synchronize( wk_ema ); DataSeries GetWeeklyBar = Synchronize(CompBar);

PlotSeries( PricePane, wk_ema_synchedToIntraday, Color.Blue, LineStyle.Solid, 1 ); SetBarColors( Color.Silver, Color.Silver ); HideVolume();

Font font = new Font("Courier", 7, FontStyle.Regular);

for(int bar = 30; bar < Bars.Count; bar++) { int gwb = (int)GetWeeklyBarbar; AnnotateBar(gwb.ToString(), bar, false, Color.Black,Color.Transparent, font);

if( wk_emagwb > wk_emagwb-1 ) SetBarColor( bar, Color.Blue ); }

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.