![]() |
|
|||||||
| 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. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Dec 2007
Posts: 79
Thanks: 0
Thanked 0 times in 0 posts
|
How do I start a strategy in the middle of a session/day and get it to execute without regards to what my position would be if I had started the strategy at the beginning of the day?
I have read this post already. http://www.ninjatrader-support.com/v...trategy+middle |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Not sure what you mean by this. Could you elaborate?
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Dec 2007
Posts: 79
Thanks: 0
Thanked 0 times in 0 posts
|
Market has been open for 3 hours but I do not have any open positions because I just turned my computer on after sleeping in late. I start my automated strategy hoping to take advantage of the gigantic uptrending day
. After 5 minutes my strategy parameters are met and a buy should be triggered but, no order is placed because the strategy position is already long a imaginary/simulated position from earlier in the morning.How do I get njt to ignore or disregard that earlier simulated trigger. |
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
You would need to programatically change your code in the first line of OnBarUpdate()
if (Historical) return;; This will only then run on real-time data.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Dec 2007
Posts: 79
Thanks: 0
Thanked 0 times in 0 posts
|
I'm confused as to what "Immediately submit live working historical orders" accomplishes. I've read the explanation in the help guide a bunch of times and it seems like having that option selected would address my problem. Of course, I have it selected and it ain't
|
|
|
|
|
|
#6 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
It means as you start a strategy, it will calculate its current position and order state. If there are working orders it will convert these to live orders.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Member
Join Date: Dec 2007
Posts: 79
Thanks: 0
Thanked 0 times in 0 posts
|
I'm sorry but I still dont understand what that translates to a non-programmer. What exactly is a "working order"?
|
|
|
|
|
|
#8 |
|
Member
Join Date: Dec 2007
Posts: 79
Thanks: 0
Thanked 0 times in 0 posts
|
What's really throwing me for a loop is that the other option is "wait until flat before executing live" The description given in the manual seems self explanatory in that the strategy has to have no open positions before it can execute any additional orders. So... since "immediately submit live working orders" is the alternative selection, it should not wait until the strategy is flat, it should go ahead and execute any orders the strategy triggers?
|
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Jul 2007
Location: Fairfax, VA
Posts: 216
Thanks: 0
Thanked 0 times in 0 posts
|
dtf139: This area really drove me nuts when I first started using NT. In essence, regardless of how you have that option set, NT is not going to place any "real" orders when catching up on historical data after you start your strategy. What it will do, however, is adjust its own internal position so that it thinks it is long or short depending on the value of that option. I gave a few other comments after figuring out how to handle it in my own strategies here: http://www.ninjatrader-support.com/v...ead.php?t=4062
|
|
|
|
|
|
#10 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
When you run your strategy live -
- It will run a backtest on historical data - On the current bar (right most bar on a chart) your strategy may be in a position and your strategy may have a stop and target to protect the position (for example) "Immediately submit live" would submit (convert) these orders into live orders "Wait until flat" will let the strategy play out in virtual simulation (just like a backtest) until flat before executing any live orders
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#11 |
|
Member
Join Date: Dec 2007
Posts: 79
Thanks: 0
Thanked 0 times in 0 posts
|
Okay! Thanks Ray, Pete. I finally got my head around it.
|
|
|
|
|
|
#12 |
|
Member
Join Date: Dec 2007
Posts: 79
Thanks: 0
Thanked 0 times in 0 posts
|
Could someone post a screen shot or describe in detail how to use "historical" in conjunction with OnBarUpdate? I'm not a programmer and dont have a clue as to the correct syntax and where exactly to place it in the line of code.
thanks! |
|
|
|
|
|
#13 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Code:
if (Historical)
return;
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#14 |
|
Member
Join Date: Dec 2007
Posts: 79
Thanks: 0
Thanked 0 times in 0 posts
|
when you say "beginning" do you mean directly after OnBarUpdate on the same line, or on the next line down? Before or after the other lines of code that are in my strategy?
|
|
|
|
|
|
#15 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Right after the bracket.
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Save each strategy with Session Start and end times. | richa61416 | Suggestions And Feedback | 8 | 05-28-2008 11:56 PM |
| "Closes a position (left-click) or strategy (middle-click)" | whitmark | Strategy Development | 1 | 11-08-2007 12:06 PM |
| Strategy Realised Profit and Loss on session exit | richa61416 | Strategy Development | 2 | 10-09-2007 02:56 PM |
| Question about Session End time for strategy | mazachan | Strategy Development | 1 | 09-21-2007 02:23 PM |
| strategy/auto trade problem: stops/etc. initiate upon starting of strategy | scriabinop23 | Automated Trading | 14 | 05-30-2007 12:29 PM |