HOME FORUMS BROKERS SOFTWARE BOOKS CONTACT US
Elite Trader Your Account  •  Become a Member  •  Help  •  Search    
    Forums ›› Technically Speaking ›› Technical Analysis ›› Quotetracker and Ninjatrader  


Post A Reply
    
CDNpatriot1
 

Registered: Oct 2008
Posts: 40

 

08-13-12 04:11 AM

I'm having difficulties with MACD and Stochastic indicators to match on Quotetracker and Ninjatrader.





How can I change the settings so they are right. And which one right? It's based on a 30 minute chart, MACD 5,13,6 and Stochastics 14,1,3.

PS click on the second image to see the full size chart.

    Edit/Delete Quote Complain
oraclewizard77
Moderator

Registered: Jan 2006
Posts: 2290

 

08-13-12 05:39 AM

Both are useless so it really does not matter.

    Edit/Delete Quote Complain
thunderbolttr
 

Registered: Aug 2010
Posts: 156

 

08-13-12 01:03 PM


Quote from CDNpatriot1:

I'm having difficulties with MACD and Stochastic indicators to match on Quotetracker and Ninjatrader.

How can I change the settings so they are right. And which one right? It's based on a 30 minute chart, MACD 5,13,6 and Stochastics 14,1,3.

PS click on the second image to see the full size chart.



For the Stochastics I think you don't have the periods set consistently since the software labels them in a different sequence. For 14,1,3 in Quotetracker it should probably say 3,14,1 in NinjaTrader.

For the MACD you might need to change the way it is calculated in QuoteTracker to get it consistent - e.g. try calculating it based on (H+L+C)/3 instead of just using the Close.

Another issue is that you have 2 after-hours data bars displaying in NinjaTrader whereas Quotetracker is just showing 1 after-hours bar. Maybe first try to get the indicators to line up only using regular market hours data.

    Edit/Delete Quote Complain
CDNpatriot1
 

Registered: Oct 2008
Posts: 40

 

08-14-12 01:36 AM

Thunderblotter you have been a great help! I tried the market hours suggestion and the Stochastic sequence change and although it's not exactly the same it looks much more similar. Trying to figure out how the MACD formula is calculated and see if it's the same as my next step.

I think NT has the same formula that stockchart uses:

//
// Copyright (C) 2006, NinjaTrader LLC <www.ninjatrader.com>.
// NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
//

#region Using declarations
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.ComponentModel;
using System.Xml.Serialization;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
///


/// The MACD (Moving Average Convergence/Divergence) is a trend following momentum indicator that shows the relationship between two moving averages of prices.
///

[Description("The MACD (Moving Average Convergence/Divergence) is a trend following momentum indicator that shows the relationship between two moving averages of prices.")]
public class MACD : Indicator
{
#region Variables
private int fast = 12;
private int slow = 26;
private int smooth = 9;
private DataSeries fastEma;
private DataSeries slowEma;
#endregion

///
/// This method is used to configure the indicator and is called once before any bar data is loaded.
///

protected override void Initialize()
{
Add(new Plot(Color.Green, "Macd"));
Add(new Plot(Color.DarkViolet, "Avg"));
Add(new Plot(new Pen(Color.Navy, 2), PlotStyle.Bar, "Diff"));

Add(new Line(Color.DarkGray, 0, "Zero line"));

fastEma = new DataSeries(this);
slowEma = new DataSeries(this);
}

///
/// Calculates the indicator value(s) at the current index.
///

protected override void OnBarUpdate()
{
if (CurrentBar == 0)
{
fastEma.Set(Input[0]);
slowEma.Set(Input[0]);
Value.Set(0);
Avg.Set(0);
Diff.Set(0);
}
else
{
fastEma.Set((2.0 / (1 + Fast)) * Input[0] + (1 - (2.0 / (1 + Fast))) * fastEma[1]);
slowEma.Set((2.0 / (1 + Slow)) * Input[0] + (1 - (2.0 / (1 + Slow))) * slowEma[1]);

double macd = fastEma[0] - slowEma[0];
double macdAvg = (2.0 / (1 + Smooth)) * macd + (1 - (2.0 / (1 + Smooth))) * Avg[1];

Value.Set(macd);
Avg.Set(macdAvg);
Diff.Set(macd - macdAvg);
}
}

#region Properties
///
///

[Browsable(false)]
[XmlIgnore()]
public DataSeries Avg
{
get { return Values[1]; }
}

///
///

[Browsable(false)]
[XmlIgnore()]
public DataSeries Default
{
get { return Values[0]; }
}

///
///

[Browsable(false)]
[XmlIgnore()]
public DataSeries Diff
{
get { return Values[2]; }
}

///
///

[Description("Number of bars for fast EMA")]
[GridCategory("Parameters")]
public int Fast
{
get { return fast; }
set { fast = Math.Max(1, value); }
}

///
///

[Description("Number of bars for slow EMA")]
[GridCategory("Parameters")]
public int Slow
{
get { return slow; }
set { slow = Math.Max(1, value); }
}

///
///

[Description("Number of bars for smoothing")]
[GridCategory("Parameters")]
public int Smooth
{
get { return smooth; }
set { smooth = Math.Max(1, value); }
}
#endregion
}
}

