NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM 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 > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 08-30-2009, 03:54 AM   #1
karimatka
Junior Member
 
Join Date: Apr 2009
Location: Prague
Posts: 7
Thanks: 0
Thanked 0 times in 0 posts
Send a message via ICQ to karimatka Send a message via Skype™ to karimatka
Default Strategy.CalculateOnBarClose=true vs. Indicator.CalculateOnBarClose=false

Hi everyone ,

I have in my strategy calculateOnBarClose = false. And I need set on my indicators calculateOnBarClose=true;

Now i have this in my code:

CalculateOnBarClose = false;
LPcurrentBidAsk.CalculateOnBarClose = false;
BBdown.CalculateOnBarClose = true;
BBup.CalculateOnBarClose = true;
SBdown.CalculateOnBarClose = true;
SBup.CalculateOnBarClose = true;
emATRdown.CalculateOnBarClose = true;
emATRup.CalculateOnBarClose = true;

,but it doesnt work :-(. All indicators are being drawn and redrawn on actual bar after each newcoming tick.

I need this for cross for 2 SMA's calculation on bar close (cross must was in bar in past). So i try use a CrossBelow(SMA1,SMA2,1) , but it still dont calculate on bar close.

Thanks for help
Kellerstein Lukas
kellersteinlukas@gmail.com
karimatka is offline  
Reply With Quote
Old 08-30-2009, 01:47 PM   #2
NinjaTrader_Austin
NinjaTrader Customer Service
 
NinjaTrader_Austin's Avatar
 
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 89 times in 81 posts
Default

Hi Kellerstein, the UI inputs for CalculateOnBarClose take priority over what is set in code. When you add the indicators to the chart, you'll need to specify CalculateOnBarClose = true in the indicator window.

If you set the strategy to COBC = false, everything in the strategy will be COBC = false, including CrossBelow(SMA1, SMA2, 1).
NinjaTrader_Austin is offline  
Reply With Quote
Old 08-31-2009, 08:44 AM   #3
karimatka
Junior Member
 
Join Date: Apr 2009
Location: Prague
Posts: 7
Thanks: 0
Thanked 0 times in 0 posts
Send a message via ICQ to karimatka Send a message via Skype™ to karimatka
Default

Hi Austin ,

So i havent in my strategy any indicator with COBC = false and any indicator with COBC = true ??
Will be in NT 7 ?

thanks
Kellerstein Lukas
karimatka is offline  
Reply With Quote
Old 08-31-2009, 08:52 AM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Kellerstein Lukas,

Sorry I am not sure I follow exactly what you are asking. COBC is already in 6.5 so it will be in 7 as well.
NinjaTrader_Josh is offline  
Reply With Quote
Old 08-31-2009, 09:39 AM   #5
karimatka
Junior Member
 
Join Date: Apr 2009
Location: Prague
Posts: 7
Thanks: 0
Thanked 0 times in 0 posts
Send a message via ICQ to karimatka Send a message via Skype™ to karimatka
Default

Josh and Austine,
I need to set global CalculateOnBarClose=false for my strategy. I need method OnBarUpdate() and all what it contains to work all the time during bar when being draw. Not only when it closes. But I need several indicators I use in my strategy to be calculated only from close prices (like I need to know the value of indicator when bar closes, not when being drawn), so to set calculateOnBarClose = true just and only for them.

The reasoning example: My first signal for the trade comes when SMA1 and SMA2 cross each other on bar close (not when bar is being drawn), but that way I have to set CalculateOnBarClose = false. The second signal is calculated from tick data. This first signal comes true when the two SMAs cross each other durin bar being just calculated (redrawn) and theat is undesirable result. I want this signal to be true only when that happens on bar close data (after bars close).
karimatka is offline  
Reply With Quote
Old 08-31-2009, 09:49 AM   #6
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

This is not possible due to a bug in 6.5 which will be resolved in 7.
NinjaTrader_Josh 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
problem CalculateOnBarClose = true in multipletimeframe strategy azuul Strategy Development 13 05-27-2009 01:10 PM
DataSeries as Input for Indicator with CalculateOnBarClose = false cbaer Indicator Development 1 01-14-2009 03:56 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
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 06:20 PM.