override protected void StrategyExecute() { Indicators.StochF stoch = Indicators.StochF.Series(data.Bars, parameters[0], parameters[1], ""); DataSeries line1 = stoch.FastKSeries; DataSeries line2 = stoch.FastDSeries; AppTypes.MarketTrend lastTrend = AppTypes.MarketTrend.Unspecified; AppTypes.MarketTrend currentTrend = AppTypes.MarketTrend.Unspecified; for (int idx = 0; idx < line1.Count; idx++) { currentTrend = ((line1[idx] > line2[idx]) ? AppTypes.MarketTrend.Upward : AppTypes.MarketTrend.Downward); if (lastTrend == AppTypes.MarketTrend.Downward && currentTrend == AppTypes.MarketTrend.Upward) { BuyAtClose(idx); } if (lastTrend == AppTypes.MarketTrend.Upward && currentTrend == AppTypes.MarketTrend.Downward) { SellAtClose(idx); } lastTrend = currentTrend; } }
public StockFastRule(DataBars db, double _fastK, double _fastD, string _name) { stoch = Indicators.StochF.Series(db, _fastK, _fastD, _name); fastK = stoch.FastKSeries; fastD = stoch.FastDSeries; }
public StockFastRule(DataBars db,Parameters parameters) { stoch = Indicators.StochF.Series(db, parameters[0], parameters[1], ""); line1 = stoch.FastKSeries; line2 = stoch.FastDSeries; }
public StockFastRule(DataBars db, Parameters parameters) { stoch = Indicators.StochF.Series(db, parameters[0], parameters[1], ""); line1 = stoch.FastKSeries; line2 = stoch.FastDSeries; }
public StockFastRule(DataBars db,double _fastK,double _fastD,string _name) { stoch = Indicators.StochF.Series(db, _fastK,_fastD,_name); fastK = stoch.FastKSeries; fastD = stoch.FastDSeries; }