When I activate the strategy, it is deactivated within seconds.
Can someone help me?
public class HeikhinAshiLong : Strategy
{
private double HAOpen;
private double HAClose;
private double VHAOpen;
private double VHAClose;
private double HAHigh;
private double HALow;
************************************************
protected override void OnBarUpdate()
{
HAOpen = (Open[1] + Close[1])/2;
HAClose = (Open[0] + Close[0] + High[0] + Low[0])/4;
HAHigh = Math.Max(Highs[0][0], HAOpen);
HAHigh = Math.Max(HAHigh, HAClose);
HALow = Math.Min(Lows[0][0], HAOpen);
HALow = Math.Min(HALow, HAClose);
VHAOpen = (Open[2] + Close[2])/2;
VHAClose = (Open[1] + Close[1] + High[1] + Low[1])/4;
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 1)
return;
// set 1
if ((HAClose > HAOpen)
&& (VHAClose < VHAOpen))
{
EnterLong(1, @"PosEröffnen");
EnterShortStopMarket(1, 120, @"StoppOrder");
Draw.Ray(this, @"HekhinAshi240Long Gerade_1", false, 0, 0, 0, 0, Brushes.CornflowerBlue, DashStyleHelper.Solid, 2);
}
// set 2
if ((VHAClose > VHAOpen)
&& (HAClose < HAOpen))
{
EnterShort(1, @"Order schliessen");
}
Comment