Basic Indicator Issues - futures io
futures io futures trading



Basic Indicator Issues


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Big Mike with 1 posts (1 thanks)
    2. looks_two Fat Tails with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 halliwm with 1 posts (0 thanks)
    1. trending_up 819 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Basic Indicator Issues

(login for full post details)
  #1 (permalink)
Calgary
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Piano
 
Posts: 2 since Mar 2013
Thanks: 1 given, 0 received

Hi, I have been trying to create a simple indicator that takes the amount of time in a period before the latest low and a high and charts it. Basically it is ((period - bars since high/low)/period)*100. I am having trouble getting it to plot, it just shows up as flat line at 0. I also tried to print the values but I get nothing.

I've included the code below but I also have a question about DataSeries. Do I need to create a DataSeries for the indicator values to be stored in? and if not what types of indicators do you use it for? And lastly I am determining which bar out of the period contains the high or low through a for loop. Is there a better method to finding those bar index's? Cheers and thanks in advance.



// Wizard generated variables
private int numPeriod = 1; // Default setting for NumPeriod

// User defined variables (add any user defined variables below)
private double outputHigh;
private double outputLow;
private int highIndex;
private int lowIndex;
private double highest;
private double lowest;



protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.LimeGreen), PlotStyle.Line, "HighOutput"));
Add(new Plot(Color.FromKnownColor(KnownColor.Maroon), PlotStyle.Line, "LowOutput"));
Overlay = false;
CalculateOnBarClose = false;
}

protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.

if (CurrentBar<numPeriod)
{
return;
}

else
{
// first needs to find how many bars since high and low and store them in their respective variables.

//Could do a for loop to determine index position of high and low

//Assumes current bar has high/low
highest=CurrentDayOHL().CurrentHigh[0];
lowest=CurrentDayOHL().CurrentLow[0];

for (int i=1; i<numPeriod; i++)
{
if (Bars.GetDayBar(i).High > highest)
{
highest=Bars.GetDayBar(i).High;
highIndex=i;

}
if (Bars.GetDayBar(i).Low<lowest)
{
lowest=Bars.GetDayBar(i).Low;
lowIndex=i;
}

}

//store in respective output variables
outputHigh=((numPeriod-highIndex)/numPeriod)*100;
outputLow=((numPeriod-lowIndex)/numPeriod)*100;



//set plots
HighOutput.Set(outputHigh);
LowOutput.Set(outputLow);

}

}

Started this thread Reply With Quote

 
 
(login for full post details)
  #3 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,728 received


You would need to attach your entire indicator file. This is too difficult to read and noone can test it for bugs.

To attach files you will probably need a few more posts (I think it was 5 posts that are required).

Reply With Quote
 
(login for full post details)
  #4 (permalink)
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,779 since Jun 2009
Thanks: 32,306 given, 97,566 received


Fat Tails View Post
To attach files you will probably need a few more posts (I think it was 5 posts that are required).

Everyone can attach files from post 1. You can't embed URL's with < 5 posts.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to Big Mike for this post:


futures io Trading Community Platforms and Indicators NinjaTrader > Basic Indicator Issues


Last Updated on February 19, 2015


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts