NexusFi: Find Your Edge


Home Menu

 





NT Quirks for beginners


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Peter with 4 posts (2 thanks)
    2. looks_two Big Mike with 1 posts (0 thanks)
    3. looks_3 wh with 1 posts (1 thanks)
    4. looks_4 koganam with 1 posts (0 thanks)
    1. trending_up 3,349 views
    2. thumb_up 4 thanks given
    3. group 4 followers
    1. forum 7 posts
    2. attach_file 0 attachments




 
Search this Thread

NT Quirks for beginners

  #1 (permalink)
 
Peter's Avatar
 Peter 
Brisbane; Australia
 
Experience: Intermediate
Platform: NT
Broker: IB/TDA needing new broker
Trading: Futures, Forex, Stocks
Posts: 97 since Jun 2009
Thanks Given: 91
Thanks Received: 118

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.

Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
MC PL editor upgrade
MultiCharts
Trade idea based off three indicators.
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
19 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
  #2 (permalink)
 
Peter's Avatar
 Peter 
Brisbane; Australia
 
Experience: Intermediate
Platform: NT
Broker: IB/TDA needing new broker
Trading: Futures, Forex, Stocks
Posts: 97 since Jun 2009
Thanks Given: 91
Thanks Received: 118

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 '.')

Started this thread Reply With Quote
Thanked by:
  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,440 since Jun 2009
Thanks Given: 33,214
Thanks Received: 101,599


Nice topic, Peter.

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.

Mike

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 
Peter's Avatar
 Peter 
Brisbane; Australia
 
Experience: Intermediate
Platform: NT
Broker: IB/TDA needing new broker
Trading: Futures, Forex, Stocks
Posts: 97 since Jun 2009
Thanks Given: 91
Thanks Received: 118

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.

Started this thread Reply With Quote
  #5 (permalink)
 
wh's Avatar
 wh 
Neubrandenburg, Germany
 
Experience: Advanced
Platform: R
Trading: Stocks
Posts: 538 since Jun 2009
Thanks Given: 298
Thanks Received: 512


Peter View Post
Apparently NT 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 '.')

The dot is for basic C # and Ninja Script Object oriented work (Objects).
The plus stands for a concatenation of strings and numbers (variables).

Quick Example is
double what = Namespace.Indicator.Method.DoubleVariable + Namespace.Enum.MaType.EMA(Close[0])

Reply With Quote
Thanked by:
  #6 (permalink)
 
Peter's Avatar
 Peter 
Brisbane; Australia
 
Experience: Intermediate
Platform: NT
Broker: IB/TDA needing new broker
Trading: Futures, Forex, Stocks
Posts: 97 since Jun 2009
Thanks Given: 91
Thanks Received: 118

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

Started this thread Reply With Quote
  #7 (permalink)
koganam
Garner, NC/USA
 
Posts: 39 since Dec 2009
Thanks Given: 16
Thanks Received: 42

If you want to use "PriceTypeSupported, remember to change any reference to a price point (OHLC) to "Input".

For example: "SMA(Close, 10)" should be changed to "SMA(Input, 10)".



Peter View Post
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.


Reply With Quote
  #8 (permalink)
piersh
California
 
Posts: 87 since Jun 2009
Thanks Given: 5
Thanks Received: 120

here's one:

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.

For example, instead of doing
 
Code
                            
protected override void Initialize() 

{
    
Add (EMA (Input20));
}

protected 
override void OnBarUpdate () 
{
    
double someValue EMA (Input20) [0];

you can do this:
 
Code
                            
EMA _ema;


protected 
override void Initialize() 
{
    
Add (_ema EMA (Input20));
}

protected 
override void OnBarUpdate () 
{
    
double someValue _ema [0];


Reply With Quote
Thanked by:




Last Updated on January 4, 2010


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts