NexusFi: Find Your Edge


Home Menu

 





LRO problem ninjatrader 8


Discussion in NinjaTrader

Updated
    1. trending_up 1,670 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?
Victory Day Delivers: Russia-Ukraine Ceasefire Market Cl …
Prediction Markets & Event Contracts
Fabrication or Framework? Irans Denied MOU Explains the …
Prediction Markets & Event Contracts
El Clasico Draws $9.2M in Prediction Market Action -- Bi …
Prediction Markets & Event Contracts
World Cup Opens: USA at 45.5% Tonight as Markets Push Ba …
Prediction Markets & Event Contracts
$500M Riding on World Cup 2026: France/Spain Co-Favored …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
8 thanks
Darmok and Jalad at Tanagra
1 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