NexusFi: Find Your Edge


Home Menu

 





Project: Building a Calendar Spread BAR TYPE


Discussion in NinjaTrader

Updated
    1. trending_up 2,531 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 6 posts
    2. attach_file 2 attachments




 
Search this Thread
  #1 (permalink)
 
SodyTexas's Avatar
 SodyTexas 
Austin TX
 
Experience: Advanced
Platform: Ninjatrader, Python, & R
Broker: RJO
Trading: Futures, Spreads
Posts: 424 since Sep 2013
Thanks Given: 118
Thanks Received: 1,097

Hey NexusFi (formerly BMT),

I have a impossible goal! I would like to build a Calendar Spread Bar Type.

The concept is simple, take one price from a contract and subtract it from another. i.e. NG 03-15 minus NG 04-15 (the widow maker spread).

But what I do not want to do is build it as a indicator. Why, well those who know me, knows that I like Point and Figure charts which does not have time. I can not build a PnF based indicator because the Bars in progress will not match the PnF style of the spread.

How to get around this? Build my own Bar Type!

Any thoughts on where to start?

As I work on this project I will post my progress here.. Maybe if I can get some smarter people than myself working on this we can come up with a solution; but, maybe there is no solution in NT7.

Sody


"The great Traders have always been humbled by the market early on in their careers creating a deep respect for the market. Until one has this respect indelibly engraved in their makeup, the concept of money management and discipline will never be treated seriously."
Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Iran Peace Expired NO: Ceasefire on Life Support, OPEC a …
Prediction Markets & Event Contracts
MegaETH Proves the Crowd Right: Prediction Markets Calle …
Prediction Markets & Event Contracts
Election Sunday Resolves: Peru Heads to Runoff at 42pct, …
Prediction Markets & Event Contracts
TradingView Deploys AI to Monitor SEC Filings in Real Ti …
TradingView
Weekend Update: First Qatari LNG Transit Attempted -- IR …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
23 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #2 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557

If you accomplish this, I would suggest it is useful for more than just calendar spreads, but also synthetic spreads of any nature. BTW, Sierra Chart has this built-in, which means the source code is probably available in C++ in the source folder of SC.

Mike




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
  #3 (permalink)
 
SodyTexas's Avatar
 SodyTexas 
Austin TX
 
Experience: Advanced
Platform: Ninjatrader, Python, & R
Broker: RJO
Trading: Futures, Spreads
Posts: 424 since Sep 2013
Thanks Given: 118
Thanks Received: 1,097



Big Mike View Post
If you accomplish this, I would suggest it is useful for more than just calendar spreads, but also synthetic spreads of any nature. BTW, Sierra Chart has this built-in, which means the source code is probably available in C++ in the source folder of SC.

Mike

Thanks Mike,

I don't have SC, if someone has the source files can you upload them here?

And yes once I figure out the calendar spread I think it would be wise to add functionality for other spreads.

Cheers,

Sody


"The great Traders have always been humbled by the market early on in their careers creating a deep respect for the market. Until one has this respect indelibly engraved in their makeup, the concept of money management and discipline will never be treated seriously."
Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #4 (permalink)
 
SodyTexas's Avatar
 SodyTexas 
Austin TX
 
Experience: Advanced
Platform: Ninjatrader, Python, & R
Broker: RJO
Trading: Futures, Spreads
Posts: 424 since Sep 2013
Thanks Given: 118
Thanks Received: 1,097

I am going to start by trying to add a new masterinstrument to an existing custom bartype.

I choose SveRenko because of the simplicity of the code. you can download the code here:

https://nexusfi.com/download/ninjatrader-7/indicators/1561-download.html?view

This will be the starting point!


"The great Traders have always been humbled by the market early on in their careers creating a deep respect for the market. Until one has this respect indelibly engraved in their makeup, the concept of money management and discipline will never be treated seriously."
Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #5 (permalink)
 
SodyTexas's Avatar
 SodyTexas 
Austin TX
 
Experience: Advanced
Platform: Ninjatrader, Python, & R
Broker: RJO
Trading: Futures, Spreads
Posts: 424 since Sep 2013
Thanks Given: 118
Thanks Received: 1,097

Also, I will be building this code in Visual Studio 2012.

It will be important to add intellisense to the project so we can easily build out the code; you can do this here:



When done correctly, you should have your VS looking like the attached image.

Cheers,

Sody


"The great Traders have always been humbled by the market early on in their careers creating a deep respect for the market. Until one has this respect indelibly engraved in their makeup, the concept of money management and discipline will never be treated seriously."
Attached Thumbnails
Click image for larger version

Name:	VS2012.png
Views:	240
Size:	131.2 KB
ID:	177153  
Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #6 (permalink)
 
SodyTexas's Avatar
 SodyTexas 
Austin TX
 
Experience: Advanced
Platform: Ninjatrader, Python, & R
Broker: RJO
Trading: Futures, Spreads
Posts: 424 since Sep 2013
Thanks Given: 118
Thanks Received: 1,097

You can see that the AddBar function is looking for double values.. See image attached.

What I need to do is find a way to call multiple instruments into the code. Any ideas?


"The great Traders have always been humbled by the market early on in their careers creating a deep respect for the market. Until one has this respect indelibly engraved in their makeup, the concept of money management and discipline will never be treated seriously."
Attached Thumbnails
Click image for larger version

Name:	VS2.png
Views:	268
Size:	135.4 KB
ID:	177161  
Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #7 (permalink)
 
fesx's Avatar
 fesx 
Georgia
 
Experience: Intermediate
Platform: Ninja
Broker: AMP/CQG
Trading: ZN, ES, FGBL, FESX
Posts: 134 since Jul 2009
Thanks Given: 897
Thanks Received: 114

@SodyTexas, How is the spread bar type coming along? I have always been interested in spread charts.


Reply With Quote




Last Updated on August 26, 2016


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts