NinjaTrader Support Forum  
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


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

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

Reply
 
Thread Tools Display Modes
Old 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
Default 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.
cbaer is offline  
Reply With Quote
Old 01-14-2009, 03:56 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
Default

Hi cbaer, please try removing all CalculateOnBarClose calls in the dependent scripts / methods and use only one call in the final indicator.
NinjaTrader_Bertrand is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

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 Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Identifying Close of Bar when CalculateOnBarClose = false OnePutt General Programming 8 04-20-2011 11:20 AM
what really happens when calculateonbarclose = false verge Strategy Development 9 07-28-2008 01:50 AM
MACD CalculateOnBarClose=false mwyatt Indicator Development 1 01-10-2008 09:31 AM
custom Dataseries as indicator input, or input to indi through underlying strategy Nathamus General Programming 3 08-30-2007 12:04 PM
Indicator line goes to zero when CalculateOnBarClose set to True ThePatientOne Indicator Development 1 08-30-2007 11:42 AM


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