NexusFi: Find Your Edge


Home Menu

 





Help Defining Variables in NT Indicator Code


Discussion in NinjaTrader

Updated
    1. trending_up 2,160 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?
Asia Equities Crash Overnight -- Nikkei -5.2%, KOSPI -6. …
Traders Hideout
El Clasico Draws $9.2M in Prediction Market Action -- Bi …
Prediction Markets & Event Contracts
Hungary Called for Magyar at 97pct, Ending 16-Year Orban …
Prediction Markets & Event Contracts
UMA Votes Tonight: Polymarkets $80M Strategy Bitcoin Bat …
Prediction Markets & Event Contracts
Iran Update May 8: Still Reviewing MOU, Demands Reparati …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
23 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
2026 Fire Horse
5 thanks
  #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,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

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: 285 since Mar 2010
Thanks Given: 51
Thanks Received: 404



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