What is the difference between COBC true vs false? - NinjaTrader | futures io social day trading
futures io futures trading


What is the difference between COBC true vs false?
Updated: Views / Replies:2,039 / 18
Created: by ericson Attachments:3

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 3  
 
Thread Tools Search this Thread
 

What is the difference between COBC true vs false?

  #1 (permalink)
Winning Is What I do
Sacramento, CA
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: NA
Favorite Futures: Stocks, Forex
 
Posts: 64 since Nov 2013
Thanks: 14 given, 16 received

What is the difference between COBC true vs false?

Still confusing to me. Can someone explain it to me? I know true its at close of bar, that calculates to send order. False is for every tick. But how is that different live trading? I know its always true for backtesting, but what happens when its set t0 false live trading?

How does that affect comparing indicators [0] to [1] in conditions?

Side question: If set to true, is it guaranteed to buy/sell at open next bar like how it is done in backtesting.Is their a difference between forex and stocks trading?


Thanks to all!

Reply With Quote
 
  #2 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,220 received

All historical data is calculated as-if COBC = true. Once you start processing live data, COBC=true means indicators are evaluated once at the close of the bar. If set to false it means indicators are evaluated on each incoming tick.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #3 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary



ericson View Post
Still confusing to me. Can someone explain it to me? I know true its at close of bar, that calculates to send order. False is for every tick. But how is that different live trading? I know its always true for backtesting, but what happens when its set t0 false live trading?

How does that affect comparing indicators [0] to [1] in conditions?

Side question: If set to true, is it guaranteed to buy/sell at open next bar like how it is done in backtesting.Is their a difference between forex and stocks trading?


Thanks to all!


Let us assume that you watch a 1-minute chart. It is 9:35:20 AM EST. In that case the last bar that you will see on your chart is the 9:36 bar. It is incomplete and you can see, how the close moves up and down.

COBC = true : The indicator value will only be calculated, when the current bar is complete. In the example this means that the calculation is performed once every minute, because you are watching a 1-minute chart. No value will be displayed for the current incomplete bar.

COBC = false: The indicator value is recalculated for every incoming tick. The preliminary value will be displayed for the current incomplete bar.

The NinjaTrader default setting is COBC = true. The reason is that the CPU load is much lower with COBC = true (only one calculation performed per bar) compared with COBC = false (one calculation performed with every incoming tick). The CPU issue may be important for a complex or badly coded indicator. Also some indicators, such as the average true range should not be used at all with COBC = false. The reason here is that the true range of a new developing bar is close to 0, therefore the ATR is systematically distorted to the downside, when used with incomplete bars.

For backtests, COBC = true is the only option, because the data used for the backtest is just the OHLC and volume of the bar series loaded. The intra-bar information - that is single ticks - are not used, because this would take too many resources to conduct a standard backtest on an average PC.

The setting COBC = false should only be used

- when intra-bar signals are required for trading
- when the indicators and strategies are coded in a proper way to make efficient use of the CPU

Reply With Quote
The following 6 users say Thank You to Fat Tails for this post:
 
  #4 (permalink)
Elite Member
Kirkland, WA/United States
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Optimus/Vision/Rithmic
Favorite Futures: Futures
 
LightWeight's Avatar
 
Posts: 138 since Jul 2012
Thanks: 138 given, 42 received

I am a little confused about this -- I am running several strategies with COBC set to true, and yet they're jumping into trades at random times throughout the one minute period. They all use market orders for entry and exit, and operate on 1 minute charts. In backtesting the same strategy will show entry at say 18:44:00, while the live sim strategy will show entry at 18:33:48, even though COBC is set to true. I would assume that the live results should mirror the backtest -- if anything, the live sim would go in AFTER the backtest entry, say at 18:44:01 or 18:44:02. I tried changing the setting to false in case Ninja had it reversed and it didn't seem to make much difference. Of course, all of my backtesting results are based on COBC = true and then activation at that time, so how the hell do I get my live sim strategies to take the same approach? Because so far it seems like this making a huge difference in live performance vs. backtesting performance.