#region NinjaScript generated code. Neither change nor remove.
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
public partial class Indicator : IndicatorBase
{
private MACD[] cacheMACD = null;

private static MACD checkMACD = new MACD();

///
/// The MACD (Moving Average Convergence/Divergence) is a trend following momentum indicator that shows the relationship between two moving averages of prices.
///

///
public MACD MACD(int fast, int slow, int smooth)
{
return MACD(Input, fast, slow, smooth);
}

///
/// The MACD (Moving Average Convergence/Divergence) is a trend following momentum indicator that shows the relationship between two moving averages of prices.
///

///
public MACD MACD(Data.IDataSeries input, int fast, int slow, int smooth)
{
if (cacheMACD != null)
for (int idx = 0; idx < cacheMACD.Length; idx++)
if (cacheMACD[idx].Fast == fast && cacheMACD[idx].Slow == slow && cacheMACD[idx].Smooth == smooth && cacheMACD[idx].EqualsInput(input))
return cacheMACD[idx];

lock (checkMACD)
{
checkMACD.Fast = fast;
fast = checkMACD.Fast;
checkMACD.Slow = slow;
slow = checkMACD.Slow;
checkMACD.Smooth = smooth;
smooth = checkMACD.Smooth;

if (cacheMACD != null)
for (int idx = 0; idx < cacheMACD.Length; idx++)
if (cacheMACD[idx].Fast == fast && cacheMACD[idx].Slow == slow && cacheMACD[idx].Smooth == smooth && cacheMACD[idx].EqualsInput(input))
return cacheMACD[idx];

MACD indicator = new MACD();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
indicator.Input = input;
indicator.Fast = fast;
indicator.Slow = slow;
indicator.Smooth = smooth;
Indicators.Add(indicator);
indicator.SetUp();

MACD[] tmp = new MACD[cacheMACD == null ? 1 : cacheMACD.Length + 1];
if (cacheMACD != null)
cacheMACD.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheMACD = tmp;
return indicator;
}
}
}
}

// This namespace holds all market analyzer column definitions and is required. Do not change it.
namespace NinjaTrader.MarketAnalyzer
{
public partial class Column : ColumnBase
{
///
/// The MACD (Moving Average Convergence/Divergence) is a trend following momentum indicator that shows the relationship between two moving averages of prices.
///

///
[Gui.Design.WizardCondition("Indicator")]
public Indicator.MACD MACD(int fast, int slow, int smooth)
{
return _indicator.MACD(Input, fast, slow, smooth);
}

///
/// The MACD (Moving Average Convergence/Divergence) is a trend following momentum indicator that shows the relationship between two moving averages of prices.
///

///
public Indicator.MACD MACD(Data.IDataSeries input, int fast, int slow, int smooth)
{
return _indicator.MACD(input, fast, slow, smooth);
}
}
}

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
///
/// The MACD (Moving Average Convergence/Divergence) is a trend following momentum indicator that shows the relationship between two moving averages of prices.
///

///
[Gui.Design.WizardCondition("Indicator")]
public Indicator.MACD MACD(int fast, int slow, int smooth)
{
return _indicator.MACD(Input, fast, slow, smooth);
}

///
/// The MACD (Moving Average Convergence/Divergence) is a trend following momentum indicator that shows the relationship between two moving averages of prices.
///

///
public Indicator.MACD MACD(Data.IDataSeries input, int fast, int slow, int smooth)
{
if (InInitialize && input == null)
throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");

return _indicator.MACD(input, fast, slow, smooth);
}
}
}
#endregion

    Edit/Delete Quote Complain
    
Post A Reply


Receive an email whenever a new post is added to this thread by subscribing to it.
 
Rate This Thread:

Forum Jump:
 

 

   Conduct Rules  -  Privacy Policy  -  Day Trader -  Day Trader Forum -  Best Trading Software -  Sitemap Copyright © 2013, Elite Trader. All rights reserved.    
 
WHILE YOU'RE HERE, TAKE A MINUTE TO VISIT SOME OF OUR SPONSORS:
Advantage Futures
Futures Brokerage & Clearing
AMP Global Clearing
Futures and FX Trading
Bright Trading
Professional Equities Trading
CTS
Futures Trading Software
DaytradingBias.com
Professional Trading Analytics
ECHOtrade
Professional Trading Firm
eSignal
Trading Software Provider
FXCM
Forex Trading Services
Global Futures
Futures, Options & FX Trading
Interactive Brokers
Pro Gateway to World Markets
JC Trading Group
Direct Access Trading
MB Trading
Direct Access Trading
MultiCharts
Trading Software Provider
NinjaTrader
Trading Software Provider
OANDA
Currency Trading
optionshouse
Option Trading & Education
Rithmic
Futures Trade Execution Platform
SpeedTrader
Direct Access Trading
SpreadProfessor
Spread Trading Instruction
thinkorswim by TD Ameritrade
Direct Access TradingAdvertisement
TradersStudio
System Building & Backtesting
Trading Technologies
Trading Software Provider
Trend Following
Trading Systems Provider