NexusFi: Find Your Edge


Home Menu

 





Help Defining Variables in NT Indicator Code


Discussion in NinjaTrader

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




 
Search this Thread

Help Defining Variables in NT Indicator Code

  #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?
ZombieSqueeze
Platforms and Indicators
REcommedations for programming help
Sierra Chart
Trade idea based off three indicators.
Traders Hideout
Better Renko Gaps
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
  #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,401


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: 265 since Mar 2010
Thanks Given: 50
Thanks Received: 387



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


© 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