NexusFi: Find Your Edge


Home Menu

 





Determining order of OHLC


Discussion in NinjaTrader

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




 
Search this Thread

Determining order of OHLC

  #1 (permalink)
 halliwm 
Calgary
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Piano
Posts: 2 since Mar 2013
Thanks Given: 1
Thanks Received: 0

Hi,

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.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
32 thanks
Just another trading journal: PA, Wyckoff & Trends
26 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
23 thanks
GFIs1 1 DAX trade per day journal
18 thanks
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


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
Thanked by:




Last Updated on June 26, 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