Here you can search through the pages of this Namespace, their attachments and the files uploaded to the system.
Note: the results will only display the items you have permissions to read.
[...] paramLookbackForStepPattern;
public IRSTS_StepPattern()
{
paramPercent = CreateParameter("Reversal %", 10.0, 1.0, 50.0, 1.0);
paramLookbackForStepPattern = CreateParameter("Lookback", 3, 1, 20, 1);
}
bool isInsideBody( int bar, double price ) {
return price bar ,Close bar ) && price >= Math.Min(Open bar ,Close bar );
}
bool Upstep( int bar, int lookback ) {
bool result = false;
bool [...]
[...] obj.CreatePane(30,true,true);
obj.PlotSeries(p, adx, Color.Red, LineStyle.Solid, 2 );
for(int bar = obj.GetTradingLoopStartBar(1); bar bar bar > avgMAB bar )
obj.BuyAtMarket(bar+1,"Strong Trend"); if( adx bar > adxMult * adxLow bar && obj.CrossOver(bar, adx, crit) & c bar > avgMAB bar [...]
[...] data starts at 4/23/2008
int stBar = DateTimeToBar(new DateTime(2003, 4, 23), false);
for(int bar = 0; bar bar = yba stBar ;
// Based calculations from raw data and then synchronize
DataSeries ybaSMA = Synchronize( SMA.Series(yba, 40) );
DataSeries xauROC = Synchronize( ROC.Series(xau, 1) );
DataSeries crbROC = Synchronize( ROC.Series(crb, 1) );
DataSeries ejROC = Synchronize( ROC.Series(ej, 2) );
ej = Synchronize( ej );
yba = Synchronize( yba );
DataSeries sec1BOL = SecBol( [...]
[...] TASCJan2021()
{
paramPattern = CreateParameter("Pattern", 1, 1, 6, 1);
paramExitDays = CreateParameter("Exit after", 3, 1, 10, 1);
} protected override void Execute()
{
var _pattern = paramPattern.ValueInt;
var _exitAfter = paramExitDays.ValueInt;
int atrPeriod = 20, maPeriod = 80;
double tick = Bars.SymbolInfo.Tick;
var atr = ATR.Series(Bars, atrPeriod);
var trendFilter = SMA.Series(Close, maPeriod);
for(int bar = GetTradingLoopStartBar(Math.Max(atrPeriod,maPeriod)); bar bar [...]
[...] to create a Pullback in an Uptrend entry. For instance, in an established uptrend, wait for a three bar pullback and
enter at stop $0.10 above prior bar high. However, the Rule Wizard doesn't seem to have "Buy at Stop" rule desired. Solution:
You can get pretty close by starting with these rules: BuyAtLimit (High)
- Moving Average is trending up (Moving Average group)
- Price decreases a consecutive number of bars (Price (or Volume) group) ..and add an exit (if you only want a screen, see Techniques > Creating [...]
[...] from recent peaks or troughs. System rules Once a bullish divergence is detected, enter long next bar at open if MFO is below its centerline Exit long next bar at open when MFO crosses above the centerline Trades from the short side are deliberately not taken as their performance seems poor. Figure 1. Bullish divergence between the MFO and price formed in June 2015 triggered a long trade in KO (Coca Cola). After updating the TASCIndicators library to v2015.09 or later, the MoneyFlowOscillator indicator can be found under the TASC [...]
Bars, Loops, and Bar + 1
Original article by Robert Sucher in the legacy Knowledge Base here .
Wealth-Lab Developer has features such as order slippage and variable commissions to bring trading simulation as close to reality as possible. Likewise, your task as a trading system designer is to express your system in C# code that validly recreates security orders as they would have been and will be executed in real life. Bar Definition
A bar is any interval of time that has an open, high, low, and closing [...]
[...] CreateParameter("WilderMA period", 14, 1, 100, 1);
paramThresholdForTrend = CreateParameter("ADX Threshold", 30, 10, 50, 10);
paramHighest = CreateParameter("Highest high of", 20, 5, 50, 1);
paramExitDays = CreateParameter("Exit after", 20, 1, 50, 1);
}
protected override void Execute()
{
bool peak = false; int peakBar = -1;
int high = paramHighest.ValueInt;
bool trough = false; int troughBar = -1;
int low = paramHighest.ValueInt;
int period = paramPeriod.ValueInt;
int periodWMA = paramPeriodWMA.ValueInt;
int days [...]
[...] paramWeeklyLength2;
public WDMACD_Divergence()
{
paramHighest = CreateParameter("Highest high of", 130, 60, 300, 10);
paramExitDays = CreateParameter("Exit after", 20, 1, 50, 1);
paramDailyLength1 = CreateParameter("Daily Length 1",12,2,300,20);
paramDailyLength2 = CreateParameter("Daily Length 2",26,2,300,20);
paramWeeklyLength1 = CreateParameter("Weekly Length 1",60,2,300,20);
paramWeeklyLength2 = CreateParameter("Weekly Length 2",130,2,300,20);
}
protected override void Execute()
{
if( Bars.Scale != BarScale.Daily )
{
DrawLabel(PricePane, [...]
Syntax
public static double ChandelierStop(this Position p, Bars bars, int bar, int period, double coefficient ) public double ChandelierStop(Bars bars, int bar, Position p, int period, double coefficient )
Parameter Description p Position to apply Chandelier stop to period TR period for Chandelier stop calculation coefficient ATR factor for Chandelier stop calculation bars Bars object bar Bar number Description
The Chandelier Stop is a trailing stop that [...]
[...] above the 2nd one and the previous value was less than or equal to the target value at the previous bar. Motivated traders can compare approaches by commenting and uncommenting these lines:
if( CrossUnder( bar, tpEma, haEma ) )
//if( tpEma bar bar )
...
if( CrossOver( bar, tpEma, haEma ) )
//if( tpEma bar > haEma bar )
To run the sample Strategy in Wealth-Lab, you'll need the TASCIndicators [...]
[...] paramTrail;
public GoldenTriangleStrategy()
{
paramRiseBars = CreateParameter("Rise: X bars", 50, 10, 100, 10);
paramWhiteSpace = CreateParameter("White space %", 50, 10, 100, 10);
paramMinRise = CreateParameter("Min. rise %", 10, 5, 200, 5);
paramSMA = CreateParameter("SMA period", 50, 10, 200, 10);
paramMom = CreateParameter("Momentum period", 10, 2, [...]
[...] WealthScript
{
LineStyle ls = LineStyle.Solid;
public DataSeries RS2t(DataSeries ds, string index, int period = 10, bool plotSeries = false)
{
var rs = new DataSeries(ds, string.Format("RS2t({0},{1},{2}", ds.Description, index, period));
var extSym = GetExternalSymbol(index, true);
var RS1 = ds / extSym.Close; var Fast = EMAModern.Series(RS1, period); //Fast MA: Orange
var Med = SMA.Series(Fast, 7); //Medium MA: Green
var Slow = SMA.Series(Fast, 15); //Slow MA: Red
var Vslow = SMA.Series(Slow, 30); //V Slow MA: Blue int Tier1 = 0, Tier2 [...]
Syntax
public static int GetTime(this WealthScript obj, int bar)
public static int GetTime(this Bars bars, int bar) // For use when using a non-synchronized Bars object public int GetTime(int bar)
public int GetTime(Bars bars, int bar) // For use when using a non-synchronized Bars object
Parameter Description bar Bar number bars Bars object GetTime returns 24-hour time as an integer. Example: 4pm = 1600
Syntax [...]
[...] MADXY;
StrategyParameter chnlLength;
public MyStrategy()
{
D1DXY = CreateParameter("DX LRSlope Period", 25, 10, 50, 1);
D2SNL = CreateParameter("Snl LRSlope Period", 12, 5, 25, 1);
LRSDXYSELL = CreateParameter("DX LRSlope", 0.3, 0.1, 0.8, 0.1);
LRSNLSELL = CreateParameter("Snl LRSlope", -0.8, -1.2, -0.5, 0.1 );
MASELL = CreateParameter("Soybean EMA Period", 15, 5, 25, 1);
MASNL = CreateParameter("Snl EMA Period", 15, 5, 25, 1);
MADXY = CreateParameter("DX MA Period", 50, 20, 100, 5);
chnlLength = CreateParameter("Channel Period", 4, 2, 20, 2);
} // [...]
[...] for easy reference in users' Strategies. Here's the complete list of Strategy rules: Enter long next bar at open if following conditions are met:
Stock price greater than $1 50-day simple moving average of volume is greater than 100,000 Yesterday’s close was less than the day before Yesterday’s close was less than its open Today’s open is greater than yesterday’s close Today’s close is greater than yesterday’s open Today’s open is less than yesterday’s open As of yesterday’s close, price had been closing lower for three days Sell short next bar [...]
[...] ADX.Series( Bars,14 );
EMA ema = EMA.Series( Close, 60, EMACalculation.Modern );
for(int bar = period; bar bar = Math.Sign( Close bar - Close bar-1 ) * Close bar ;
}
DataSeries VP = EMA.Series( R, period, EMACalculation.Modern );
for(int bar = period; bar bar != 0 )
PZO bar = 100 * [...]
[...] ADX.Series( Bars,14 );
EMA ema = EMA.Series( Close, 60, EMACalculation.Modern );
for(int bar = period; bar bar = Math.Sign( Close bar - Close bar-1 ) * Volume bar ;
}
DataSeries VP = EMA.Series( R, period, EMACalculation.Modern );
for(int bar = period; bar bar != 0 )
VZO bar = 100 [...]
[...] changed from 12 to 51, and DataSeries initializations have been simplified. // WAS:
double Trend = ds bar - ds cycPeriod ;
// SHOULD BE (IS):
double Trend = ds bar - ds bar - cycPeriod ; /* Strategy Code revised 20090611 */
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators; namespace WealthLab.Strategies
{
public class CoronaCharts : WealthScript
{
public const double twoPi = 2 * Math.PI;
public [...]
[...] period;
public SVETrendsStopStrategy()
{
atrFactor = CreateParameter("ATR Factor", 2.8, 1, 10, 0.2);
period = CreateParameter("Period", 10, 2, 100, 2);
}
public DataSeries TrndsStop(Bars b, int period, double factor )
{
DataSeries loss = factor * TASCIndicators.ATRModified.Series(b, period);
DataSeries resistance = b.Close + loss;
DataSeries support = new DataSeries(b, "Support(" + period [...]
[...] almost any entry style without adding prejudice. Entry rules Pullback entry: Buy at open next bar if the DMI Oscillator is above 0 and the DMI Stochastic crosses above 10. Short at open next bar if the DMI Oscillator is below 0 and the DMI Stochastic crosses below 90. Countertrend entry: Short at open next bar if the DMI Oscillator crosses under -20. Buy at open next bar if the DMI Oscillator crosses above 20.
Exit rules Fixed bars: exit [...]
[...] and thereÆs an uptrend detected Short at stop next day when price breaks below the lowest price of 10 days and thereÆs a downtrend detected (if short trades are allowed) Buy at limit next day at 5% below todays low if thereÆs neither uptrend nor downtrend (buy dips) Exit at a -10% stop loss Exit long next day when a downtrend kicks in Exit long at stop next day at the lowest price of 10 days Cover at stop next day at the highest price of 10 days Figure 1. Trading system [...]
[...] Daily" scale (given there are 5 trading days in a week). Since Bi-Weekly and Monthly scales contain 10 and 22 trading days (respectively), it doesn't look like the new scale would be that necessary to bring much difference from either Bi-Weekly or Monthly. Out of the box, Wealth-Lab does not support custom chart scales like Bi-Weekly or Half-Quarterly. Alhtough the scales like Bi-Weekly or Quarter Quarterly could be accomplished fairly easily using the EOD Scaling Provider (a Wealth-Lab addon), we felt it would make more sense if the voting process considered intraday [...]
[...] determine and compare time of day
public class MyStrategy : WealthScript
{
public int GetTime(int bar)
{
return Date bar .Hour * 100 + Date bar .Minute;
}
protected override void Execute()
{
// Specifically, I use a strategy that buys stocks only in the time period between 9:55 am and 13:00. for(int bar = 1; bar = 0955 ) & ( GetTime(bar) Identify the Open price of the day when working with intraday data
Here's [...]
[...] CreatePane(30,true,true);
PlotSymbol(spyPane,spy,Color.Blue,Color.Red);
PlotSeries(spyPane,spySma,Color.Blue,WealthLab.LineStyle.Solid,1);
}
for(int bar = GetTradingLoopStartBar(200); bar bar bar - Bars.SymbolInfo.Tick [...]
[...] CreatePane(40,true,true);
PlotSeries(rdPane,rd,Color.FromArgb(255,255,0,0),LineStyle.Solid,1);
DrawHorzLine(rdPane,DIVSHORT,Color.Brown,ls,1);
DrawHorzLine(rdPane,DIVCRIT,Color.CadetBlue,ls,1);
for(int bar = GetTradingLoopStartBar(60); [...]
[...] Daily
HideVolume();
SetScaleDaily();
Bars dailyBars = Bars;
DataSeries CompBar = new DataSeries(Bars, "Compressed Bar Numbers");
for (int bar = 0; bar bar = bar;
RestoreScale();
dailyBars = Synchronize(dailyBars);
DataSeries GetDailyBar = Synchronize(CompBar); // Initialize an instance of the CamarillaPoint class
Camarilla c = new Camarilla();
double tick = Bars.SymbolInfo.Tick;
bool enterTrades = true;
bool canTrade = true;
Entry e = paramEntryType.ValueInt [...]
[...] The resulting countertrend system's rules are: Enter long: Buy tomorrow at open if today's a “gold bar” (a.k.a. CAM-PB i.e. 10-period ADX and MACD declines) but the 14-period CCI is above 0, or if today's a “blue bar” (i.e. the 10-period ADX declines but MACD rises) and today's Close crosses above the 13-period EMA .
Exit long: Sell tomorrow at open if today's a “red bar” (a.k.a. CAM-CT i.e. 10-period ADX rises but MACD declines) [...]
[...] Math.PI * delta / period);
double alpha = gamma - Math.Sqrt(gamma * gamma - 1d);
for (int bar = 2; bar bar = 0.5 * (1 - alpha) * (ds bar - ds bar - 2 )
+ beta * (1 + alpha) * res bar - 1 - alpha * res bar - 2 ;
}
return res;
}
protected override void Execute()
{
int per = _period.ValueInt;
double delta = _delta.Value;
double fraction [...]
[...] strategy
public class Donor : WealthScript
{
protected override void Execute()
{
for(int bar = 21; bar bar bar-20 )
SellAtMarket( bar+1, LastPosition );
}
else
{
if ( Close bar > Close bar-20 )
if( BuyAtMarket( bar+1 ) != null )
LastPosition.Priority = Close bar ;
}
}
}
}
}
Let's [...]