View Full Version : executing orders at 2 different instruments
joanNT
03-10-2010, 03:25 AM
Hi!
Please, I've this doubt: is it possible with NT7 and with the feature of multi-instrument chart, seeing different orders throwed by the same strategy to different instruments?, in example: imagine that there is one chart with the Corn futures and the Wheat futures contract, and I need a system that trades the spread, that is, I must buy one and sell the other, I know this is possible to do within a strategy, but will the chart show the orders in both instruments?
Do I need to preconfigure the chart?
Any suggestions please? I want to develop this spread strategy than any example or suggestion will be appreciated.
Thank you!!
MXASJ
03-10-2010, 04:55 AM
joanNT you might find the attached indicator SpreadZScore worth looking at. I've been working on using it in a two instrument strategy where you are quoting in the market based on an implied spread, but that complex a strategy is beyond my current coding ability so it will take time.
Apply the indicator to chart, add the second instrument and the number of contracts for both, and it plots the ZScore with markers at +/- 2 SDs.
If this indicator gives you any ideas on things you need to effectively trade outrights as spreads please let me know so I can try to incorporate them.
There is a comment in the code in the Initialize() section where I think there might be something NT7b10 doesn't like about this... sometimes. So just be aware of it.
NinjaTrader_Jason
03-10-2010, 05:12 AM
Hello joanNT,
Unfortunately this is not supported in the same chart. Your strategy will run on one data series (either corn or wheat), which means that orders will only be displayed for this data series. It does not mean just because the chart has multiple data series, the strategy is applied to each data series.
Your strategy runs on 1 data series in the chart. Additional data series added in your strategy code is behind the scene.
If you create a separate chart for the second instrument, you will see executions.
joanNT
03-10-2010, 05:23 AM
Thank you very much! MXASJ.
I downloaded another indicator that plots the spread, which I think it's more complex cause synchronitzation time bars, from http://www.ninjatrader-support2.com/vb/showthread.php?t=22954&highlight=spread
But I'll take a look to yours.
Thanks again
MXASJ
03-10-2010, 05:24 AM
joanNT this is what I mean. In Sim I'm long 5 ZN 06-10 and short 3 ZB 06-10. Entries are on the right edge of the chart.
The strategy code is no where near fully functional and I am sure there are better ways to do it, but I wanted to get it started.
joanNT
03-10-2010, 05:25 AM
Hi Jason,
when you are saying "If you create a separate chart for the second instrument, you will see executions." I suppose this second chart is whitout applying any strategy, simply the chart, right?
Thanks
MXASJ
03-10-2010, 05:27 AM
Thank you very much! MXASJ.
I downloaded another indicator that plots the spread, which I think it's more complex cause synchronitzation time bars, from http://www.ninjatrader-support2.com/vb/showthread.php?t=22954&highlight=spread
But I'll take a look to yours.
Thanks again
:). kdorden is lightyears ahead of me in coding ability and I'm quietly hoping he will post a spread trader at some point. In the meantime, I'm hacking away at it ;).
joanNT
03-10-2010, 05:34 AM
MXASJ,
your attached image simply contradicts Jason reply, or, you are plotting the entries of 2nd instrument in the same chart....
Let me know, please, how did you do? I took a look to the indicator code but I don't see anything..:mad:
Thank you again
NinjaTrader_Bertrand
03-10-2010, 05:37 AM
joanNT, this is just a MultiSeries chart with both instruments plotted that the spread would use, too. If you submit orders from a strategy to both you would see executions for both provided you create a chart containing both instruments...
joanNT
03-10-2010, 05:42 AM
That's what I asked for, thanks Bertrand, sure it's my bad level of english sometimes I cannot explain things as I want
MXASJ
03-10-2010, 05:48 AM
Both Bertrand and Jason are correct. Try this:
Open a 30 min ZN chart
Apply the indicator. I used a quantity of 5 for the Quoted instrument, and 3 for the Hedge (in this case ZB 06-10).
Click OK to plot the ZScore of the 5*ZN-3*ZB spread (I forget the exact formula. Its in the indicator).
Add ZB as a second data series to the chart. You will see (if you traded it) where you went long one and short the other in the seperate panes.
That chart is from a strategy which is too buggy to post at this point in time, but you get an idea of what is possible.
joanNT
03-10-2010, 07:05 AM
Thanks MXASJ, I'm developing another spread strategy I'll try these steps when finished and see if works.