We have a problem with one of our ATS.
The strategy works with Range chart and with an indicator that shows a superior HTF called "General Trend".
The operation is that when the closing price is higher or lower than the plot "STrend" opens an operation in that direction if it coincides with the "General Trend" indicator.
The "STrend" indicator is a trend modification based on an ATR. In the attached document you can visually see the operation of the ATS. The "General Trend" indicator is the "STrend" indicator on a higher HTF.
Once we understand the operation of the strategy we detail the problem:
- We have observed some great differences in the painting of the "General Trend" indicator between License Lease and License Demo. Within the License Lease, the tests performed in historical data have a small deviation in Real - Time.
We attach a document called "Error in MTF - Visual Example" to understand exactly the problem.
We need your help to be able to turn this ATS enable, because in License Lease all the tests performed are very good, but we are concerned about the great differences with other PCs and License Demo.
We look forward to your response and help.
Thanks and regards
-------------------------------------
CODE "STREND"
-------------------------------------
protected override void Initialize()
{
Add(new Plot(Color.Blue, "trail"));
CalculateOnBarClose = true;
Overlay = true;
BarsRequired = 1;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (CurrentBar < 1)
return;
// Trailing stop
double trail;
double loss = ATR(Input, Period)[0] * Multi;
if (Close[0] > Value[1] && Close[1] > Value[1])
{
trail = Math.Max(Value[1], Close[0] - loss);
PlotColors [0][0] = Color.Blue;
BarColor = Color.Blue;
}
else if (Close[0] < Value[1] && Close[1] < Value[1])
{
trail = Math.Min(Value[1], Close[0] + loss);
PlotColors [0][0] = Color.Red;
BarColor = Color.Red;
}
else if (Close[0] > Value[1])
{
trail = Close[0] - loss;
BarColor = Color.Blue;
PlotColors [0][0] = Color.Blue;
DrawArrowUp("Largo" + CurrentBar, false, 0, Low[0] - 4 * TickSize, Color.Blue);
}
else
{
trail = Close[0] + loss;
PlotColors [0][0] = Color.Red;
BarColor = Color.Red;
DrawArrowDown("Corto" + CurrentBar, false, 0, High[0] + 4 * TickSize, Color.Red);
}
Value.Set(trail);
}
--------------------------------
CODE GENERALTREND
----------------------------------
Add(PeriodType.Minute, secondaryPeriod);
// Add(PeriodType.Custom5, renkoperiod);
Add(new Plot(Color.FromKnownColor(KnownColor.Crimson), PlotStyle.Line, "Corto"));
Add(new Plot(Color.FromKnownColor(KnownColor.MediumSeaGree n), PlotStyle.Line, "Largo"));
Overlay = false;
// Corto = new DataSeries(this);
// Largo = new DataSeries(this);
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (CurrentBars[1] < BarsRequired || CurrentBars[0] < BarsRequired)return;
if (BarsInProgress == 0)
{
if (Closes[1][0] > STrend(BarsArray [1], sensibilidad, 1)[0])
{
Largo.Set(1);
Print(Largo[0]);
Print("VERDE : " + CurrentBar);
BackColor = Color.MediumSeaGreen;
}
if (Closes[1][0] < STrend(BarsArray [1], sensibilidad, 1)[0])
{
Corto.Set(0);
Print(Corto[0]);
Print("ROJO : " + CurrentBar);
BackColor = Color.Crimson;
}
}
}

Comment