Determining order of OHLC - NinjaTrader Programming | futures trading

Go Back

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

Determining order of OHLC
Started:June 26th, 2014 (02:12 PM) by halliwm Views / Replies:309 / 2
Last Reply:June 26th, 2014 (05:35 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

Determining order of OHLC

Old June 26th, 2014, 02:12 PM   #1 (permalink)
Elite Member
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Piano
Posts: 2 since Mar 2013
Thanks: 1 given, 0 received

Determining order of OHLC


If I am trying to have an if statement determine what order the current sessions high and low occurred, would this be the correct way to build the if statement?

//if High occurred before Low
if (HighestBar(High, Bars.BarsSinceSession - 1)> LowestBar(Low, Bars.BarsSinceSession - 1))

and vice versa

//if low occurred before high
if (LowestBar(Low, Bars.BarsSinceSession - 1)> HighestBar (High, Bars.BarsSinceSession - 1))

Any help would be appreciated. Cheers.

Reply With Quote

Old June 26th, 2014, 02:12 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 June 26th, 2014, 05:35 PM   #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

If you do it this way and set the indicator/ strategy to CalculateOnBarClose = false, the indicator/strategy would perform a complex calculation with every incoming tick. However, this is creating an unnecessary CPU load.

It would be more efficient to declare two variables of type double to store the current high and low, then declare two variables of type int to store the bar count of current high and current low. You just would need check for the first bar of a session and set highCount and lowCount to 1, respectively currentHigh and currentLow to the high and low of the first bar. Then update with every new bar, if necessary.

Reply With Quote
The following user says Thank You to Fat Tails for this post:

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming > Determining order of OHLC

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
Determining Market Condition Globalabc Traders Hideout 1 April 2nd, 2014 11:17 AM
Determining the 'Last' Bar srgtroy NinjaTrader Programming 4 July 11th, 2011 10:06 PM
Determining Status Bar Text jondrus NinjaTrader 0 June 19th, 2011 02:13 PM
Determining Areas of Interest EDGE Elite Automated Trading 1 March 5th, 2011 06:14 PM
Determining range expansion for the ES (S&P eminis) aquarian1 Index Futures Trading 18 January 19th, 2011 09:11 AM

All times are GMT -4. The time now is 08:32 AM.

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-24 in 0.07 seconds with 20 queries on phoenix via your IP