I wonder wheter it is possible to built a pretty complicated Ehlers indicator in TC2000? Last week i posted a newly developed Ehlers early trend detection indicator on futures.io, which was presented in the August 2014 issue of the TASC magazine.
Look at the picture so you can see the indicator in action: https://futures.io/local_links.php?action=ratelink&catid=27&linkid=1936
Here's the complete formula developed in Microsoft C-Sharp fpr Ninjatrader. Note that Input[0] is the current bar while Input[1] is one bar a go and so on...
private double alpha1;
private double a1;
private double b1;
private double c1;
private double c2;
private double c3;
private double x;
private double quotientFastLong;
private double quotientSlowLong;
private double quotientFastShort;
private double quotientSlowShort;
private double kFastLong = 0.40;
private double kSlowLong = 0.90;
private double kFastShort = -0.40;
private double kSlowShort = -0.90;
private Series<double> HP;
private Series<double> Filt;
private Series<double> Peak;
AddPlot(new Stroke(Brushes.LightGreen, 1), PlotStyle.Line, "QTFastLong");
AddPlot(new Stroke(Brushes.Green, 1), PlotStyle.Line, "QTSlowLong");
AddPlot(new Stroke(Brushes.IndianRed, 1), PlotStyle.Line, "QTFastShort");
AddPlot(new Stroke(Brushes.Red, 1), PlotStyle.Line, "QTSlowShort");
AddLine(Brushes.Yellow, 0.0, "Zero");
LPPeriod = 20;
alpha1 = ((Math.Cos(((.707 * 360 / 100) * Math.PI) / 180)) + (Math.Sin(((.707 * 360 / 100) * Math.PI) / 180)) - 1) / (Math.Cos(((.707 * 360 / 100) * Math.PI) / 180));
a1 = Math.Exp(-1.414 * 3.14159 / LPPeriod);
b1 = 2 * a1 * (Math.Cos(((1.414 * 180 / LPPeriod) * Math.PI) / 180));
c2 = b1;
c3 = (a1 * -1) * a1;
c1 = 1 - c2 - c3;
HP[0] = ((1 - alpha1 / 2) * (1 - alpha1 / 2) * (Input[0] - 2 * Input[1] + Input[2]) + 2 * (1 - alpha1) * HP[1] - (1 - alpha1) * (1 - alpha1) * HP[2]);
Filt[0] = (c1 * (HP[0] + HP[1]) / 2 + c2 * Filt[1] + c3 * Filt[2]);
Peak[0] = (Peak[1] * 0.991);
if (Math.Abs(Filt[0]) > Peak[0])
Peak[0] = (Math.Abs(Filt[0]));
if (Peak[0] < 0.0 || Peak[0] > 0.0)
x = (Filt[0] / Peak[0]);
quotientFastLong = (x + KFastLong) / (KFastLong * x + 1);
quotientSlowLong = (x + KSlowLong) / (KSlowLong * x + 1);
quotientFastShort = (x + KFastShort) / (KFastShort * x + 1);
quotientSlowShort = (x + KSlowShort) / (KSlowShort * x + 1);
QTFastLong[0] = (quotientFastLong);
QTSlowLong[0] = (quotientSlowLong);
QTFastShort[0] = (quotientFastShort);
QTSlowShort[0] = (quotientSlowShort);
|