I also wonder if this is affecting the exit -- many times it seems like the strategy hops out with a small gain, while letting the losers go all the way to stop loss. I would guess that perhaps that there was an exit signal intrabar which caused the strategy to exit live, but in backtesting the signal was not present at the close of the same bar and thus it did not exit the position, giving it more time/chances to reach profit target instead.

I don't see how I can possibly get accurate results without either A) getting the backtest to execute intrabar trades just as the live strategies are doing, or B) get the live strategies to wait until the bar close for entry, like backtest is doing.

Think big, think positive, never show any sign of weakness. Always go for the throat. Buy low, sell high. Fear? That's the other guy's problem. In this building, it's either kill or be killed. You make no friends in the pits and you take no prisoners. One minute you're up half a million in soybeans and the next, boom, your kids don't go to college and they've repossessed your Bentley. Are you with me?
Reply With Quote
 
  #5 (permalink)
Elite Member
Kirkland, WA/United States
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Optimus/Vision/Rithmic
Favorite Futures: Futures
 
LightWeight's Avatar
 
Posts: 138 since Jul 2012
Thanks: 138 given, 42 received

I'm wondering if this would actually solve the issue for me:

https://futures.io/ninjatrader-programming/3313-managing-trade-when-calculate-close-true.html#post31278

Think big, think positive, never show any sign of weakness. Always go for the throat. Buy low, sell high. Fear? That's the other guy's problem. In this building, it's either kill or be killed. You make no friends in the pits and you take no prisoners. One minute you're up half a million in soybeans and the next, boom, your kids don't go to college and they've repossessed your Bentley. Are you with me?
Reply With Quote
 
  #6 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


LightWeight View Post
I am a little confused about this -- I am running several strategies with COBC set to true, and yet they're jumping into trades at random times throughout the one minute period. They all use market orders for entry and exit, and operate on 1 minute charts. In backtesting the same strategy will show entry at say 18:44:00, while the live sim strategy will show entry at 18:33:48, even though COBC is set to true. I would assume that the live results should mirror the backtest -- if anything, the live sim would go in AFTER the backtest entry, say at 18:44:01 or 18:44:02. I tried changing the setting to false in case Ninja had it reversed and it didn't seem to make much difference. Of course, all of my backtesting results are based on COBC = true and then activation at that time, so how the hell do I get my live sim strategies to take the same approach? Because so far it seems like this making a huge difference in live performance vs. backtesting performance.

I also wonder if this is affecting the exit -- many times it seems like the strategy hops out with a small gain, while letting the losers go all the way to stop loss. I would guess that perhaps that there was an exit signal intrabar which caused the strategy to exit live, but in backtesting the signal was not present at the close of the same bar and thus it did not exit the position, giving it more time/chances to reach profit target instead.

I don't see how I can possibly get accurate results without either A) getting the backtest to execute intrabar trades just as the live strategies are doing, or B) get the live strategies to wait until the bar close for entry, like backtest is doing.


@LightWeight: Live results never mirror the back test for various reasons. For example the latency of your trading PC, the delay imposed by the broker to execute your trade (due to credit control to comply with margin requirements), the depth of the order book are not known or used in backtest.


Stop and limit orders - managed approach

In your case where the live strategy entered earlier than the backtest, the likely reason is that you used a stop or a limit order.

Let us take the case of a stop order: In a live environment the stop order is transformed to a market order, when the stop price is hit. The execution price is near the stop price. In a backtest any executions are shown with the time stamp of the bar close. However, the stop order should be excuted at a similar price.

It is important to understand that a backtest is performed on historical data. That means that you just have the historical bars (open, high, low, close and volume) but have no clue, what happened intra-bar. If you have a historical bar that lasts from 9:30 to 9:45 and that has hit a stop, you cannot tell whether the stop was hit at 9:32 or 9:44. Therefore the timestamp shown is always the time stamp of the bar, that is 9:45.

