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.
[...] variable was 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 * [...]
Syntax Community Indicators:
public SwingHiLo( Bars bars, int LeftBars, double LeftReversalAmount, int RightBars, double RightReversalAmount, double EqualPriceThreshold, bool PercentMode, bool SetLeftSwings, bool SetOuterSwings, bool SetSteppedSeries, string description )
public SwingHiLo( Bars bars, int LeftBars, int RightBars, double EqualPriceThreshold, bool SetLeftSwings, bool SetOuterSwings, bool SetSteppedSeries, string description )
public static SwingHiLo( Bars bars, [...]
[...] (max-width: 767px) {.tg {width: auto !important;}.tg col {width: auto !important;}.tg-wrap {overflow-x: auto;-webkit-overflow-scrolling: touch;}} Index (6.1) Field Name Return Type Description of field 0 F string The character F, indicating a fundamental data message 1 Symbol string The Symbol ID to match with watch request 2 Exchange ID int This is the Exchange Group ID. Converted from hex to decimal - use the Listed Markets lookup to decode this value. 3 PE double Price/Earnings ratio 4 [...]
[...] new DataSeries(Bars, "Filt");
DataSeries DominantCycle = new DataSeries(Bars, "DominantCycle"); double Deg2Rad = Math.PI / 180.0;
double cosInDegrees = Math.Cos((.707 * 360 / 48d) * Deg2Rad);
double sinInDegrees = Math.Sin((.707 * 360 / 48d) * Deg2Rad);
double alpha1 = (cosInDegrees + sinInDegrees - 1) / cosInDegrees;
double a1 = Math.Exp(-1.414 * Math.PI / 8.0);
double b1 = 2.0 * a1 * Math.Cos((1.414 * 180d [...]
[...]
/// Camarilla Point calculation
///
public class Camarilla
{
#region Properties
private double _r1; public double R1
{
get { return _r1;}
set { _r1 = value;}
}
private double _r2; public double R2
{
get { return _r2;}
set { _r2 = value;}
}
private double _r3; public double R3
{
get { return _r3;}
set { _r3 = value;}
}
private double _r4; [...]
Syntax
public static double Correlation(this double ">"> x, double[ y, int n) public double Correlation(double ">"> x, double[ y, int n) Parameter Description x Array of double values (first data series) y Array of double values (second data series) n Correlation lookback [...]
Syntax
public enum CalcEx.CallPutFlag { Call, Put };
public static double BlackScholes(this double S, double X, double D, double R, double V, CallPutFlag flag) public enum CallPutFlag { Call, Put };
public static double BlackScholes(CallPutFlag flag, double S, double X, double [...]
Syntax public static Position BuyAtStopLimit(this WealthScript ws, int bar, double price)
public static Position BuyAtStopLimit(this WealthScript ws, int bar, double price, string signalName)
public static Position ShortAtStopLimit(this WealthScript ws, int bar, double price)
public static Position ShortAtStopLimit(this WealthScript ws, int bar, double price, string signalName)
public static bool SellAtStopLimit(this WealthScript ws, int bar, Position p, double [...]
[...] 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 way1 = (Open bar > Close bar & Open bar+1 bar+1 ) && isInsideBody(bar, Open bar+1 ) && Close bar+1 > Open bar ;
bool way2 = (Open bar bar & Open bar+1 bar+1 ) && isInsideBody(bar, Open bar+1 ) && Close bar+1 > Close bar ;
bool way3 = (Open bar-1 > Close bar-1 ) && (Open bar bar ) && isInsideBody(bar, [...]
RSI — 1.5%
[...] periods. RSI also often forms chart patterns which may not show on the underlying price chart, such as double tops and bottoms and trendlines. Also look for support or resistance on the RSI. If underlying prices make a new high or low that isn't confirmed by the RSI this divergence can signal a price reversal. RSI divergences from price indicates very strong buy or sell signal. Swing Failures. If the RSI makes a lower high followed buy a downside move below a previous low, then a Top Swing Failure has occurred. If the RSI makes a higher low followed buy a upside move above [...]
[...] WealthLab.Strategies
{
public class TAC_DMI_Strategy : WealthScript
{
#region Convergence functions
double Average(List lst)
{
double total = 0.0;
double average = 0.0;
int period = lst.Count;
if( period > 0 )
{
for (int x [...]
[...] 1);
paramPeriod = CreateParameter("MA Period", 8, 2, 20, 1);
}
protected override void Execute()
{
double rpu = paramRPU.Value;
int period = paramPeriod.ValueInt;
TRenko renko = new TRenko(Bars, rpu);
DataSeries dsOpen = new DataSeries(Bars,"R-Open"), dsHigh = new DataSeries(Bars,"R-High"),
dsLow = new DataSeries(Bars,"R-Low"), dsClose = new DataSeries(Bars,"R-Close");
DataSeries haOpen = new DataSeries(Bars,"HA-Open"), haHigh = new DataSeries(Bars,"HA-High"),
haLow = new DataSeries(Bars,"HA-Low"), haClose = new DataSeries(Bars,"HA-Close");
for(int [...]
[...] satisified and then save the "strategy" which can in future be reopened to modify any of these indicators by double clicking. On the other hand, creating a code-based strategy will work just fine for this task.
Is it possible to import custom indicator data calculated outside Wealth-Lab? Of course. There are two options: The most convenient way is to use FillSeriesFromFile method from Community Components library Create an ASCII DataSet of the indicator directory, and access it as if it were a secondary symbol
Rotation strategies A Rotation strategy isn't working like [...]
[...] class MyStrategy : WealthScript
{
public class ArrayHolder
{ // current, old, older
internal double I, I2, I3;
internal double Q, Q2, Q3;
internal double R, R2, R3;
internal double Im, Im2, Im3;
internal double A;
internal double dB;
}
public DataSeries CycleFilterDC(DataSeries ds, out DataSeries sine, out DataSeries cosine)
{
double twoPi = 2 * Math.PI;
// [...]
[...] DataSeries PlotPeakDivergence(this WealthScript obj, int proximity, ChartPane cp1, DataSeries ds1, double rev1, ChartPane cp2, DataSeries ds2, double rev2)
public static DataSeries PlotTroughDivergence(this WealthScript obj, int proximity, ChartPane cp1, DataSeries ds1, double rev1, ChartPane cp2, DataSeries ds2, double rev2) public DataSeries PlotPeakDivergence(int proximity, ChartPane cp1, DataSeries ds1, double rev1, ChartPane cp2, DataSeries ds2, [...]
Syntax
public static bool AlmostEquals(this double double1, double double2, double precision) public static bool AlmostEquals(double double1, double double2, double precision)
Parameter Description double1 First double value double2 Second double value precision Desirable precision when comparing Description
Sometimes there's a need to compare two [...]
[...] paramFlagHeight;
private StrategyParameter paramProfitTarget; void DrawRectangle(int b1, int b2, double p1, double p2, Color c)
{
double[] rect = { b1, p1, b1, p2, b2, p2, b2, p1 };
DrawPolygon( PricePane, Color.Blue, c, LineStyle.Solid, 1, true, rect );
}
public Katsanos201412()
{
paramPoleTimeout = CreateParameter("Pole Timeout", 23, 10, 50, 1);
paramPoleHeight = CreateParameter("Pole Height", 5.5, 1.0, 10, 0.5);
paramUptrendBeforePole = CreateParameter("Uptrend Before Pole", 70, [...]
[...] namespace WealthLab.Strategies
{
public class Signature
{
public int Bar;
public string Sig;
public double ROC;
public Signature( int Bar, string Sig, double ROC ){ this.Bar = Bar; this.Sig = Sig; this.ROC = ROC;}
}
public class TASC201502 : WealthScript
{
private StrategyParameter paramTop;
private StrategyParameter paramRoc;
public TASC201502()
{
paramTop = CreateParameter("Top N",10,1,10,1);
paramRoc = CreateParameter("ROC period",1,1,10,1);
}
protected override void Execute()
{
int roc = paramRoc.ValueInt;
const [...]
[...] void Execute()
{
int EF = paramEF.ValueInt;
int DE = paramDE.ValueInt; int Ratio=EF/DE;
double Inverseratio = 1d/Ratio;
double [...]
[...] CreateParameter("Stop Loss %",5.0,1.0,20.0,1.0);
}
protected override void Execute()
{
double percent = paramPercent.Value, target = paramPT.Value, stop = paramSL.Value;
const string t = "\t";
ZZBuilder zz = new ZZBuilder( Bars, percent );
List lst = zz.ZigZags;
for(int bar = 1; bar 0 ) {
int idx = 0;
foreach( ZigZag z in lst ) {
if( z.barDetected == bar ) {
if( z.wave == Wave.W2 ) {
SetBackgroundColor( bar, !z.isMoveUp ? Color.FromArgb(30,Color.Green) : Color.FromArgb(30,Color.Red) );
Position [...]
[...] Syntax
public static MTop CheckTop(this WealthScript obj, int bar, DataSeries ds, int lookback, double pctRetrace, double threshold)
public static WBottom CheckBottom(this WealthScript obj, int bar, DataSeries ds, int lookback, double pctRetrace, double threshold) public MTop CheckTop(int bar, DataSeries ds, int lookback, double pctRetrace, double threshold)
public WBottom CheckBottom(int bar, DataSeries ds, int lookback, [...]
[...] a IMenuAdder interface (the "adder" variable). You can call adder.AddMenuItem to add a menu to WL6.x: public override void AddMenuItems(IMenuItemAdder adder)
{
adder.AddMenuItem("Mini App", "&Tools", "Index-Lab ®",
new ClickMenuItem(Your_MenuItem_Click_Handler_method), Properties.Resources.some_icon);
} Don't forget to add an icon (logo) for your addin. Finally, in "Your_MenuItem_Click_Handler_method" you do what's required to show the dialog (entirely up to you). Complete example:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using [...]
[...] approximation, and another being precise, but requires intraday data. LimitPriorityLong Syntax public static double LimitPriorityLong(this WealthScript ws, double p, int bar) public double LimitPriorityLong(double p, int bar)
Parameter Description p Limit price bar Signal bar This function, created by Andrew Vishnyakov ( avishn ), helps to estimate which limit orders will realistically be hit first - without dropping to the intraday data level. According to its author, it gives [...]
[...] Performance Visualizer Code
Please log in to the Wiki to see Strategy code.
/* MEGAN */ double StartingCapital = performance.PositionSize.StartingCapital;
double EndingCapital = StartingCapital + results.NetProfit;
int Trades = results.Positions.Count; // Geometric mean
double geom = Math.Pow( ( EndingCapital / StartingCapital ), 1.0d / Trades ); // Geometric mean percentage
double geomp = 100 * (geom - 1.0); // Maximum number of trades per year [...]
[...] here's how to determine the equity curve value at the beginning of a month using ConvertDateToBar: double MonthStartEquity = EquityCurve 0 ;
DateTime b = bars.Date bar ;
DateTime tmp = new DateTime(b.Year, b.Month, 1);
MonthStartEquity = EquityCurve EquityCurve.ConvertDateToBar(tmp, false) ;
The SystemResults object contains data that results from a Wealth-Lab backtest. It contains a list of the individual Positions (trades) that were generated by the backtest, various equity curves, and some core performance statistics. public int TradesNSF This property [...]
[...] StrategyParameter 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, 30, 2);
paramHi = CreateParameter("Highest period", 20, 10, 100, 10);
paramProximity = CreateParameter("Within SMA %", 2, 1, 5, 1);
paramPullback = CreateParameter("Pullback %", 2, [...]
[...] if this information is provided by the streaming data provider. public void UpdateMiniBar(Quote q, double open, double high, double low) Call this method if your data provider returns partial "bars" of data instead of tick updates. This is a strategy that can be used to collect a number of tick updates and deliver them all at once, conserving bandwidth and processing. As above, create and populate a Quote object, but also return the values that correspond to the open, high, and low values of the partial bar [...]
[...] CreateParameter("Fraction", 0.25, 0.1, 1, 0.05);
} public DataSeries BandPassSeries(DataSeries ds, int period, double delta)
{
DataSeries res = new DataSeries(ds, "BandPassSeries(" + ds.Description + "," + period + "," + delta + ")");
double beta = Math.Cos(2 * Math.PI / period);
double gamma = 1/ Math.Cos(4 * 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 [...]
Syntax public Parabolic(Bars bars, double accelUp, double accelDown, double accelMax, string description)
public static Parabolic Series(Bars bars, double accelUp, double accelDown, double accelMax)
Parameter Description
bars
The Bars object
accelUp
Acceleration during up moves
accelDown
Acceleration during down moves
accelMax
Maximum acceleration
Description [...]
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 [...]