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 »


Syntax


public static bool GetMode(WealthScript obj)
public static RunMode GetMode2(WealthScript obj)

public enum RunMode { SSB, MSB, SM, Error }

Parameter Description

objAn instance of the WealthScript object

Description

Returns the mode the Strategy is being executed. There are two methods, a simpler and legacy GetMode which returns false for single-symbol backtest and true for multi-symbol backtests, and GetMode2 which returns a RunMode which can take four values: SSB, MSB, SM, Error - single symbol backtest, multi-symbol backtest, running in Strategy Monitor and state of error.

Example

Here's a short snippet illustrating how to call the method in your Strategy code:

Example using C# extension methods:


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

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { var mode = this.GetMode(); var mode2 = this.GetMode2(); var text = ""; PrintDebug( "GetMode: " + ( mode ? "Multi-symbol backtest" : "Single-symbol backtest") ); switch (mode2) { case RunMode.SSB: text = "Single-symbol backtest"; break; case RunMode.MSB: text = "Multi-symbol backtest"; break; case RunMode.SM: text = "Strategy Monitor"; break; case RunMode.Error: text = "Error"; break; default: break; } PrintDebug( "GetMode2: " + text ); } } }

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.