X

## Attention!

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

 NinjaTrader Support Forum DataSeries as Input for Indicator with CalculateOnBarClose = false

 Indicator Development Support for the development of custom indicators using NinjaScript.

01-13-2009, 07:01 PM   #1
cbaer
Member

Join Date: Jan 2008
Location: Wuppertal
Posts: 35
Thanks: 3
Thanked 0 times in 0 posts
DataSeries as Input for Indicator with CalculateOnBarClose = false

Hi,

I have problems creating an indicator that updates properly if used with CalculateOnBarClose = false.

Basically I modified a Stochastics to use different smoothing MA's:

Code:
```
K.Set(kValue); // Smooth = SlowKperiod

switch (smoothType)
{
case 1:
dValue = EMA(K, PeriodD)[0];
break;
case 2:
dValue = InstTrend(K, PeriodD)[0];
break;
default:
dValue = SMA(K, PeriodD)[0];
break;
}
D.Set(dValue); // PeriodD = SlowDperiod```
where InstTrend is my own indicator and K is basically
the DataSeries to be smoothed.
If I use CalculateOnBarClose = true everything works fine with all three indicators. Input has these values for example:

Quote:
 CurrentBar=2838: Input[0]: 13.3333,: Input[1]: 18.75, : Inpu[2]:23.5294 CurrentBar=2839: Input[0]: 18.75, : Input[1]: 13.3333, : Input[2]: 18.75 CurrentBar=2840: Input[0]: 31.25, : Input[1]: 18.75, : Input[2]: 13.3333

ES:
When using CalculateOnBarClose = false, the current value for K does not get passed on to the InstTrend Indicator and therefore the computations will be false:

Quote:
 CurrentBar=2838: Input[0]: 0, : Input[1]: 18.75, : Input[2]: 23.5294 CurrentBar=2839: Input[0]: 0, : Input[1]: 13.3333, : Input[2]: 18.75 CurrentBar=2840: Input[0]: 0, : Input[1]: 18.75, : Input[2]: 13.3333 CurrentBar=2841: Input[0]: 0, : Input[1]: 31.25, : Input[2]: 18.75

However the system indicators EMA and SMA as well use Input[0] and do not seem to have any problems, even under tick by tick processing.

What is missing?
Last edited by cbaer; 01-13-2009 at 07:16 PM.

 01-14-2009, 03:56 AM #2 NinjaTrader_Bertrand NinjaTrader Customer Service     Join Date: Sep 2008 Location: Germany Posts: 22,411 Thanks: 252 Thanked 976 times in 959 posts Hi cbaer, please try removing all CalculateOnBarClose calls in the dependent scripts / methods and use only one call in the final indicator. Bertrand NinjaTrader Customer Service Use Kinetick, NinjaTrader’s preferred market data service - Learn More Free online training events - View Schedule

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home News and Announcements     News and Announcements Application Technical Support     ATM Strategies (Discretionary Trading)     Automated Trading     Charting     Connecting     Installation and Licensing     Market Analyzer     Miscellaneous Support         Historical Version 7 Beta Threads             Critical Information - Please review             Version 7 Beta General Questions & Bug Reports         Historical NinjaTrader 6.5 Archive             Historical NinjaTrader 6.5 Beta Threads     Strategy Analyzer     SuperDOM and other Order Entry Windows NinjaScript Development Support     General Programming     Indicator Development     Strategy Development NinjaScript Educational Resources     Reference Samples     Tips NinjaScript File Sharing     NinjaScript File Sharing Discussion     Version 7 Indicators     Version 7 Strategies     Version 7 Miscellaneous Suggestions and Feedback     Suggestions And Feedback

 Similar Threads Thread Thread Starter Forum Replies Last Post OnePutt General Programming 8 04-20-2011 11:20 AM verge Strategy Development 9 07-28-2008 01:50 AM mwyatt Indicator Development 1 01-10-2008 09:31 AM Nathamus General Programming 3 08-30-2007 12:04 PM ThePatientOne Indicator Development 1 08-30-2007 11:42 AM

All times are GMT -6. The time now is 09:56 AM.

 -- Fixed Width ---- Fluid Width NinjaTrader Support Forum - Archive - Top