Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Strategy not trading on live data, Sim account
Collapse
X
-
Strategy not trading on live data, Sim account
My strategy trades fine on historical data but today I put it on live data on the Sim account and its not trading at all? any ideas what could be causing this. Its set to calculate on bar close.Tags: None
-
Hello GKonheiser,
Are you verifying your trade signal are being hit in Real-time data? You may do this by using TraceOrders = true and using Print() statements.
Also, do you see any errors inside of the Log tab of the Control Center?
Happy to be of further assistance.JCNinjaTrader Customer Service
-
Just looked at the logs and I have a load of error relating to another strategy that I have no idea about. It is not in Custom folder and I cant see it active on any charts. The Strategy is LTStrategy, no idea where it came form, is it one that come with NT7?
When I enable a strategy on live data should I be able to see past executions, ie trades that would have been done?
With TraceOrders = true; im seeing nothing in the logs?Last edited by GKonheiser; 01-15-2014, 10:41 AM.
Comment
-
Hello GKonheiser,
Could you let me know what the full error message that you see in the Log tab?
As for your strategy that is trying to processing in real-time, can you add the TraceOrders and the Print() statements in post #2 to make sure your strategy is processing in real-time?JCNinjaTrader Customer Service
Comment
-
this is the entry in the log,
1/15/2014 5:06:01 PM Strategy The strategy 'LTStrategy/7f58c31e2d5848f4af46ebc788a2cad7' has called the Add() method with an invalid instrument. Either 'SPY' does not exist in the Instrument Manager or the specified exchange has not been configured.
Ive added TraceOrders == true;
do I need to give a specific command to allow the strategy to trade on live data?
Comment
-
Hello GKonheiser,
For the "LTStrategy" message, do you have any custom assemblies loaded inside of NinjaTrader? You may verify this by going to File -> Utilities -> Remove NinjaScript Assemblies. Alternatively, have you used this strategy in the past?
As for your strategy in real-time, there is not special code that you need to use. Let me try a different approach, if you go to the "Strategies" tab of the Control Center, what color is the cell that your Strategy name is in?JCNinjaTrader Customer Service
Comment
-
Hi JC,
I had a look at my code and this is stopping the script from trading which it doesn't on historical data:-
if(
((Instrument.Expiry.Month == 3) && (Time[0].Date.Month == 12) && (Time[0].Date.Day < iStartTradeDate))
|| ((Instrument.Expiry.Month == 3) && (Time[0].Date.Month != 12 || Time[0].Date.Month != 1 || Time[0].Date.Month != 2 || Time[0].Date.Month != 3))
|| ((Instrument.Expiry.Month == 6) && (Time[0].Date.Month == 3) && (Time[0].Date.Day < iStartTradeDate))
|| ((Instrument.Expiry.Month == 6) && (Time[0].Date.Month != 3 || Time[0].Date.Month != 4 || Time[0].Date.Month != 5 || Time[0].Date.Month != 6))
|| ((Instrument.Expiry.Month == 9) && (Time[0].Date.Month == 6) && (Time[0].Date.Day < iStartTradeDate))
|| ((Instrument.Expiry.Month == 9) && (Time[0].Date.Month != 6 || Time[0].Date.Month != 7 || Time[0].Date.Month != 8 || Time[0].Date.Month != 9))
|| ((Instrument.Expiry.Month == 12) && (Time[0].Date.Month == 9) && (Time[0].Date.Day < iStartTradeDate))
|| ((Instrument.Expiry.Month == 12) && (Time[0].Date.Month != 9 || Time[0].Date.Month != 10 || Time[0].Date.Month != 11 || Time[0].Date.Month != 12))
)
{
return;
}
I am currently trading on March contract, 3, so not sure why any statement above would equate to true, can you think why this would be?
Comment
-
Hello GKonheiser,
The following statement will be true:
So since you are using || (or command) the entire statement is true and causing your code to return.Code:((Instrument.Expiry.Month == 3) && (Time[0].Date.Month != 12 || Time[0].Date.Month != 1 || Time[0].Date.Month != 2 || Time[0].Date.Month != 3))
You may want to try to comment out that line.JCNinjaTrader Customer Service
Comment
-
Ya your right I see that now. Im going to replace it with:-
if(
((Instrument.Expiry.Month == 3) && (Time[0].Date.Month == 12) && (Time[0].Date.Day < iStartTradeDate))
|| ((Instrument.Expiry.Month == 3) && ((Time[0].Date.Month >3) && (Time[0].Date.Month <12)))
|| ((Instrument.Expiry.Month == 6) && (Time[0].Date.Month == 3) && (Time[0].Date.Day < iStartTradeDate))
|| ((Instrument.Expiry.Month == 6) && ((Time[0].Date.Month >6) && (Time[0].Date.Month <3)))
|| ((Instrument.Expiry.Month == 9) && (Time[0].Date.Month == 6) && (Time[0].Date.Day < iStartTradeDate))
|| ((Instrument.Expiry.Month == 9) && ((Time[0].Date.Month >9) && (Time[0].Date.Month <6)))
|| ((Instrument.Expiry.Month == 12) && (Time[0].Date.Month == 9) && (Time[0].Date.Day < iStartTradeDate))
|| ((Instrument.Expiry.Month == 12) && ((Time[0].Date.Month >12) && (Time[0].Date.Month <9)))
)
{
return;
}
Thanks
Comment
-
What is it for? Can you explain in English?Originally posted by GKonheiser View PostYa your right I see that now. Im going to replace it with:-
if(
((Instrument.Expiry.Month == 3) && (Time[0].Date.Month == 12) && (Time[0].Date.Day < iStartTradeDate))
|| ((Instrument.Expiry.Month == 3) && ((Time[0].Date.Month >3) && (Time[0].Date.Month <12)))
|| ((Instrument.Expiry.Month == 6) && (Time[0].Date.Month == 3) && (Time[0].Date.Day < iStartTradeDate))
|| ((Instrument.Expiry.Month == 6) && ((Time[0].Date.Month >6) && (Time[0].Date.Month <3)))
|| ((Instrument.Expiry.Month == 9) && (Time[0].Date.Month == 6) && (Time[0].Date.Day < iStartTradeDate))
|| ((Instrument.Expiry.Month == 9) && ((Time[0].Date.Month >9) && (Time[0].Date.Month <6)))
|| ((Instrument.Expiry.Month == 12) && (Time[0].Date.Month == 9) && (Time[0].Date.Day < iStartTradeDate))
|| ((Instrument.Expiry.Month == 12) && ((Time[0].Date.Month >12) && (Time[0].Date.Month <9)))
)
{
return;
}
Thanks
Comment
-
Comment
-
-
OK I think this is it,
if(
((Instrument.Expiry.Month == 3) && (Time[0].Date.Month == 12) && (Time[0].Date.Day < iStartTradeDate))
|| ((Instrument.Expiry.Month == 3) && ((Time[0].Date.Month >3) && (Time[0].Date.Month <12)))
|| ((Instrument.Expiry.Month == 6) && (Time[0].Date.Month == 3) && (Time[0].Date.Day < iStartTradeDate))
|| ((Instrument.Expiry.Month == 6) && ((Time[0].Date.Month >6) || (Time[0].Date.Month <3)))
|| ((Instrument.Expiry.Month == 9) && (Time[0].Date.Month == 6) && (Time[0].Date.Day < iStartTradeDate))
|| ((Instrument.Expiry.Month == 9) && ((Time[0].Date.Month >9) || (Time[0].Date.Month <6)))
|| ((Instrument.Expiry.Month == 12) && (Time[0].Date.Month == 9) && (Time[0].Date.Day < iStartTradeDate))
|| ((Instrument.Expiry.Month == 12) && (Time[0].Date.Month <9))
)
{
return;
}
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by sjsj2732, Yesterday, 04:31 AM
|
0 responses
33 views
0 likes
|
Last Post
by sjsj2732
Yesterday, 04:31 AM
|
||
|
Started by NullPointStrategies, 03-13-2026, 05:17 AM
|
0 responses
286 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
286 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
133 views
1 like
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
91 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|

Comment