|
detroit,mi
Experience: Intermediate
Platform: NT
Broker: NT
Trading: ES
Frequency: Every few months
Duration: Hours
Posts: 417 since Sep 2011
Thanks Given: 1,709
Thanks Received: 473
|
It for may be i copied the wrong lines from the script.
///<summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
///</summary>
protectedoverridevoid Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Blue), PlotStyle.Line, "TrendPlot"));
Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "TriggerPlot"));
trend = new DataSeries(this);
trigger = new DataSeries(this);
smooth = new DataSeries(this);
CalculateOnBarClose = true;
Overlay = false;
PriceTypeSupported = false;
}
///<summary>
/// Called on each bar update event (incoming tick)
///</summary>
protectedoverridevoid OnBarUpdate()
{
if (CurrentBar==0)
{
smooth.Set(0);
trigger.Set(0);
trend.Set(0);
TrendPlot.Set(0);
TriggerPlot.Set(0);
return;
}
int Per1=PeriodsP;
int Per2=PeriodsP;
if(CurrentBar <= 7)
return;
double SmoothTemp = (Median[0] + 2* Median[1] + 2* Median[2] + Median[3])/6;
smooth.Set(SmoothTemp);
double ItrendTemp = (alpha - alpha*alpha/4)* smooth[0]+0.5*alpha*alpha*smooth[1]-(alpha-0.75*alpha*alpha)*smooth[2]+2*(1-alpha)*trend[1]-(1-alpha)*(1-alpha)*trend[2];
//double ItrendTemp = (1 - .5 * alpha)* (1 - .5*alpha)*(smooth[0] - 2*smooth[1] + smooth[2]) + 2*(1 - alpha)* trend[1] - (1 - alpha)*(1 - alpha)*trend[2];
trend.Set(ItrendTemp);
trigger.Set(trend[1]);
TrendPlot.Set(trend[0]);
TriggerPlot.Set(trigger[0]);
Thank you,
Sudhir
|