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 > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 02-27-2009, 07:54 PM   #1
TD-Trader747
Junior Member
 
Join Date: Dec 2008
Posts: 13
Thanks: 0
Thanked 0 times in 0 posts
Default Waiting for multiple bars...

I have this code which is supposed to execute an order when the ema crosses the middle bollenger band && price action closes 2 ticks above the outer band (I also have it cross the outer band to make sure its coming from outside the bands).

Here is the code: (real tight bands)
if (CrossAbove(EMA(Median, x), Bollinger(Median, 0.xx, xx).Lower, 1)
&& CrossAbove(EMA(Median, x), Bollinger(Median, 0.xx, xx).Middle, 1)
&& CrossAbove(Close, Bollinger(Median, 0.xx, xx).Upper, 1))

I think the last line should attempt to fill the order if the price action closes 2 ticks from the outer band.

Two questions:
1. How make the last line close between to values, say 2 and 4 ticks...
2. I want the pending order to cancel if it is not filled within 3 bars or less. Any help with the code would be great?
TD-Trader747 is offline  
Reply With Quote
Old 03-02-2009, 06:48 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,384
Thanks: 252
Thanked 967 times in 950 posts
Default

TD-Trader747, I would suggest moving to the NinjaScript editor for this advanced order placement ideas, you could for example set the order to liveUntilCancelled and then CancelOrder it after 3 bars have elapsed with no fill. If you place limit orders they will be default expire on the next on bar update call, this link provides more detail - http://www.ninjatrader-support.com/H...verview36.html

Not sure on your first question, maybe you can clarify it - thanks!
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
Waiting for execution worow@yahoo.com Automated Trading 8 02-09-2009 03:54 PM
Multiple Time Bars & Limit Orders NIKI01 Automated Trading 3 10-06-2008 07:15 AM
backtesting strategy with multiple bars does not run j0dan Strategy Development 3 04-24-2008 08:56 AM
# bars back with multiple timeframes palinuro Market Analyzer 1 04-03-2008 11:59 PM
multiple (unwanted) orders fired on 'outside' bars roxana Automated Trading 1 05-25-2007 11:13 AM


All times are GMT -6. The time now is 01:40 AM.