NexusFi: Find Your Edge


Home Menu

 





CalculateOnBarClose = false versus OnMarketData()


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one MWinfrey with 4 posts (2 thanks)
    2. looks_two Silvester17 with 2 posts (2 thanks)
    3. looks_3 ratfink with 2 posts (2 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 2,721 views
    2. thumb_up 6 thanks given
    3. group 1 followers
    1. forum 8 posts
    2. attach_file 1 attachments




 
Search this Thread

CalculateOnBarClose = false versus OnMarketData()

  #1 (permalink)
 
MWinfrey's Avatar
 MWinfrey 
Lubbock TX
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Stage 5 Trading
Trading: CL
Posts: 1,878 since Jul 2009
Thanks Given: 1,450
Thanks Received: 3,335

I've known for some time about OnMarketData and how it processes every tick that comes in but never connected the dots between it and CalculateOnBarClose = false.

I may say some things that aren't technically accurate because I don't completely know everything that goes on under the hood of NT. However, I will make statements based on observation and testing. I use Chart Trader and I've noticed many times where I have a limit order in place and it is filled without price going through it. I also realize that NT does not update the chart every tick because of the increased resource utilization that is caused by updating every tick. In fact there is a lower limit that prevents you from displaying every tick on the chart. Take a look at the "Display update interval (sec)" property that can be found in the Chart Properties. That property can not be set to 0. What that means is that a bar range may not show the true range of a bar. It could be off by a tick or 2. That is why limit orders can be filled without price going through. I think this situation only applies to OnBarUpdate and CalculateOnBarClose = false. I say that because using OnMarketData(MarketDataEventArgs e) in my programming I can see e.Price changing when there is no price change on the chart. Put this code into an indicator then put it on a chart and you will see what I mean.

 
Code
		
protected override void OnMarketData(MarketDataEventArgs e)
{
    DrawHorizontalLine("eprice",e.Price,Color.Black);
}

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
Build trailing stop for micro index(s)
Psychology and Money Management
ZombieSqueeze
Platforms and Indicators
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
  #3 (permalink)
 
Silvester17's Avatar
 Silvester17 
Columbus, OH
Market Wizard
 
Experience: None
Platform: NT 8, TOS
Trading: ES
Posts: 3,603 since Aug 2009
Thanks Given: 5,139
Thanks Received: 11,527



MWinfrey View Post
I've known for some time about OnMarketData and how it processes every tick that comes in but never connected the dots between it and CalculateOnBarClose = false.

I may say some things that aren't technically accurate because I don't completely know everything that goes on under the hood of NT. However, I will make statements based on observation and testing. I use Chart Trader and I've noticed many times where I have a limit order in place and it is filled without price going through it. I also realize that NT does not update the chart every tick because of the increased resource utilization that is caused by updating every tick. In fact there is a lower limit that prevents you from displaying every tick on the chart. Take a look at the "Display update interval (sec)" property that can be found in the Chart Properties. That property can not be set to 0. What that means is that a bar range may not show the true range of a bar. It could be off by a tick or 2. That is why limit orders can be filled without price going through. I think this situation only applies to OnBarUpdate and CalculateOnBarClose = false. I say that because using OnMarketData(MarketDataEventArgs e) in my programming I can see e.Price changing when there is no price change on the chart. Put this code into an indicator then put it on a chart and you will see what I mean.

 
Code
		
protected override void OnMarketData(MarketDataEventArgs e)
{
    DrawHorizontalLine("eprice",e.Price,Color.Black);
}

I don't understand. why does price have to go through the limit? it depends where your order is in the queue.

I also don't believe that range bars are off 1 or 2 ticks.

Reply With Quote
Thanked by:
  #4 (permalink)
 
MWinfrey's Avatar
 MWinfrey 
Lubbock TX
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Stage 5 Trading
Trading: CL
Posts: 1,878 since Jul 2009
Thanks Given: 1,450
Thanks Received: 3,335


Silvester17 View Post
I don't understand. why does price have to go through the limit? it depends where your order is in the queue. just think, someone is always selling at the high, and this is certainly not a market order.

I also don't believe that range bars are off 1 or 2 ticks.

Someone else needs to answer his question about the limit order. What I describe what I've always been told by those who are theoretically in the know. I may be totally wrong but my observations support my statement. I just had an occurrence of just what I describe a few minutes ago. Price on my 1 minute chart merely touched the limit order but e.Price did go through and filled. I'm including the indicator I described in my previous post. Put it on a chart and you will see what I mean about the chart price versus e.Price.

Attached Files
Elite Membership required to download: OnMarketDataDemo.zip
Started this thread Reply With Quote
Thanked by:
  #5 (permalink)
 
Silvester17's Avatar
 Silvester17 
Columbus, OH
Market Wizard
 
Experience: None
Platform: NT 8, TOS
Trading: ES
Posts: 3,603 since Aug 2009
Thanks Given: 5,139
Thanks Received: 11,527


MWinfrey View Post
Someone else needs to answer his question about the limit order. What I describe what I've always been told by those who are theoretically in the know. I may be totally wrong but my observations support my statement. I just had an occurrence of just what I describe a few minutes ago. Price on my 1 minute chart merely touched the limit order but e.Price did go through and filled. I'm including the indicator I described in my previous post. Put it on a chart and you will see what I mean about the chart price versus e.Price.

sorry for the confusion, but this was not a question. the futures markets operate that way, with 100% certainty.

what you're describing is more like a market maker market, like nasdaq. here, you normally can only sell at the bid or buy at the offer. in exchange, you won't have to pay a commission if you went through a market maker. and sometimes even there you can sell at the offer, but depending on the market maker again.

Reply With Quote
Thanked by:
  #6 (permalink)
 
MWinfrey's Avatar
 MWinfrey 
Lubbock TX
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Stage 5 Trading
Trading: CL
Posts: 1,878 since Jul 2009
Thanks Given: 1,450
Thanks Received: 3,335


Silvester17 View Post
sorry for the confusion, but this was not a question. the futures markets operate that way, with 100% certainty.

what you're describing is more like a market maker market, like nasdaq. here, you normally can only sell at the bid or buy at the offer. in exchange, you won't have to pay a commission if you went through a market maker. and sometimes even there you can sell at the offer, but depending on the market maker again.

Thanks for the clarification. Regardless, my point about NT still remains. There is a difference between e.Price and price you see on a chart. My problem is that I really don't know what the impact is other than display. If it's a display issue then I expect to see discrepancies between bars produced in a live market versus bars produced from historic data.

Example using a 1 minute chart.

Using the indicator I attached in a previous post, I've seen many times when e.Price exceeds the limit of the 1 minute bar as displayed on the chart. So, that 1 minute bar has a range on the live chart of 5 ticks when based on my indicator the 1 minute bar should really be 6 ticks. So, if I reload historic data, that same bar that was 5 ticks on a live chart should now show 6 ticks but I've never seen that. Someone please show me the error of my ways.

Started this thread Reply With Quote
Thanked by:
  #7 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,425


MWinfrey View Post
Thanks for the clarification. Regardless, my point about NT still remains. There is a difference between e.Price and price you see on a chart. My problem is that I really don't know what the impact is other than display. If it's a display issue then I expect to see discrepancies between bars produced in a live market versus bars produced from historic data.

Example using a 1 minute chart.

Using the indicator I attached in a previous post, I've seen many times when e.Price exceeds the limit of the 1 minute bar as displayed on the chart. So, that 1 minute bar has a range on the live chart of 5 ticks when based on my indicator the 1 minute bar should really be 6 ticks. So, if I reload historic data, that same bar that was 5 ticks on a live chart should now show 6 ticks but I've never seen that. Someone please show me the error of my ways.

Are you forgetting OnMarketData provides Bid, Ask and Last price changes? i.e. some of the prices will not be for actual trades.

Travel Well
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #8 (permalink)
 
MWinfrey's Avatar
 MWinfrey 
Lubbock TX
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Stage 5 Trading
Trading: CL
Posts: 1,878 since Jul 2009
Thanks Given: 1,450
Thanks Received: 3,335


ratfink View Post
Are you forgetting OnMarketData provides Bid, Ask and Last price changes? i.e. some of the prices will not be for actual trades.

yes...which should I be looking at, Last?

Started this thread Reply With Quote
  #9 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,425


MWinfrey View Post
yes...which should I be looking at, Last?

Yes, that will be the price for any that are actually executed.

Travel Well
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:




Last Updated on September 30, 2013


© 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