I will note that I've done extensive backtesting on this strategy. I also ran it in simulation for a month and everything worked fine. Hope this is an easy one.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Automation issue with TD
Collapse
X
-
Automation issue with TD
Started my live trading on TD this week with a couple of glitches. Yesterday my orders were rejected because they were GTC instead of Day. I corrected this and started anew this morning. The order fired through and executed fine. However it did not create the Profit Target or Stop Loss orders. I quickly logged into my TD account and confirmed that no other orders were created. Is there a simple reason for the non-creation of these orders? When it does work, I will be able to see these Limit orders in Ninja, correct?
I will note that I've done extensive backtesting on this strategy. I also ran it in simulation for a month and everything worked fine. Hope this is an easy one.Tags: None
-
sublime,
You will want to run your strategy with TraceOrders = true and also isolate your profit target logic with Print statements. If an order was actually placed you will get an output and a reason as to why it was rejected. Otherwise you know your code never went into that code block.Josh P.NinjaTrader Customer Service
-
I'll make sure to do that. However this worked 100% in simulation, so I'm thinking its more of a syntax or setting issue, than a logic issue.
I create the Target and Stop Loss orders in the Initialize()
SetProfitTarget("MT3QLDOpen", CalculationMode.Percent, profit);
SetStopLoss("MT3QLDOpen", CalculationMode.Percent, StopLoss, true);
and then my OnBarUpdate() calls the EnterLong as
{
EnterLong(DefaultQuantity, "MT3QLDOpen");
}
and we know its hitting the EnterLong as the Buy is executed successfully.
Comment
-
Day 2 update. So I put TraceOrders = True in my code and reviewed the Output. The output actually showed no errors, but the log told me that my account had *express trading* disabled. I fixed that at TD, but to no avail. The Buy and Sell orders are being sent to TD fine. The limit orders are not. In the Orders tab, the strategy actually created the stop order and profit target order, but did not send them to TD.
The Stop Limit order has a status of *Initialize* and the Profit target order has a status of *PendingSubmit*
I'm wondering...I have *Orders per direction* set at 1. Is that preventing them from being sent? I thought that parameter applied only to opening positions.
Any further insight?
Comment
-
Automation issue with TD
Ok... attached is a small portion of the Output log. It's a little crazy as this is a multi-timeframe, multi-instrument strategy. From a pure debugging standpoint I'm going to add logic to not even hit the trade block if a position is already open. It would cut this log down by 80%. And it looks as if the strategy thinks the position is closed, therefore it kills the stop order. But your expertise is needed.
I will also say that the initialize block has a profit and stop order per instrument. Not sure if this is a problem.
SetProfitTarget("MT3QLDOpen", CalculationMode.Percent, profit);
SetProfitTarget("MT3QIDOpen", CalculationMode.Percent, profit);
SetStopLoss("MT3QLDOpen", CalculationMode.Percent, StopLoss, true);
SetStopLoss("MT3QIDOpen", CalculationMode.Percent, StopLoss, true);
Thanks for the help guys.
Attached Files
Comment
-
Yes, the strategy ignores the the stop / target order as no position to exit from exists. Did you recheck your various signal names to match up?
Multiple SetStopLoss and SetProfitTarget calls are ok, as long as you use unique signal names per position and instrument.BertrandNinjaTrader Customer Service
Comment
-
Yes, they are unique signal names per position and instrument, however I've combined some of the redundant code which might be confusing TD. Such as:
if (BarsInProgress ==0 || BarsInProgress==2)
{
if ((MACD(BarsArray[0],12, 26, 9).Diff[0] > .02) && (MACD(BarsArray[2],12, 26, 9).Diff[0] > 0))
{
EnterLong(DefaultQuantity, "MT3QLDOpen");
}
}
The 0 and 2 BarsArray are the same instrument, just at different time periods.
I'll do two things. Simplify the code to try and avert any confusion. I'll also do a live test of a very simple strategy I have with profit and stop targets to ensure its the code and not something at TD.
I'll add that there is definitely a position to set a profit and stop price and it has not been closed. Additionally, when the close signal is triggered, the strategy successfully closes the position.Last edited by sublime; 02-12-2009, 08:17 AM.
Comment
-
sublime,
You need to step through your code and ensure the positions with the correct signal names exists at the time you place the Set() methods. From your logs it is evident you are sending Set() methods when there are no positions. Furthermore you start running into these: Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties' which suggests your signal names to be wrong earlier.Josh P.NinjaTrader Customer Service
Comment
-
Here is how I'm interpreting the Output log.
Understand that the two instruments are inverse to each other (QLD, QID) So when one instrument is approaching a buy signal, the other instrument is firing exit signals.
1. The program hits the Entry signal for QLD and buys QLD.
2. In the same bar, the program hits the ExitLong block of code for QID, however there is no position.
3. For some reason, it confuses the fact that there is no position in QID, and therefore kills the profit and target orders for the QLD position.
Even with unique names, it looks like that's what's happening.
Comment
-
Well the reason it has all the exceeds positions messages is that I don't have logic that checks to see if the strategy is already in a position. I merely kill it at the strategy window by setting "Entries per Direction" to 1. So it will continue to try and create a position as long as the entry criteria is true. It makes the log super big, so I will add that logic to not even hit the Set() if already in a position. Maybe that will clear all of it up.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by WHICKED, 03-27-2024, 12:33 PM
|
4 responses
41 views
0 likes
|
Last Post Today, 12:28 AM | ||
Started by f.saeidi, Today, 12:12 AM
|
0 responses
3 views
0 likes
|
Last Post
by f.saeidi
Today, 12:12 AM
|
||
Started by Conall, Today, 12:06 AM
|
0 responses
5 views
0 likes
|
Last Post
by Conall
Today, 12:06 AM
|
||
Started by proptradingshop, 03-21-2024, 09:50 AM
|
6 responses
27 views
0 likes
|
Last Post Today, 12:02 AM | ||
Started by mly916, Yesterday, 09:48 PM
|
1 response
12 views
0 likes
|
Last Post Yesterday, 11:54 PM |
Comment