![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Member
Join Date: Oct 2009
Location: Madrid (Spain)
Posts: 39
Thanks: 15
Thanked 1 time in 1 post
|
Is there any difference between using OnBarUpdate
Code:
CalculateOnBarClose = False .. last=Close[0]; bid = GetCurrentBid(); ask=GetCurrentAsk(); Code:
if ( marketDataType.Last) last = e.Price if ( marketDataType.Bid) bid = e.Price if ( marketDataType.Ask) ask = e.Price
Last edited by Ramon; 02-17-2012 at 11:23 AM.
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
|
Hello Ramon,
Thanks for writing in and I am happy to assist you. NinjaTrader being multi-threaded with OnMarketData and OnBarUpdate being called in their own respective thread, there can be difference between GetCurrentAsk() and e.Price as ask price derived from OnMarketData. Please let me know if I can assist you any further.
Joydeep M.
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Oct 2009
Location: Madrid (Spain)
Posts: 39
Thanks: 15
Thanked 1 time in 1 post
|
I supposed, however the latest crossed price should match in both methods . is it so? . I mean
(last) e.Price == Close[0] or not? |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
|
Hello Ramon,
It may or may not match since Close and e.Price are updated on different thread. Please let me know if I can assist you any further.
Joydeep M.
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Joydeep for this post: |
|
|
|
#5 |
|
Member
Join Date: Oct 2009
Location: Madrid (Spain)
Posts: 39
Thanks: 15
Thanked 1 time in 1 post
|
In times of Livermore, Mr. Investor bought a contract to 890.25 and the tape recorded this fact
Today Mr Investor Jr. buys a contract to 1342.75 and thanks to technology this fact depends on whether you use OBU or OMD. I do not think that the fact that Livermore shot himself in the head has nothing to do with the progress of computers. So , we better continue using OMD to record events in Level 1 (Time & Sales) ? |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
|
Hello Ramon,
OnMarketData and OnBarUpdate has its own pros and cons. We provide you options, and it depends on your exact requirement, on how you utilize it to its optimum. Please let me know if I can assist you any further.
Joydeep M.
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Joydeep for this post: |
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| onBarUpdate vs onMarketData | danilam | General Programming | 7 | 11-17-2011 06:08 AM |
| OnMarketData and OnBarUpdate | telbentel | General Programming | 5 | 12-20-2010 08:15 AM |
| OnMarketData vs OnBarUpdate | kjackson | Indicator Development | 7 | 01-12-2010 10:11 AM |
| OnMarketData vs OnBarUpdate | rt-trader | General Programming | 2 | 01-18-2009 03:07 PM |
| OnMarketData and OnBarUpdate | svrz | Indicator Development | 6 | 12-23-2008 09:17 AM |