![]() |
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
|
|||||||
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Oct 2007
Posts: 72
Thanks: 0
Thanked 0 times in 0 posts
|
Hi, maybe this is not a NT 6.5 specific issue, but I noticed it in NT 6.5.
As you can see in the attached picture, my strategy failed get out at the top of a trend, at around $0.7900 even though the strategy placed a Gtc limit order that should have filled the *next day*. If the order type is a day order, this behavior is perfectly reasonable, but I see Time in force value set to Gtc in the Backtest window. As you can see from order trace, the limit sell order was entered successfully for Jan 22. So I am confused on whether I really understand how Gtc order works in NT. 1/22/2007 12:00:00 AM Entered internal PlaceOrder() method at 1/22/2007 12:00:00 AM: Action=Sell OrderType=Limit Quantity=1 LimitPrice=0.7921 StopPrice=0 SignalName='' FromEntrySignal='' 1/22/2007 12:00:00 AM Entered internal PlaceOrder() method at 1/22/2007 12:00:00 AM: Action=SellShort OrderType=Limit Quantity=1 LimitPrice=0.7921 StopPrice=0 SignalName='' FromEntrySignal='' 1/23/2007 12:00:00 AM Entered internal PlaceOrder() method at 1/23/2007 12:00:00 AM: Action=SellShort OrderType=Limit Quantity=1 LimitPrice=0.7921 StopPrice=0 SignalName='' FromEntrySignal='' 1/26/2007 12:00:00 AM Entered internal PlaceOrder() method at 1/26/2007 12:00:00 AM: Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal='' |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Did you also set the Exit On Close setting to false?
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Oct 2007
Posts: 72
Thanks: 0
Thanked 0 times in 0 posts
|
Yes. In fact, it would not even enter into any position unless ExitOnClose is false.
|
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Are you also using the liveUntilCancelled set to true?
EnterLongLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, string signalName) Code:
EnterLongLimit(0, true, 1, Low[0], "");
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Oct 2007
Posts: 72
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks Josh. I got the same result with
EnterLongLimit(0, true, 1, limitPrice, ""); In fact, I seem to get a fill only with Gtc and closeAtEndOfDay = false, but this order behaves like Day order. Quite bizzare... Is it because I am using 1440 minute bar? |
|
|
|
|
|
#6 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
It shouldn't matter what minute chart you are running. Please try my attached test strategy. It will submit an order that should never be filled and will stay active. Running it in the Strategy Analyzer and bringing up the Orders tab will confirm this.
If the test strategy works for you then there has to be something your strategy is doing to cause behavior you are seeing. You will need to debug.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Member
Join Date: Oct 2007
Posts: 72
Thanks: 0
Thanked 0 times in 0 posts
|
Josh thanks for the file. I ran it against the same data set and indeed the strategy did not fill. When I turned around and thought about the implication though, I am not sure how this fact relates to my problem, which is that my order is NOT filled. Originally, I was using Day order, and got the following traces:
12/19/2007 12:00:00 AM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Ticks Value=87 Currency=0 Simulated=False 12/19/2007 12:00:00 AM Entered internal PlaceOrder() method at 12/19/2007 12:00:00 AM: Action=Buy OrderType=Limit Quantity=1 LimitPrice=0.8517 StopPrice=0 SignalName='' FromEntrySignal='' 12/19/2007 12:00:00 AM Cancelled order due to end of session handling: BarsInProgress=0: Order='NT-00100/Back101' Name='Buy' State=Working Instrument='$AUDUSD' Action=Buy Limit price=0.851748563432997 Stop price=0 Quantity=1 Strategy='TRADStrategy' Type=Limit Tif=Day Oco='' Filled=0 Fill price=0 Token='1b7172f6474140cd9c44b6aafe5d2c25' Gtd='12/1/2099 12:00:00 AM' As you can see, the order is cancelled as soon as it is entered because 12:00 AM is considered the end of the day. This is why I started looking into the Gtc order, even though that's not really what I want. Now if we take a step back and think about how a typical Day order works when testing with daily historical data (using OpenTick for example), I believe that if I place an order on 12/19, when the bar is complete, the order will show up in the simulator (or the market too if I were trading for real?) the next day, 12/20. This behavior seems logical and different than what I am seeing with 1440 minute bars. I am happy to debug my program. I just want us to be on the same page about where to look first before I look at my program, which behaves fine on historical daily data. Does this sound reasonable? -Henry |
|
|
|
|
|
#8 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
I guess the point is that the sample strategy Josh provided demonstrates that GTC in fact really does not cancel at the end of the day. If this is true, then the next step is to debug your code to try and isolate what is causing the unexpected behaviour.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Also curious as to why you use 1440 min bars? Why don't you just use daily bars?
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#10 |
|
Member
Join Date: Oct 2007
Posts: 72
Thanks: 0
Thanked 0 times in 0 posts
|
I would love to use daily bars. But you (or Gain) don't provide historical bar. Since there are 1440 minutes in a day in FX, 1440 minute bar is a poor man's daily bar. I would really appreciate having a daily bar (that I can specify the start and stop time of), so please let me know if and when you do have it.
-Henry |
|
|
|
|
|
#11 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Thanks for the suggestion. We'll put it on the list.
Josh
NinjaTrader Customer Service |
|
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Backtest won´t work on Indices - solved by recreating the Index as a Stock. | tomcat | Strategy Analyzer | 5 | 03-23-2010 06:24 AM |
| Strategy won't backtest... | maxpi | Strategy Analyzer | 3 | 11-29-2007 08:09 AM |
| Backtest Problems v6.5 | AO76 | Strategy Analyzer | 1 | 11-11-2007 02:47 PM |
| Backtest not available | BradB | Strategy Analyzer | 9 | 11-10-2007 09:41 PM |
| stoploss and MAE in backtest | ceesvh | Strategy Analyzer | 8 | 07-12-2007 08:02 AM |