NexusFi: Find Your Edge


Home Menu

 





Bar End Result diifferent based on COBC?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one LostTrader with 4 posts (0 thanks)
    2. looks_two Big Mike with 2 posts (2 thanks)
    3. looks_3 Fat Tails with 2 posts (1 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 2,387 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 8 posts
    2. attach_file 1 attachments




 
Search this Thread

Bar End Result diifferent based on COBC?

  #1 (permalink)
 
LostTrader's Avatar
 LostTrader 
Tucson, AZ
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Mirus/Zen-Fire
Trading: CL, TF
Posts: 74 since Sep 2009
Thanks Given: 21
Thanks Received: 64

Why would the bar end result be different on a plot if running COBC true vs COBC false?

We are talking WMAs, EMAs here. Since the last tick will always replace prior intrabar tick results, the final input values should be the same. So seems to me that the outputs should also be the same.

I am having trouble wrapping my head around the thought that the outputs are different given the same inputs.
I feel like I am missing something obvious (wouldn't be the first time!)

Attached Thumbnails
Click image for larger version

Name:	NT COBC.png
Views:	157
Size:	4.2 KB
ID:	41091  
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
REcommedations for programming help
Sierra Chart
ZombieSqueeze
Platforms and Indicators
Cheap historycal L1 data for stocks
Stocks and ETFs
 
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103



LostTrader View Post
Why would the bar end result be different on a plot if running COBC true vs COBC false?

We are talking WMAs, EMAs here. Since the last tick will always replace prior intrabar tick results, the final input values should be the same. So seems to me that the outputs should also be the same.

I am having trouble wrapping my head around the thought that the outputs are different given the same inputs.
I feel like I am missing something obvious (wouldn't be the first time!)

For all properly coded indicator the end result will be identical. If set to CalcOnBarClose = false, NinjaTrader indicators will display intermediary values based on the temporary input values of price and volume. Once the bar is completed the indicator set to CalcOnBarClose=true will display the same result.

The only difference is that in CalcOnBarClose = false the unstable (unfinished) period is displayed, whereas for CalcOnBarClose = true it is not displayed, which makes up for an empty space instead of the indicator value.

If you are offline, NinjaTrader considers the last bar as incomplete, so the indicator may not show any value yet.

Reply With Quote
Thanked by:
  #4 (permalink)
 
LostTrader's Avatar
 LostTrader 
Tucson, AZ
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Mirus/Zen-Fire
Trading: CL, TF
Posts: 74 since Sep 2009
Thanks Given: 21
Thanks Received: 64


Fat Tails View Post
For all properly coded indicator the end result will be identical. If set to CalcOnBarClose = false, NinjaTrader indicators will display intermediary values based on the temporary input values of price and volume. Once the bar is completed the indicator set to CalcOnBarClose=true will display the same result.

The only difference is that in CalcOnBarClose = false the unstable (unfinished) period is displayed, whereas for CalcOnBarClose = true it is not displayed, which makes up for an empty space instead of the indicator value.

If you are offline, NinjaTrader considers the last bar as incomplete, so the indicator may not show any value yet.

Yeah, that's the way I see it too. And yet...

OK, could it be that the COBC true indicator was put on the chart from a Strategy and the COBC false was (already) placed on the chart through the Indicator panel? I cringe to think a Strategy will receive different values....

But I already know that code I write in a Indicator behaves differently when written in a Strategy.
That's what I have been working through the last few days.

P.S. I found the suspect code - the smoothing algorithm I was given to use will definitely not be the same intrabar vs EOB. Ah well, it will give me something to think about along woth the other stuff I am not getting done because I keep reading the forum.

Started this thread Reply With Quote
  #5 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103


LostTrader View Post
Yeah, that's the way I see it too. And yet...

OK, could it be that the COBC true indicator was put on the chart from a Strategy and the COBC false was (already) placed on the chart through the Indicator panel? I cringe to think a Strategy will receive different values....

But I already know that code I write in a Indicator behaves differently when written in a Strategy.
That's what I have been working through the last few days.

P.S. I found the suspect code - the smoothing algorithm I was given to use will definitely not be the same intrabar vs EOB. Ah well, it will give me something to think about along woth the other stuff I am not getting done because I keep reading the forum.

If CalcOnBarClose=false does not produce the same value in the end as CalcOnBarClose = true, it indicates that the indicator code is flawed, because the author has not understood which (iterating) calculations shall be only calculated when FirstTickOfBar is true, and which calculations can be performed with every incoming tick.

Note that historical bars have only 1 tick per bar, while real-time bars typically have many ticks per bar.

Reply With Quote
  #6 (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,469 since Jun 2009
Thanks Given: 33,246
Thanks Received: 101,669

NT strategies always operate on COBC true, there is no other option. You have to code a MTF strategy to get around that.

Most common problem people see with COBC false indicators is 'false' alerts, or alerts that occur or trigger when it is "false" that would not be shown later if the chart was refreshed. This is because:

1. In realtime, COBC false, a condition may happen intrabar that is no longer true at the end of bar. If your indicator does something intrabar, like draw an arrow, then unless you specifically add code to remove false arrows that arrow will remain even if at the end of the bar the condition is no longer true.

2. NT charts are built on historical data when loaded, and historical data is calculated only as COBC true. It is not possible to load a new chart and have the indicator values constructed as if COBC false was set on historical bars. This is a NT limitation.

Mike



Join the free Markets Chat beta: one platform, all the trade rooms!

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 Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #7 (permalink)
 
LostTrader's Avatar
 LostTrader 
Tucson, AZ
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Mirus/Zen-Fire
Trading: CL, TF
Posts: 74 since Sep 2009
Thanks Given: 21
Thanks Received: 64


Big Mike View Post
NT strategies always operate on COBC true, there is no other option. You have to code a MTF strategy to get around that.

MTF? I know when backtesting or optimizing, COBC will be true. But when running a strategy real-time on a chart, there is an option to change COBC. I would expect this to control more than simply the embedded indicators...


Quoting 
Most common problem people see with COBC false indicators is 'false' alerts, or alerts that occur or trigger when it is "false" that would not be shown later if the chart was refreshed. This is because:

1. In realtime, COBC false, a condition may happen intrabar that is no longer true at the end of bar. If your indicator does something intrabar, like draw an arrow, then unless you specifically add code to remove false arrows that arrow will remain even if at the end of the bar the condition is no longer true.

2. NT charts are built on historical data when loaded, and historical data is calculated only as COBC true. It is not possible to load a new chart and have the indicator values constructed as if COBC false was set on historical bars. This is a NT limitation.

Mike

Yes, I expect and code for these. Programming for accurate results for both COBC true, COBC false, and Historical has always keep NT life interesting. Thanks for the input!

Started this thread Reply With Quote
  #8 (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,469 since Jun 2009
Thanks Given: 33,246
Thanks Received: 101,669

MTF = multiple time frames. I was referring to backtesting. Yes, live forward testing can use cobc = false, but not optimizing or backtesting.

Mike



Join the free Markets Chat beta: one platform, all the trade rooms!

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 Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #9 (permalink)
 
LostTrader's Avatar
 LostTrader 
Tucson, AZ
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Mirus/Zen-Fire
Trading: CL, TF
Posts: 74 since Sep 2009
Thanks Given: 21
Thanks Received: 64


Big Mike View Post
MTF = multiple time frames. I was referring to backtesting.

Oh, right! I understand.

Fortunately, I do not need that level of complexity.

Started this thread Reply With Quote




Last Updated on June 15, 2011


© 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