// Cycle Counter Vars #endregion /// <summary> /// This method is used to configure the strategy and is called once before any strategy method is called. /// </summary> protected override void Initialize() { pitColor = PitColor(Color.Black, 80000, 25, 161500); Add(pitColor); stoc = Stochastics(stocD, stocK, stocS); Add(stoc); stoc.Plots[0].Pen.Color = Color.Blue; // D color stoc.Plots[1].Pen.Color = Color.Black; // K color stoc.Plots[0].Pen.Width = 2; // D color stoc.Plots[1].Pen.Width = 1; // K color stoc.Lines[0].Pen.Color = Color.Black; // Lower stoc.Lines[1].Pen.Color = Color.Black; // Upper stoc.Lines[0].Pen.DashStyle = DashStyle.Dot; // Lower stoc.Lines[1].Pen.DashStyle = DashStyle.Dot; // Upper stoc.Lines[0].Pen.Width = 2; // Lower stoc.Lines[1].Pen.Width = 2; // Upper stoc.Lines[0].Value = 20; // Lower stoc.Lines[1].Value = 80; // Upper constantLines = ConstantLines(45, 55, 0, 0); constantLines.Panel = 1; // specifying to use the first indicator's panel Add(constantLines); constantLines.Plots[0].Pen.Color = Color.Red; constantLines.Plots[1].Pen.Color = Color.Red; CalculateOnBarClose = true; }
/// <summary> /// This method is used to configure the strategy and is called once before any strategy method is called. /// </summary> protected override void Initialize() { pitColor = PitColor(Color.Black, 80000, 25, 161500); Add(pitColor); ema = EMA(EmaPeriod); Add(ema); ema.Plots[0].Pen.Color = Color.Gray; sma = SMARick(SmaPeriod); Add(sma); //sma.Plots[0].Pen.Color = Color.Red; stoc = Stochastics(stocD, stocK, stocS); Add(stoc); stoc.Plots[0].Pen.Color = Color.Blue; // D color stoc.Plots[1].Pen.Color = Color.Black; // K color stoc.Plots[0].Pen.Width = 2; // D color stoc.Plots[1].Pen.Width = 1; // K color stoc.Lines[0].Pen.Color = Color.Black; // Lower stoc.Lines[1].Pen.Color = Color.Black; // Upper stoc.Lines[0].Pen.DashStyle = DashStyle.Dot; // Lower stoc.Lines[1].Pen.DashStyle = DashStyle.Dot; // Upper stoc.Lines[0].Pen.Width = 2; // Lower stoc.Lines[1].Pen.Width = 2; // Upper stoc.Lines[0].Value = 20; // Lower stoc.Lines[1].Value = 80; // Upper constantLines = ConstantLines(45, 55, 0, 0); constantLines.Panel = 1; // specifying to use the first indicator's panel Add(constantLines); constantLines.Plots[0].Pen.Color = Color.Red; constantLines.Plots[1].Pen.Color = Color.Red; macd = MACD(macdFast, macdSlow, macdSmooth); Add(macd); macd.CalculateOnBarClose = true; macd.Plots[0].Pen.Color = Color.Black; // Macd macd.Plots[1].Pen.Color = Color.Blue; // Avg macd.Plots[2].Pen.Color = Color.Transparent; //downBar //macd.Plots[3].Pen.Color = Color.Transparent; // Diff macd.Plots[0].Pen.Width = 2; macd.Plots[1].Pen.Width = 3; macd.Plots[0].PlotStyle = PlotStyle.Bar; SetProfitTarget("", CalculationMode.Ticks, ProfitTarget); SetStopLoss("", CalculationMode.Ticks, StopLoss, false); SetTrailStop("", CalculationMode.Ticks, TrailingStop, false); CalculateOnBarClose = true; }