![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
|
I have been thinking about this recently, and wondering whether apart from registering an extra event, the end-of-bar tick in the latter case, is there really any difference between using,
Given such, might it not make more sense to use the latter as the programming paradigm. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
|
Good morning,
Not sure I understand exactly the question so let me know if the below does not answer. However the only difference between the two is that OnMarketData only works in realtime(Not historical) and is direct access to the streaming data. Let me know if I can be of further assistance.
Brett
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Feb 2009
Posts: 285
Thanks: 2
Thanked 52 times in 41 posts
|
from the help files
With NinjaTrader being multi-threaded, you should not rely on any particular sequence of events like OnMarketData() always being called before OnBarUpdate() or vice versa. as such FirtTickOfBar wont be registered in OnMarketData. OnMarketData is very useful when COBC is set to true but you still need to calculate/tract some stuffs in RT (say stops/targets in a strategy). |
|
|
|
|
|
#4 | |
|
Senior Member
|
Quote:
Given that answer then, does it mean that it will produce no usable results if a strategy the uses OnMarketData() for order generation is run through the Strategy Analyzer for backtest or optimization? |
|
|
|
|
|
|
#5 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
|
Correct, right would not run in historical. Only runs in live only mode.
Brett
NinjaTrader Customer Service |
|
|
|
|
|
#6 |
|
Senior Member
|
Yes, I did read that. That will be handled by a boolean flag set on the close of the bar, and turned off when OnMarketData() is done. If the flag is not set, OnMarketData() will return with no action. A pretty handy way to force precedence.
|
|
|
|
|
|
#7 |
|
Senior Member
|
How then would one go about optimizing such a strategy? Hand optimization by manually adjusting parameters per each run, hardly seems workable. Or are you saying that such a strategy cannot be optimized, as there is no way to run any kind of backtest, with a reasonable permutation of parameters?
|
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
|
Hello,
You can't optimize or backtest a strategy that uses live data stream access.
Brett
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| when is OnBarUpdate() called when the "CalculateOnBarClose" property is set to true? | clearpicks | General Programming | 1 | 12-12-2010 10:15 AM |
| Timing sequence for "OnBarUpdate=True" | AnotherTrader | Automated Trading | 3 | 08-06-2010 07:00 AM |
| Strategy COBC=false, Indicator COBC=true? | MXASJ | Version 7 Beta General Questions & Bug Reports | 2 | 06-28-2010 05:35 AM |
| summary of "strategy realized" is not equal "account performance, total net profit"" | Fragolino | Miscellaneous Support | 1 | 02-19-2009 04:12 AM |
| OnBarUpdate "context" in user defined method | kgillis23 | General Programming | 3 | 01-08-2008 08:40 PM |