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)
I get often frustrated by undocumented NT quirks which cause(d) me to waste a lot of time trying to find solutions.
Solutions which are often known to the more experienced coders, who are thus pestered for the same answers time and time again. So I'll you this thread to list issues and solutions I encounter(ed).
Thanks to all who helped me to the right solutions/answers.
I hope you will not be offended if I won't mention those who provided the answers.
From some issues I even honestly don't know it anymore.
It is just a friendly help from one code amateur to the next beginner.
Apparently the NT strategy wizard has a bug that doesn't like those fancy MA selectors some of the coders here made.
Solution:
Open the code and use search and replace to change:
'NinjaTrader.Indicator.MAV+MAType' into 'NinjaTrader.Indicator.MAV.MAType' (the '+' should be a '.')
I can think of a bunch of things to add to this thread, as they come up I will do so.
One thing that isn't entirely a quirk but still an issue/important is to always view your Log tab if you are having any "weird" stuff go on. I can't tell you how many times I was backtesting strategies for hours and getting odd results, only to look at my Log tab and find a slew of OutOfMemory.Exception errors. Ninja had kept quiet about them except for the log.
The log tab is very handy for a variety of other things too when writing new code.
Solution: Open the indicator (toools -> edit -> indicator) and look for the line
'PriceTypeSupported' =false'.
Change 'false' to 'true' and recompile.
Tht is all ... you should now have the choice when using the indicator.
BTW It is always wise to make a backup before editing such stuff.
I never use long and short in the same strategy anymore.
I separated all my previous strategies with combined long/short strategies into one strategy for long and a separate strategy for short.
There are potential issues that did cost me !!
Three reasons:
1 - It is easier and faster to run optimizations.
2 - Sometimes your broker might not have shares to short and rejects the order. NT will then stop the strategy.
If you have long and short separated .... at least the long strategy will keep working.
3 - Potential 'overfills'
Assume you are long in a combined long/short strategie. To get out of the long you have both an 'EnterShort' rule and an 'ExitShort' rule with different parameters. The 'ExitShort' is in the strategy to exit the strategy long position before the circumstances were met to enter a short.
I found that at times the (speed of the) price development triggered both rules in the same bar, triggering both ExitLong and EnterShort at the same time...... the effect was that NT puts me in a double short position.
I had 'entries per direction=1' and 'statements to check for Position.Long or Short' in my strategy but they were not able to prevent overfills.
Also this issue does not show up in backtesting or optimizing.
The internal order handling rules in NT should prevent your strategy to enter a second position short (if you set entries per direction =1), but apparently this does not always work. After some Emails NT told me:
"Overfills are always a possibility. The Internal Order Handling Rules are in place to reduce the overfill scenarios, but it does not 100% remove them(emphasis added). Also, since you are using market orders, the rules do not apply. You should become familiar with these risks as they generally govern things like overfills. "
I was aware of the text at the link above in the manual, but as NT beginner I apparently did not yet fully appreciate certain texts in the manual. For more details see here
if you're optimizing, you might want to keep a reference to your indicators in your strategies instead of having to search the indicator cache every time.