![]() |
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 |
|
Member
Join Date: Mar 2012
Location: DFW, TX
Posts: 40
Thanks: 3
Thanked 7 times in 4 posts
|
I am getting the following error message in a multi-timeframe strategy:
" **NT** Error on calling 'OnBarUpdate' method for strategy 'ZLReMTF/e610e684089b44a2b751f1e4043ed90d': You must use the overload that has a 'BarsInProgress' parameter when calling the BarsSinceExit() method in the context of a multi-time frame and instrument strategy." The code associated with BarsSinceExit is: if(BarsInProgress == 0) { TimeSinceExitOK = BarsSinceExit() >= 1 || BarsSinceExit() == -1; TimeSinceEntryOK = BarsSinceEntry() >= 1 || BarsSinceEntry() == -1; } Anyone have any ideas? Rod |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,778
Thanks: 158
Thanked 565 times in 556 posts
|
Hello,
BarsSinceExit() has an overload for the barsInProgressIndex that needs to be specified in an multi series script. BarsSinceExit(int barsInProgressIndex, string signalName, int exitsAgo) For example, if(BarsSinceExit(1, "mySignal", exitago) == 1) Where 1 is the BIP
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Mar 2012
Location: DFW, TX
Posts: 40
Thanks: 3
Thanked 7 times in 4 posts
|
I must be doing something wrong...
I am getting the same error I have changed my code as follows TimeSinceExitOK = BarsSinceExit(1,"ZLRe1",0) >= 1 || BarsSinceExit(1,"ZLRe1",0) == -1;In your post, you used the barsInProgressIndex of 1. That is not the primary data, is it? |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,778
Thanks: 158
Thanked 565 times in 556 posts
|
barsInProgressIndex of 1 would be the second data series.
The primary series is 0. Do you continue to receive errors if you use 0 as the bIP Index?
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Mar 2012
Location: DFW, TX
Posts: 40
Thanks: 3
Thanked 7 times in 4 posts
|
my mistake - I had changed to '0' but I had missed one instance of BarsSinceExit in the code
problem solved thanks |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| OnBarUpdate() Error | Zeos6 | General Programming | 29 | 03-28-2011 04:02 PM |
| Error on calling OnBarUpdate | juanfer | Strategy Analyzer | 3 | 03-24-2011 10:37 AM |
| Error: OnBarUpDate cannot be null | Taddypole | Indicator Development | 1 | 02-24-2011 05:35 AM |
| Error On Calling OnbarUpdate | neb1998 | Strategy Development | 1 | 01-27-2011 02:58 PM |
| Error OnBarUpdate for strategy | eurostoxx trader | Strategy Development | 1 | 07-06-2010 06:36 AM |