Wealth-Lab Wiki

API ChartStyles Community Components Community Indicators IndexDefinitions Knowledge Base Misc Optimizers Pending Deletion PosSizers Providers Standard Indicators TASC Traders Tips TASCIndicators Tutorial Videos Visualizers
RSS

Navigation


Quick Search
»
Advanced Search »


CommentaryWindow

RSS

Syntax


public static void AddCommentary( this WealthScript obj, string line )
public static void Display( this WealthScript obj )

public void AddLine( string line ) public void Display()

Parameter Description

lineAny string of text, including HTML formatting

Description

Wealth-Lab 6 does not have the Commentary Viewer as its previous versions used to have. But with the power of .NET, it is pretty easy to bring it back. You can use any valid HTML tags in your commentary. For example, to force a line break end your string with the tag '<br>'.

Credit for this idea goes to Dave Aronow.


Example

Example using C# extension methods:


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() { for(int bar = Bars.Count-20; bar < Bars.Count; bar++) { // Add a line this.AddCommentary( "Bar Number: " + bar.ToString() ); } // Display Commentary Window this.DisplayCommentary(); } } }
Legacy syntax example:

Add the reusable code of the Commentary class to your Strategy (don't forget to include using System.IO line in the code) and call the methods like the example shows. .AddLine adds a string to the output, and .Display invokes the resulting Commentary in an Internet browser window.


using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using Community.Components; // CommentaryWindow here
/*** Requires installation of Community.Components Extension from www.wealth-lab.com > Extensions ***/

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { // Path to the resulting HTML file string path = @"C:\Commentary.html"; // Create an instance of the CommentaryWindow class CommentaryWindow cw = new CommentaryWindow( path );

for(int bar = Bars.Count-20; bar < Bars.Count; bar++) { // Add a line cw.AddLine( "Bar Number: " + bar.ToString() ); } // Display Commentary Window cw.Display(); } } }

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.

Used under license from FMR Corp. Copyright 2008 FMR Corp. All rights reserved.


ScrewTurn Wiki. Some of the icons created by FamFamFam.