NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 03-05-2012, 09:09 AM   #1
coolmoss
Senior Member
 
Join Date: Dec 2007
Posts: 365
Thanks: 36
Thanked 29 times in 25 posts
Default Range bars, strategy and close on bar

Hi,

I've got some screwy looking behaviour, but maybe I just don't understand how the chart is supposed to work. I have a Range period selected, I have a strategy which plots signal markers on the chart, and the strategy is set to calc on end on bar close.

I noticed that once the bar has achieved the full range (eg. a 4 tick range bar gets to 4 price levels) but has yet to actually close (meaning a new bar has not yet started) the signal marker from the the strategy plots on the chart.

This causes major problems. For example, in the case I observed this morning, I had a short signal plot once the full range of the bar plotted, but then the bar went from being at the low tick to the high tick, exited through the high, and thus created a new bar. But, I was left with the short signal. Once I refreshed the NinjaScript, the marker from the Strategy, correctly, no long showed.
coolmoss is offline  
Reply With Quote
Old 03-05-2012, 10:21 AM   #2
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello coolmoss,
Thanks for writing in and I am happy to assist you.

In case of a range bar a new bar will be formed only if a new bar crosses the range high/low. Simply touching the high or low of the range do not mean a new bar will be formed. A bar can hit the low and from there can move in the opposite direction and crosses the high to form a new bar.

A bar closing event is basically equals to the opening event of the next bar.

Please let me know if I can assist you any further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 03-05-2012, 10:26 AM   #3
coolmoss
Senior Member
 
Join Date: Dec 2007
Posts: 365
Thanks: 36
Thanked 29 times in 25 posts
Unhappy

You're description fits my understanding of how it should work, but this is not how Ninja is functioning. As I stated above, I have a strategy which executed an action before the bar closes, yet the strategy was set to calculate on bar close.

What might be wrong here?

Thanks.

Edit:

I am noticing some strange things in the Orders tab. Watching live data, my signal plots, the correct orders are submitted (based on the Orders tab), and price trades well through the Stop price on the order, but the order is never actually filled (on sim acct). If I refresh to chart, then it shows up historically.

I can't imagine what I'm doing wrong in the setup, it's not that hard
Last edited by coolmoss; 03-05-2012 at 10:41 AM.
coolmoss is offline  
Reply With Quote
Old 03-05-2012, 11:00 AM   #4
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello coolmoss,
Is your strategy calling any indicator which is explicitly assigned as CalculateOnBarClose = false?

Are you submitting limit order or market order?

Can you provide us with a sample code which reproduces the issue? You can send your code to support[AT]ninjatrader[DOT]com and please write Attn:Joydeep in the subject line of the email and please do give a reference of this thread in the body of the email.

I look forward to assisting you further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 03-05-2012, 11:39 AM   #5
coolmoss
Senior Member
 
Join Date: Dec 2007
Posts: 365
Thanks: 36
Thanked 29 times in 25 posts
Default

I feel like an idiot. 30 lashes to coolmoss. Let say my alter-ego changed the strategy to calc on close to False. I just don't know how I could have done that.

My bad, but thanks for such great support.
coolmoss is offline  
Reply With Quote
Old 03-05-2012, 12:04 PM   #6
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello coolmoss,
Glad you could found a solution.
Please let me know if I can assist you any further.
NinjaTrader_Joydeep 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
Range bar close price chakriare Indicator Development 1 06-24-2011 08:21 AM
Buy at the close of Range bar chakriare Strategy Development 1 06-24-2011 07:34 AM
Highest Bar in an earlier range of bars Light General Programming 6 01-26-2010 01:28 PM
Predict RSI value on the range bar close nandu Indicator Development 1 01-20-2010 04:31 AM
Close[1] acts on wrong range bar Operandi Strategy Development 11 01-23-2009 07:10 AM


All times are GMT -6. The time now is 11:25 PM.