ScrewTurn

Active Trader Strategies API Community ChartStyles Community Commissions Community Components Community Indicators Community Providers Community Visualizers Knowledge Base Misc Optimizers PosSizers Standard Indicators TASC Traders Tips TASCIndicators Tutorial Videos
RSS

Navigation







Quick Search
»
Advanced Search »

PoweredBy

Syntax


public enum AutoStopMode { AsPercent, AsPoint };
public virtual void ApplyAutoStops(int Bar)
public virtual void SetAutoStopMode(AutoStopMode mode)
public virtual void InstallTimeBasedExit(int Bars)
public virtual void InstallStopLoss(double StopLevel)
public virtual void InstallTrailingStop(double Trigger, double StopLevel)
public virtual void InstallReverseBreakEvenStop(double LossLevel)
public virtual void InstallBreakEvenStop(double Trigger)
public virtual void InstallProfitTarget(double TargetLevel)

Parameter Description

mode Select AsPercent (by default) or AsPoint
Bar Bar number to apply AutoStops

Parameters like "Bars", "Trigger" etc. are typical and should be used like you do with Wealth-Lab's built-in exits. See the documentation page for more information:
WealthScript Techniques - AutoStops.

Description

Automated stops aka AutoStops had always existed in legacy Wealth-Lab versions, but were purposefully removed from Version 5 due to possible peaking when incorrectly mixing them with manual stops. These methods can help you program various types of automated exits in your trading systems and reduce the size of your code.

Example


using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using Community.Components; // <-- AutoStops here

namespace WealthLab.Strategies { public class AutoStopsDemo : WealthScript { protected override void Execute() { // Create an instance of PositionHelper (class containing AutoStops), // passing a WealthScript object as "this" PositionHelper a = new PositionHelper(this); // Select AutoStop mode: AsPercent or AsPoint PositionHelper.AutoStopMode AsPercent = Community.Components. PositionHelper.AutoStopMode.AsPercent; //sample calls to auto stop methods a.SetAutoStopMode(AsPercent); // choose AutoStopMode a.InstallTimeBasedExit(30); a.InstallStopLoss(5); a.InstallProfitTarget(10); a.InstallBreakEvenStop(5); a.InstallReverseBreakEvenStop(3); a.InstallTrailingStop(6, (100 - 70)); for(int Bar = 20; Bar < Bars.Count; Bar++) { // Apply auto stops a.ApplyAutoStops(Bar); if (!IsLastPositionActive) { BuyAtMarket(Bar + 1); } }

} } }

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.

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


ScrewTurn Wiki version 3.0.2.509. Some of the icons created by FamFamFam.