In real-time trading the stop will be hit when the market first trades at the stop price, which can be at any time between 9:30 and 9:45.


Unmanaged market orders

In case that you simply used unmanaged market orders and both the backtest and the live SIM strategy running in COBC = true, you will observe similar results. The only difference should be due to slippage.

Reply With Quote
The following 2 users say Thank You to Fat Tails for this post:
 
  #7 (permalink)
Elite Member
Kirkland, WA/United States
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Optimus/Vision/Rithmic
Favorite Futures: Futures
 
LightWeight's Avatar
 
Posts: 138 since Jul 2012
Thanks: 138 given, 42 received


Fat Tails View Post
@LightWeight: Live results never mirror the back test for various reasons. For example the latency of your trading PC, the delay imposed by the broker to execute your trade (due to credit control to comply with margin requirements), the depth of the order book are not known or used in backtest.


Stop and limit orders - managed approach

In your case where the live strategy entered earlier than the backtest, the likely reason is that you used a stop or a limit order.

Let us take the case of a stop order: In a live environment the stop order is transformed to a market order, when the stop price is hit. The execution price is near the stop price. In a backtest any executions are shown with the time stamp of the bar close. However, the stop order should be excuted at a similar price.

It is important to understand that a backtest is performed on historical data. That means that you just have the historical bars (open, high, low, close and volume) but have no clue, what happened intra-bar. If you have a historical bar that lasts from 9:30 to 9:45 and that has hit a stop, you cannot tell whether the stop was hit at 9:32 or 9:44. Therefore the timestamp shown is always the time stamp of the bar, that is 9:45.

In real-time trading the stop will be hit when the market first trades at the stop price, which can be at any time between 9:30 and 9:45.


Unmanaged market orders

In case that you simply used unmanaged market orders and both the backtest and the live SIM strategy running in COBC = true, you will observe similar results. The only difference should be due to slippage.

Thanks for the reply.

I don't think the issue is stop orders, as again these strategies all use a market order (Enter Long, Enter Short) for entry and exit, not a limit order -- so they should fill instantly. They are also using a 1 minute chart, so a longer time based bar shouldn't be the issue. What I'm finding strange is that live sim results are going in EARLIER than the backtest entry, which I would assume means that the strategy is taking the signal intra-bar, rather than on the close (which is what the backtest is doing)...I can't think of any reason why my entry (and exit) times would be anything other than :00 or :01 in the order history. But instead I have fills all over the one minute period even when using market orders and in highly liquid markets, and ALL of them earlier than what the time stamp is for the backtest.

The bigger issue seems to be exits though -- entries almost always seem to be within a tick, so say 102.71 in live sim vs 102.70 in backtest, in spite of the time difference of almost up to a minute, or sometimes more, but the exits can differ wildly. Again, it seems to be because the live strategy is allowing itself to exit intrabar, BEFORE the close, while the backtest result is forced to wait, and thus the signal may be different at close and not trigger an exit after all. Exit times differ wildly between the two as well.

So that's my frustration here -- like you said, unmanaged market orders with COBC = true set to both SHOULD be showing similar results, with minor differences due to slippage -- but instead I am getting quite different results, particularly on the exit, and it seems to be because the live strategy is ignoring the close and executing immediately upon signal....

Think big, think positive, never show any sign of weakness. Always go for the throat. Buy low, sell high. Fear? That's the other guy's problem. In this building, it's either kill or be killed. You make no friends in the pits and you take no prisoners. One minute you're up half a million in soybeans and the next, boom, your kids don't go to college and they've repossessed your Bentley. Are you with me?
Reply With Quote
 
  #8 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


LightWeight View Post
Thanks for the reply.

