NexusFi: Find Your Edge


Home Menu

 





Help Defining Variables in NT Indicator Code


Discussion in NinjaTrader

Updated
    1. trending_up 2,399 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 resirca52009 
Indianapolis, Indiana/ USA
 
Experience: Advanced
Platform: MT4, Ninjatrader
Broker: AMP / CQG
Trading: Futures
Posts: 64 since Oct 2012
Thanks Given: 112
Thanks Received: 35

Need help determining where and how to declare the variables for this chop indicator code. I am having trouble figuring this out from the NT help guide. Code calculation below :
{
double ChopIndicator = ((100 * Log10 (sum(atr(1),14)/maxhi(14)- minlo(14)))/log10(14));
{

Does this go in the variable section, the onbarupdate section, both or neither ? Would all these be double types also ?
Confused ?
After they are defined can I call them with :
Plot0.Set(value);
Plot1.Set(value);
etc, etc,

Thanks,
Richard


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
No book, only a stair: journaling fills where price move …
Cryptocurrency
My Rant with AMP Futures
Trading Reviews and Vendors
AI for Traders — Agents, Memory, Tools & Real-Worl …
Elite Quantitative GenAI/LLM
Building a free browser DOM/SMC simulator - need some ad …
Platforms and Indicators
 
  #2 (permalink)
 
Tasker_182's Avatar
 Tasker_182 
Cedar Rapids, iowa
Legendary Market Wizard
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Ninjatrader - Continuum
Posts: 716 since Aug 2009
Thanks Given: 476
Thanks Received: 1,406


resirca52009 View Post
Need help determining where and how to declare the variables for this chop indicator code. I am having trouble figuring this out from the NT help guide. Code calculation below :
{
double ChopIndicator = ((100 * Log10 (sum(atr(1),14)/maxhi(14)- minlo(14)))/log10(14));
{

Does this go in the variable section, the onbarupdate section, both or neither ? Would all these be double types also ?
Confused ?
After they are defined can I call them with :
Plot0.Set(value);
Plot1.Set(value);
etc, etc,

Thanks,
Richard

Probably the easiest way for you to learn would be to examine the code of the NinjaTrader SMA indicator. You will see a region called variables which is where most variables would be declared. To plot your indicator you will need to add a "Plot". Looking at the SMA you will see where calculations are made with the output to "Value" using .Set.

So understand that creating a plot associates automatically with Value.

You might look a few simple NinjaTrader indicators to get a better idea. Be careful not to get into the most complicated or you will risk certain insanity.

Good luck


Be yourself; everyone else is already taken. Oscar Wilde
Reply With Quote
Thanked by:
  #3 (permalink)
 tulanch 
Salt Lake City, UT
 
Experience: Intermediate
Platform: SC, NT, MT
Broker: AMP
Trading: NQ ES YM Bonds
Posts: 286 since Mar 2010
Thanks Given: 51
Thanks Received: 405



resirca52009 View Post
Need help determining where and how to declare the variables for this chop indicator code. I am having trouble figuring this out from the NT help guide. Code calculation below :
{
double ChopIndicator = ((100 * Log10 (sum(atr(1),14)/maxhi(14)- minlo(14)))/log10(14));
{

Does this go in the variable section, the onbarupdate section, both or neither ? Would all these be double types also ?
Confused ?
After they are defined can I call them with :
Plot0.Set(value);
Plot1.Set(value);
etc, etc,

Thanks,
Richard



In onbarupdate, this is how I would do it


double value = ((100 * Log10 (sum(atr(1),14)/maxhi(14)- minlo(14)))/log10(14));
Plot0.Set(value);



do look at the other indicators as mentioned


Reply With Quote
Thanked by:




Last Updated on April 4, 2014


© 2026 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 - Downloads - Top
no new posts