Basic Indicator Issues - NinjaTrader Programming | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming

Basic Indicator Issues
Started:February 18th, 2015 (12:24 PM) by halliwm Views / Replies:304 / 3
Last Reply:February 19th, 2015 (01:45 PM) Attachments:0

Welcome to

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

Basic Indicator Issues

Old February 18th, 2015, 12:24 PM   #1 (permalink)
Elite Member
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Piano
Posts: 2 since Mar 2013
Thanks: 1 given, 0 received

Basic Indicator Issues

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)

// 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

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

if (Bars.GetDayBar(i).Low<lowest)


//store in respective output variables

//set plots



Reply With Quote

Old February 18th, 2015, 12:24 PM   #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.


Old February 19th, 2015, 03:19 AM   #3 (permalink)
Elite Member
Berlin, Europe
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
Fat Tails's Avatar
Posts: 9,525 since Mar 2010
Thanks: 4,213 given, 24,787 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

Old February 19th, 2015, 01:45 PM   #4 (permalink)
Site Administrator
Manta, Ecuador
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
Big Mike's Avatar
Posts: 45,432 since Jun 2009
Thanks: 28,836 given, 79,555 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.


Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following user says Thank You to Big Mike for this post:

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming > Basic Indicator Issues

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

An Afternoon with FIO trader bobwest

Elite only

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
NT indicator disappearing issues? mojord NinjaTrader 6 March 21st, 2014 03:47 AM
Basic NinjaScript Help Joseph689 NinjaTrader Programming 2 October 28th, 2013 05:48 PM
Adding a Bollinger Band to a CCI indicator issues NinjaTrader 0 May 8th, 2012 06:49 PM
TS / MC : Basic Indicator Help? Micardo EasyLanguage Programming 2 February 27th, 2011 11:30 AM
SwingTemp Indicator Issues RJay NinjaTrader 5 October 13th, 2010 02:13 PM

All times are GMT -4. The time now is 10:01 PM.

Copyright © 2016 by 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

Page generated 2016-10-21 in 0.09 seconds with 19 queries on phoenix via your IP