I don't think the issue is stop orders, as again these strategies all use a market order (Enter Long, Enter Short) for entry and exit, not a limit order -- so they should fill instantly. They are also using a 1 minute chart, so a longer time based bar shouldn't be the issue. What I'm finding strange is that live sim results are going in EARLIER than the backtest entry, which I would assume means that the strategy is taking the signal intra-bar, rather than on the close (which is what the backtest is doing)...I can't think of any reason why my entry (and exit) times would be anything other than :00 or :01 in the order history. But instead I have fills all over the one minute period even when using market orders and in highly liquid markets, and ALL of them earlier than what the time stamp is for the backtest.

The bigger issue seems to be exits though -- entries almost always seem to be within a tick, so say 102.71 in live sim vs 102.70 in backtest, in spite of the time difference of almost up to a minute, or sometimes more, but the exits can differ wildly. Again, it seems to be because the live strategy is allowing itself to exit intrabar, BEFORE the close, while the backtest result is forced to wait, and thus the signal may be different at close and not trigger an exit after all. Exit times differ wildly between the two as well.

So that's my frustration here -- like you said, unmanaged market orders with COBC = true set to both SHOULD be showing similar results, with minor differences due to slippage -- but instead I am getting quite different results, particularly on the exit, and it seems to be because the live strategy is ignoring the close and executing immediately upon signal....

Live exits can only be taken intra-bar

- if you have set your strategy to COBC = false
- or if you use stop or limit orders

Please check your strategy und your settings.

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #9 (permalink)
Elite Member
Kirkland, WA/United States
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Optimus/Vision/Rithmic
Favorite Futures: Futures
 
LightWeight's Avatar
 
Posts: 138 since Jul 2012
Thanks: 138 given, 42 received


Fat Tails View Post
Live exits can only be taken intra-bar

- if you have set your strategy to COBC = false
- or if you use stop or limit orders

Please check your strategy und your settings.

Yes, but COBC = true
And the strategies use market orders

In other words I want my live strategies to replicate the backtest results as closely as possible, by also only going in and out at the close/open of the bar, when the signal is active. I don't want them to trade intra-bar, and yet they are anyway. In that post I linked to above, the one guy is saying you can add FirstTickOfBar && Close[1] to the code, and this will force the strategy to not enter trade until the first tick of the NEXT bar, and only if the strategy entry conditions are still in effect. I believe this is exactly how the backtest operates in its assumptions and why the results are different thus far from live testing. I assume this code could be applied to the exit as well. I would have thought that selecting COBC = true in the strategy GUI window would accomplish the same thing, but it does not apparently.

It's kind of amusing because most posts I see are by people who want the strategy to enter intra-bar, as soon as the signal generates, while instead I'm trying to delay it until the close of the bar.

Think big, think positive, never show any sign of weakness. Always go for the throat. Buy low, sell high. Fear? That's the other guy's problem. In this building, it's either kill or be killed. You make no friends in the pits and you take no prisoners. One minute you're up half a million in soybeans and the next, boom, your kids don't go to college and they've repossessed your Bentley. Are you with me?
Reply With Quote
 
  #10 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary



LightWeight View Post
Yes, but COBC = true
And the strategies use market orders

This is not possible.

For further discussion please attach your strategies and a few samples showing that the live simulation strategy entered prior to the backtest.

Reply With Quote

Reply



futures io > > > > What is the difference between COBC true vs false?

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
OnBarClose true for indicator false for strategy spinnybobo NinjaTrader Programming 1 April 5th, 2013 09:57 PM
COBC false indicators on COBC true strategy daydaxer NinjaTrader Programming 10 June 6th, 2012 03:56 AM
True or False Big Mike Off-Topic 147 June 2nd, 2011 06:19 PM
True Or False - a serious thread trendisyourfriend Traders Hideout 7 October 23rd, 2010 06:31 PM
Opinions on COBC set to false in strategies jackyd NinjaTrader Programming 17 July 28th, 2009 12:32 PM


All times are GMT -4. The time now is 01:57 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-13 in 0.19 seconds with 20 queries on phoenix via your IP 54.92.201.232