//NinjaTrader.Indicator.PriceActionSwingOscillator so = null; #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() { //int dtbStrength = Iparm1; //int swingSize = Iparm2; //atrTimes = dparm1; //atrPeriod = period1; atr = ATRTrailing(atrTimes, AtrPeriod, Ratched); atr.PaintPriceMarkers = false; atr.AutoScale = false; Add(atr); ema = EMA(period1); Add(ema); hma = HMARick(period2, 100); Add(hma); // dc = DonchianChannel(Period1); // dc.Displacement = 1; // dc.PaintPriceMarkers = false; // Add(dc); Add(PitColor(Color.Blue, 80000, 15, 140000)); //SetProfitTarget(CalculationMode.Ticks, Iparm1); //SetStopLoss(CalculationMode.Ticks, Iparm2); //SetTrailStop(CalculationMode.Ticks, Iparm2); Unmanaged = false; BarsRequired = 10; CalculateOnBarClose = true; ExitOnClose = true; IncludeCommission = true; }
/// <summary> /// This method is used to configure the strategy and is called once before any strategy method is called. /// /// I was thinking that MOMO could have not atr ratched but use a stop place where the /// prior atr stop was, for example, if a short momo, use the lower blue level as the /// max high to trigger a sell. /// </summary> protected override void Initialize() { atrTimes = dparm1; atrPeriod = period1; //ratched = 0; atr = ATRTrailing(atrTimes, Period1, Ratched); Add(atr); kc = KeltnerChannel(offsetMultiplier, keltnerPeriod); Add(kc); dc = DonchianChannel(donchianPeriod); dc.Displacement = 2; dc.PaintPriceMarkers = false; Add(dc); SetProfitTarget("", CalculationMode.Percent, dparm2); SetStopLoss("", CalculationMode.Percent, dparm2, false); //SetTrailStop("", CalculationMode.Percent, dparm2, false); CalculateOnBarClose = true; ExitOnClose = false; IncludeCommission = true; }
/// <summary> /// This method is used to configure the strategy and is called once before any strategy method is called. /// /// E-Mini Scalper: Trying to simulate trade2live.com or eminiTradingStrategy.com autotrader /// /// Puts on positions on a pull back of a strong trend. /// /// Ref: /// http://trade2live.com/ /// http://scalpingemini.com/ /// /// </summary> protected override void Initialize() { // Secondary bar which will be used when entering trades // this will be the bar which contains the buy/sell orders Add("ES 03-15", PeriodType.Minute, 5); // Indicator Setup // --------------- hma = HMARick(Period1, 100); hma.PaintPriceMarkers = false; Add(hma); Add(PitColor(Color.Black, 83000, 25, 161500)); atr = ATR(Period2); Add(atr); atrTrailing = ATRTrailing(atrTimes, Period2, Ratched); //Add(atrTrailing); kc = KeltnerChannel(offsetMultiplier, Period3); //Add(kc); Add(FiveBarPattern()); // dc = DonchianChannel(donchianPeriod); // dc.Displacement = 2; // dc.PaintPriceMarkers = false; // Add(dc); Unmanaged = true; // Use unmanaged order methods // Methods BarsSinceEntry() and BarsSinceExit() are usuable in Unmanaged orders // Managed Properties // -------------------- //EntriesPerDirection = 2; //EntryHandling = EntryHandling.UniqueEntries; //SetProfitTarget("", CalculationMode.Percent, dparm2); //SetStopLoss("", CalculationMode.Percent, dparm2, false); //SetTrailStop("", CalculationMode.Percent, dparm2, false); //Slippage = 2; BarsRequired = 22; CalculateOnBarClose = true; // Onbar update happens only on the start of a new bar vrs each tick ExitOnClose = true; // Closes open positions at the end of the session IncludeCommission = true; // Commissions are used in the calculation of the profit/loss TraceOrders = false; // Trace orders in the output window, used for debugging, normally false }
/// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { atr = ATRTrailing(atrTimes, atrPeriod, atrRatched); hmaFast = HMA(hmaFastPeriod); hmaMed = HMA(hmaMedPeriod); hmaSlow = HMA(hmaSlowPeriod); //adx = ADXVMA(hmaFastPeriod); if (Bars.FirstBarOfSession) { lastTrade = NUTRAL; } if (Position.MarketPosition != MarketPosition.Flat) { //ManageTrade(); AtmStrategyHandler(); return; } //resetLastTrade(); //DrawDot(CurrentBar + "adx", false, 0, adx.ADXVMAPlot[0], Color.Black); if (Close[0] > Close[1] && Close[1] > Close[2] && Close[2] > Close[3] //&& lastTrade != LONG && Rising(hmaSlow) && (BarsSinceExit() > 4 || BarsSinceExit() == -1) // && Close[1] < adx.ADXVMAPlot[0] ) { //Print(Time + " - Slope: " + Slope(adx.ADXVMAPlot, 1, 0)); GoLong(); } else if (Close[0] < Close[1] && Close[1] < Close[2] && Close[2] < Close[3] //&& lastTrade != SHORT && Falling(hmaSlow) && (BarsSinceExit() > 4 || BarsSinceExit() == -1) // && Close[1] > adx.ADXVMAPlot[0] ) { GoShort(); } }
/// <summary> /// This method is used to configure the strategy and is called once before any strategy method is called. /// </summary> protected override void Initialize() { atr = ATRTrailing(ATRTimes, ATRPeriod, ATRRatched); bollinger = Bollinger(BStdX, BPeriod); keltnerChannel = KeltnerChannel(KStdX, KPeriod); sMomentum = SMA(Momentum(MPeriod), MSmooth); //Add(Stochastics(periodD, periodK, smooth)); Add(RCTTMSqueeze(1, 2, 2, 20)); Add(atr); //Add(bollinger); //Add(keltnerChannel); //Add(sMomentum); atr.AutoScale = false; atr.PaintPriceMarkers = false; 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() { int dtbStrength = Iparm1; int swingSize = Iparm2; atrTimes = dparm1; atrPeriod = period1; so = PriceActionSwingOscillator(dtbStrength, swingSize, SwingTypes.Standard); Add(so); atr = ATRTrailing(atrTimes, Period1, Ratched); //Add(atr); SetProfitTarget("", CalculationMode.Ticks, dparm1); SetStopLoss("", CalculationMode.Ticks, dparm2, false); //SetTrailStop("", CalculationMode.Percent, dparm2, false); CalculateOnBarClose = true; ExitOnClose = true; IncludeCommission = true; }