NexusFi: Find Your Edge


Home Menu

 





LRO problem ninjatrader 8


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
lakersfan
Los Angeles, CA
 
Posts: 5 since Apr 2020
Thanks Given: 1
Thanks Received: 0

So when LRO = -1, that means that there isn't one on screen, but I am running into trouble when calling a function when it = -1.

I have an if statement:

if (intLRO> -1)
{
if (High[intLRO] >= High[intLRO-1])
{
Print("yes lro > 1 and high of lro is >= high of lro-1)"
///should only print when both are true.
}
}

However, I keep getting : Error on calling 'OnBarUpdate' method on bar 37: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.

This is in reference to (High[intLRO] >= High[intLRO-1])

However intLRO = -1

I'm cofused as to why it is firing when intLRO = -1.

FYI, this works fine on ninjatrader 7, even without having if (intLRO> -1) to catch it.


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Peace Deal Forward Curve: May 22%, June 51%, December 81 …
Prediction Markets & Event Contracts
Prediction Markets Lock Fed Pause at 99pct for April 29 …
Prediction Markets & Event Contracts
Iran Airspace Contract Surges to 33.5% as Project Freedo …
Prediction Markets & Event Contracts
CFTC Workforce Shrinks 24% to 15-Year Low While Predicti …
Traders Hideout
Kraken Becomes First US Digital Asset Bank With Direct F …
Cryptocurrency
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #2 (permalink)
 Cozy 
Albuquerque NM
 
Experience: Beginner
Platform: Ninjatrader
Trading: Emini, CL, Crypto
Posts: 5 since May 2020
Thanks Given: 0
Thanks Received: 1

If you try to call something like High[-1], that bar would be in the future. That is why ninja trader is throwing an error. If an indicator or strategy tries to access the future your profit factor will go way up for any backtest, but your strategy will not perform well when run live.


Reply With Quote




Last Updated on May 8, 2020


© 2026 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 - Downloads - Top
no new posts