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?
$4.5M Floods Russia Nuclear Contract in 24 Hours -- Krem …
Prediction Markets & Event Contracts
CFTC Opens First COT Report Review in 20 Years -- Asks W …
Traders Hideout
White House Drops First Alien Files Today -- Market Says …
Prediction Markets & Event Contracts
I Have a Thing Called Iran -- Trump Stays in DC as Airsp …
Prediction Markets & Event Contracts
Saylors 41-Month HODL Breaks: Strategy Sells 32 BTC as $ …
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