I think there is no easy way to do this in NinjaTrader. One option would be
- create a chart with 2 data series for stock A and stock B
- then apply a spread indicator to the chart
You would then have a chart with three sections, stock A, stock B and the spread. Spread indicators can be found in the download section of this forum or the NinjaTrader forum.
By the way, the simple difference of two stocks, such as A-B, does not make any sense. You would want to balance the stocks in line with their Beta, if you take any difference. It would be much easier to work with a simple ratio spread, as this already compares the logarithm of price.
Ratio spread indicator can also be found in the download sections.
The following 3 users say Thank You to Fat Tails for this post:
I got the "spread" indicator to plot the diff, but I'd like to apply haiki ashi to it.
Sadly, "spread" being an indicator itself, I cant apply another indicator to it...
can anyone offer a suggestion on how to get it done?
I was told it IS possible to apply an oscillator to "spread".. sounds like that's applying an indicator to indicator..
The spread indicator uses a particular synchronisation method, which makes it vulnerable of being called by other indicators, so do not expect the usual behaviour. You cannot apply the default Heikin Ashi indicator.
However, there is modified HeikinAshi indicator here
Exported using NT 7.0.1000.22
Modified Heikin Ashi Bars:
- Option to select between the original Heikin-Ashi bars created by Dan Valcu and the modified Heikin-Ashi bars suggested by Sylvain Vervoort.
- The Heikin-Ashi candles can be smoothed …
which can be applied to the spread indicator. Select spread with appropriate settings as input series, select a separate panel and set "UseOnMainPanel" to false. You will get a result as shown on the chart below (spread of WTI over Brent).
Do not touch the chart anymore, if you change any settings, it might quickly dissipate.
The following user says Thank You to Fat Tails for this post:
Here is a link to Ninjatrader support forums where they are discussing ability to have excel exchange data with NT, so excel will take the two live quotes, perform the calculation and send it back to NT in a form of a symbol.
And here they are using "BigMike Excel" plug in to get this done
Then we can add the custom symbol to NT and BAM! we have the spread calculation thats a symbol and can accept indicators, etc...
@Alex91320: I think that this approach is too complex and will not solve the synchronisation issue.
There is a Pairs Suite on the NinjaTrader forum, which has a few bugs (throws exceptions), but it can be used for your purpose with minor modifications.
Let me come back with a solution.
The following user says Thank You to Fat Tails for this post:
a variety from the list below:
1. Haiki Ashi doesn't plot
2. main (1st panel) plot of ES disappears
3. The "pairs" plot disappears
4. Fisher transform doesn't plot
5. Chart becomes a big red X
I'm relatively new to NT, so its quite possible/likely that some of these are caused by "operator" error.
In the end, what I'm trying to achieve is:
ES on panel1
spread of 2 instruments (neither is ES) on panel 2
The spread (panel2) is plotted in HA
Fisher transform is applied to the spread
Using Heikin Ashi candles for a spread is a weird idea, because of technical limitations.
If you open a 15 min chart and you load the synchronized data for two instruments on this chart to calculate the spread, you can only calculate spread values for the open and the close. The intrabar high and low of the spread cannot be determined, as the high and low of the two bar series are - unlike open and close - not synchronized.
So you cannot create a candle to represent the spread, unlike you rely on intrabar data. For example I could use a 1 min bar series of both instruments to calculate the highest and lowest difference of the closes over a 15 min period and then chart it as the high and low of a 15 min candle. But this is a more compex task than to calculate a simple spread.
As we do not get any highs and lows, we can neither chart the spread as conventional candles nor as Heikin Ashin candles. If you want to extract the trend from the spread, here is a suggestion:
Chart the ratio or the spread on a separate panel. Then apply bollinger bands to the spread and play a little bit with the settings. The chart below shows the Universal Bollinger Indicator applied to the YM 03-12 / ES 03-12 ratio.
You will notice that the Bollinger Bands can produce conforming or conflicting trend signals. Have not yet finished the spread and ratio indicators, but you can take any of those to play around.
@Fatails
There is a new addition to the NT7 indicator section, its called "spread candlesticks".
It plots SPread with candlesticks Author mentioned something about removing synch code to accommodate the OHLC values that are required for candles/haiken.
I'm interested in using this new indicator as soon as I can figure out how to leave out the main data series and plot the spread of two alternative instruments.
Question is, how will exclusion of the synch code in this version of Spread to accommodate the OHLC values affect the output value/ output integrity (could it produce dud reading when it couldnt sync)?
Using original Spread3 as input for another indicator (fisher transform) gives me problems when I try to access diff TFs in MarketAnalyzer couple other indicators that access non-defult TF dataseries.
Any other more stable alternatives to get spread calculations for use as input?
Not sure, whether that indicator works correctly, could you post it here? If you try to use candles for a spread, this basically requires intra-bar information, as you cannot calculate high and low of the spread from high and low of the data series that are used to calculate the spread.
I have not studied other spread indicators. NinjaTrader is not the best tool, if you want to trade spreads. If you just need a spread as an indicator, NinjaTrader should do.
I do not think that the formula used by the SpreadCandlesticks indicator is correct. The Pairs indicator also has a bug, as far as I know. There is still some work to be done on that subject.