Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
No it wasn't... that error was in a sample code, and I mentinoed the fix in the post before.
I was going to make another post on your forum (NT support), but I gave up. However here is what I found, and I think it strongly supports a bug in NT:
Using the format if (time xxx) { if (strategy / time) { order } } is the only way it will function
It will correctly execute the time on some contracts, and not others. Why is this? Bug in the ninjascript?
On the contracts where the time clause does not function, it only ignores the <= timeofday clause. In other words, it starts trades at the beginning of the time period, and goes to the close - not the end of the time period.
"A Jedi's strength flows from the force."
-Yoda
Can you help answer these questions from other members on NexusFi?
I see, thanks for clarifying. I have since re-read the thread. Two issues I see here. One is your comments on how to evaluate time which is independent from the second issue about orders submitting on some contracts and not on others.
- Time evaluation is simple to isolate, take the order submission out of the "If time condition" and place Print() statements. If you get print statements on bars that you should not be included in the time condition then there must be something wrong with the time condition. We have run tests here on our ToTime() and Time[] (which returns a .NET DateTime structure (not our code) and it works as expected.
Once the time conditions are created and working as expected (without any order submission code) then you can add back in order submission methods. If this is now not working as expected, then likely it has something to do with your strategy order handling settings? That is the first place I would like and I would also enable TraceOrders = true since this will print out any reason why an order submission method is ignored to the NinjaScript Output window.
You have written a dirty piece of code with a few bugs and you are complaining about NinjaTrader by making a lot of noise. Did you realize that ?
Actually all those commands are not NinjaScript, but C#, and it would be enough to have a look at the MSDN Library, where these commands are explained. See below
NinjaTrader may have a few little bugs (all software packages that I know have them), but they are more subtle and will not affect any simple strategies.
I've been a supporter of Ninjatrader, and have persuaded friends to go with it over other retail platforms... there is a bug in this however. Let me know which code is dirty - unless if you're referring to the cursory example I put in the bullet list, I obviously did not write the whole thing for the sake of time and continuity. I hope it's also obvious to you what my point is (wrapping the ToTime in one if statement versus individual if statements).
I think it's generally well accepted around the board that NT has many bugs, most of them little (such as this apparent one... see my bullet list before attacking me on this) but some of them quite large. I often get the impression that working for NT is stressful, with poor team development and a management that brings the hammer down on them when things don't go their way. A few posts around here have mentioned the performance of strategy development in NT versus how many developers work there. Just my opinion, though.
I still think it's the best retail platform out there for retailers, especially considering the limitations with Easy-Language, and oft-cited poor performance with IB and some other products out there. I'm really looking forward to NT8 - even though they don't have the slightest idea of when it will be ready, and even though it probably won't be around until next year, even if they are planning on it sooner. Software is tough - if Apple has problems with Final Cut and can't get Lion out without big stress on employees (friends)...
@patbateman: If a strategy does not work, best you export it and attach it here, then it is more easy to see, where the problem lies. This is what you have published on the NinjaTrader forum:
Just a few comments. Line 1 is already false, as this would normally trigger a long entry with each single bar, if one moving average is above the other, the correct code for a cross entry would be
You were just luckky that NinjaTrader did only take one entry per direction. Maybe you specified this somewhere in the Intialize section, which you did not post. Anyhow the code is not correct.
There is a bug in line 3, as you used ">=" instead of "<="
Line 7 is false in the same way as is line 1.
The whole logic used is false. If you enter a position, if there is a long cross during the specified time interval, and you exit a position for a short cross in that same time interval, then you will end up with a long position, if the last cross was a long cross, and that long position will be held until the close - unless you have disabled ExitOnClose, in that case the position will be held until the next working day.
Two logical errors and a bug, that strategy for sure cannot work correctly.
I also posted two other strategies (one here) that are uploaded and do not work in NT. No bugs in them!
You probably missed my post which is fine, so now you know. The reality however is the bug is prevalent and I'm still working on trying to possibly rid it myself. I will reset the instruments, then reinstall today to see what happens. My bullet list above outlines exactly what happens.
Btw, you don't have to, but since you're going over my code, make your own sample strategy to see how NT functions to this (if you have not already).
I also posted two other strategies (one here) that are uploaded and do not work in NT. No bugs in them!
You probably missed my post which is fine, so now you know. The reality however is the bug is prevalent and I'm still working on trying to possibly rid it myself. I will reset the instruments, then reinstall today to see what happens. My bullet list above outlines exactly what happens.
Btw, you don't have to, but since you're going over my code, make your own sample strategy to see how NT functions to this (if you have not already).
Here's an example
namespace NinjaTrader.Strategy
{
public class a0test : Strategy
{
#region Variables
#endregion
If you want to know, which value a specific variable took, while the indicator was running, you can print those values to the NinjaTrader output window.
Just open that window and watch how the values are being printed.