NexusFi: Find Your Edge


Home Menu

 





Need Help Badly with a Formula


Discussion in Commodities

Updated
      Top Posters
    1. looks_one excite2 with 3 posts (1 thanks)
    2. looks_two Afriend247 with 2 posts (0 thanks)
    3. looks_3 hiperkostencja with 1 posts (0 thanks)
    4. looks_4 Geir with 1 posts (0 thanks)
    1. trending_up 915 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 6 posts
    2. attach_file 0 attachments




 
Search this Thread

Need Help Badly with a Formula

  #1 (permalink)
excite2
new york
 
Posts: 18 since Jun 2010
Thanks Given: 0
Thanks Received: 1

Does anyone know if there is a way to create a formula similar to a Ratio Chart that would combine two or more symbols but allow each symbol to have a different "weighting" for each? Ratio charts are usually fixed at a 1 to 1 ratio.

For example if I plan on buying 10 lots of January CL and 5 lots of February CL is there a way to chart this weighting so that the two symbols are merged into one ratio chart where the relative sizing of each symbol is taken into account where the January CL is stronger than the February CL?

Any help is greatly appreciated.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Cheap historycal L1 data for stocks
Stocks and ETFs
ZombieSqueeze
Platforms and Indicators
MC PL editor upgrade
MultiCharts
REcommedations for programming help
Sierra Chart
 
  #2 (permalink)
 Geir 
Oslo, Norway
 
Experience: Intermediate
Platform: Ninja Trader
Trading: ES
Posts: 10 since Jan 2011
Thanks Given: 46
Thanks Received: 40

I do not know which platform you are on, but in Investor/RT you would do this by setting up a custom instrument with the multiplier you need.
https://www.linnsoft.com/custom-instruments

Reply With Quote
  #3 (permalink)
 hiperkostencja 
Berlin Germany
 
Experience: Advanced
Platform: NinjaTrader, TradingView
Trading: commodities
Posts: 1 since Apr 2020
Thanks Given: 0
Thanks Received: 0


If you're looking for an NT solution then you can find a "Spread" indicator on futures.io or try https://ninjatraderecosystem.com/user-app-share-download/spread-2/

The platform that gives the most freedom in constructing your own spreads, not limited to just 2 parts, is TradingView, where you'd simply type in "CL1!*10 - CL2!*5" as your symbol. This functionality, however, requires Pro+ subscription.

Reply With Quote
  #4 (permalink)
Afriend247
Los Angeles, California
 
Posts: 9 since Sep 2022
Thanks Given: 3
Thanks Received: 2

Mathematically you could get a weighted spread plot by either multiplying or dividing the closing price by the number contracts (multiplication would give the larger contract size more weight). You would then subtract the larger one from the smaller one. i.e.
(close*10_contracts) - (close*5_contracts)
or (close/5_contract) - (close/10_contracts)


excite2 View Post
Does anyone know if there is a way to create a formula similar to a Ratio Chart that would combine two or more symbols but allow each symbol to have a different "weighting" for each? Ratio charts are usually fixed at a 1 to 1 ratio.

For example if I plan on buying 10 lots of January CL and 5 lots of February CL is there a way to chart this weighting so that the two symbols are merged into one ratio chart where the relative sizing of each symbol is taken into account where the January CL is stronger than the February CL?

Any help is greatly appreciated.


Reply With Quote
  #5 (permalink)
excite2
new york
 
Posts: 18 since Jun 2010
Thanks Given: 0
Thanks Received: 1

Thank you all so much for your help. Greatly appreciated! Btw, I'm using Sierra Chart custom symbol feature that creates custom symbols with formulas. Also using Interactive Brokers for data since they have historical midpoint data which is necessary for charting accurate spreads. They're the only place I know of to get historical midpoint data.

Two additional questions.

1. Can I also use this formula for more than two instruments? For example would (close*10_contracts) - (close*5_contracts) - (close*2_contracts) work as well for a 3 legged plot of three weighted instruments?

2. Rather than creating a spread/difference, if I would like to instead combine/merge two symbols into one weighted symbol that takes into account the weighting of each, would I just simply use a + sign instead of a - sign?

Thanks again.

Reply With Quote
  #6 (permalink)
Afriend247
Los Angeles, California
 
Posts: 9 since Sep 2022
Thanks Given: 3
Thanks Received: 2

Not familiar with Sierra Chart and not sure if I understand #1. You could end up with a zero or negative value, if you keep subtracting. For instance, if you have 10 - 6 - 5 the result is less than zero. While this is common (take momentum for instance "close - close[30]"), it may not work for your purpose.

For #2. Sounds like you want a weighted average. i.e.
((close*10_contracts) + (close*5_contracts) + (close*2_contracts)) / 3
This would merge all the values into one average giving more weight to the larger orders.


excite2 View Post
Thank you all so much for your help. Greatly appreciated! Btw, I'm using Sierra Chart custom symbol feature that creates custom symbols with formulas. Also using Interactive Brokers for data since they have historical midpoint data which is necessary for charting accurate spreads. They're the only place I know of to get historical midpoint data.

Two additional questions.

1. Can I also use this formula for more than two instruments? For example would (close*10_contracts) - (close*5_contracts) - (close*2_contracts) work as well for a 3 legged plot of three weighted instruments?

2. Rather than creating a spread/difference, if I would like to instead combine/merge two symbols into one weighted symbol that takes into account the weighting of each, would I just simply use a + sign instead of a - sign?

Thanks again.


Reply With Quote
  #7 (permalink)
excite2
new york
 
Posts: 18 since Jun 2010
Thanks Given: 0
Thanks Received: 1

Thank you so much Afriend247, once again much appreciated! I realize now that the weighted average you mentioned is actually what I was looking for instead of a weighted spread value. My intention was to create a plot that combined multiple instruments into one plot that takes into account the relative values of each by weighting each of them, so it should be averaged, not subtracted. I don't know why I didn't realize this earlier...

THANK YOU!

Reply With Quote
Thanked by:




Last Updated on March 13, 2023


© 2024 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 - Privacy Policy - Downloads - Top
no new posts