NexusFi: Find Your Edge


Home Menu

 





LRO problem ninjatrader 8


Discussion in NinjaTrader

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




 
Search this Thread

LRO problem ninjatrader 8

  #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?
Quantum physics & Trading dynamics
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
REcommedations for programming help
Sierra Chart
Cheap historycal L1 data for stocks
Stocks and ETFs
 
  #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


© 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