Below my code.
private acVWAP vwap; private DataSeries myDataSeries; protected override void Initialize() { CalculateOnBarClose = false; myDataSeries = new DataSeries(this,MaximumBarsLookBack.Infinite); vwap = acVWAP(DateTime.MinValue, pStdDev); Add(vwap); } protected override void OnBarUpdate() { if(CurrentBar < 0) return; // Condition set 1 if(myDataSeries[0] >= vwap.Upper[0]) EnterShort(""); else if (myDataSeries[0] <= vwap.Lower[0]) EnterLong("Long entry"); }
Note: I didn't use the methods CrossAbove(myDataSeries, vwap.Upper, 1) and CrossBelow(myDataSeries, vwap.Lower, 1) because they seems to not work for me.
However, another issue is that myDataSeries[0] is always 0, so the only action taken is always "EnterLong".
Can someone explain me how to reach my goal, that is: enter short when crossAbove vwap.Upper and enter long when crossBelow vwap.Lower?
Regards
Stefano
Comment