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 > Strategy Development

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

Reply
 
Thread Tools Display Modes
Old 08-06-2007, 11:09 AM   #1
dgregor5
Senior Member
 
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
Default BarsSinceExit()

Hello

I am trying to implement something in the code which I thought would be somewhat simple, i.e.

if ('condition 1'
&& 'condition 2'
&& 'condition 3'
&& BarsSinceExit() > 0)

EnterShort()

Basically when entering the 'BarsSinceUpdate()' command I get zero orders executed.....removing this line & things go back to normal.


Clearly the code I have is a little more complicated than the above, but the principle is the same.

Any ideas as to where I could be going wrong?

thx
David
dgregor5 is offline  
Reply With Quote
Old 08-06-2007, 11:22 AM   #2
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

Unfortunately we are unable to review actual strategies for bandwidth reasons. NinjaScript consultants are available to help program your custom indicators/strategies or to help our users throughout their learning curve. Additional information is located here: http://www.ninjatrader.com/webnew/pa...injaScript.htm

Here is a quick hint:
As I "hit the wall" on some unexpected strategy behavior I usually try to isolate the cause of trouble by building a "simple as possible" variation of my strategy to see if that works as expected. As it does, I add condition by condition to locate where my logic (or the NT framework ?!?) breaks.

In your case I would start and try something like
Print (BarsSinceEntry())
to see if you get the results you would expect.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 08-06-2007, 12:40 PM   #3
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Just a hunch. Maybe try BarsSinceExit() >= 1? That shouldn't make a difference though hmm. No errors in logs?
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


All times are GMT -6. The time now is 07:38 AM.