List.RemoveAt - NinjaTrader Programming | futures io social day trading
futures io futures trading


List.RemoveAt
Updated: Views / Replies:1,808 / 5
Created: by SerCava Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

List.RemoveAt

  #1 (permalink)
Elite Member
Madrid + Spain
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: CMC/Kinetick
Favorite Futures: Forex
 
Posts: 5 since May 2012
Thanks: 8 given, 1 received

List.RemoveAt

Hi all!

Anyone know how to use List.RemoveAt(index)?

I'm using:

 
Code
list.RemoveAt(Count-1);
but putting the indicator in the chart the log says...

 
Code
Error on calling 'OnBarUpdate' method for indicator 'SercavaEnvelope4' on bar 86: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
I'm confused: If you have a list, you always have list[Count-1]

Commenting that line gives no error. Perhaps is a method too new? (is new for 2.0 .NET Framework)

Thanks in advance,

Sergio

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,602 received
Forum Reputation: Legendary


@SerCava:

It is difficult to find an error, if you just post one line. What is "list"? How many elements has "list"?

NinjaTrader uses 2 variables for the BarsArray[] object.

CurrentBar: The first bar has the index CurrentBar = 0. The last bar in the data base typically has the value CurrentBar = Count -1, if the indicator is set to CalculateOnBarClose = true, the indicator value for the last bar is not plotted, meaning that the last indicator value shown corresponds to CurrentBar = Count -2.

When OnBarUpdate() is executed it starts with CurrentBar = 0, and then makes one iteration for each historical bar. On real-time bars it will make one iteration, if the indicator is set to CalculateOnBarClose = true, otherwise it will make one iteration with every incoming tick.

Count - 1 usually holds the integer equal to the total number of bars of the BarsArray loaded, while CurrentBar steps up with each iteration until it reaches the value Count-2 (CalculateOnBarClose = true) or Count-1 (CalculateOnBarClose = false).

Reply With Quote
 
  #4 (permalink)
Elite Member
Atkinson, NH USA
 
Futures Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker/Data: NinjaTrader Brokerage
Favorite Futures: Futures, CL, ES, ZB
 
NJAMC's Avatar
 
Posts: 1,925 since Dec 2010
Thanks: 2,962 given, 2,294 received


SerCava View Post
I'm confused: If you have a list, you always have list[Count-1]

Commenting that line gives no error. Perhaps is a method too new? (is new for 2.0 .NET Framework)

Thanks in advance,

Sergio

@SerCava,

If I would guess, you need to check to see if "Count==0", this could create a negative index (which doesn't exist yet).

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Reply With Quote
 
  #5 (permalink)
Elite Member
Milan Italy
 
Futures Experience: Intermediate
Platform: Ninjatrader, Sierra Chart
Favorite Futures: ES
 
Posts: 523 since Feb 2010
Thanks: 470 given, 629 received

As FatTails says, it's hard to tell from one line. But perhaps you mean to have:

List.RemoveAt(List.Count-1)

In NT, "Count", by itself, refers to the total # of bars.

Reply With Quote
The following user says Thank You to futuretrader for this post:
 
  #6 (permalink)
Elite Member
Madrid + Spain
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: CMC/Kinetick
Favorite Futures: Forex
 
Posts: 5 since May 2012
Thanks: 8 given, 1 received


futuretrader View Post
As FatTails says, it's hard to tell from one line. But perhaps you mean to have:

List.RemoveAt(List.Count-1)

In NT, "Count", by itself, refers to the total # of bars.

That was! Thanks. Sometimes you don't find the problem.... and I was using List.Count in other parts of the code, except in that line.

Thanks for all replies,

Sergio

Reply With Quote

Reply



futures io > > > > > List.RemoveAt

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fibonacci Numbers List Big Mike Traders Hideout 3 October 9th, 2015 09:42 AM
Whats on your wish list incometrade Off-Topic 10 December 16th, 2011 01:28 PM


All times are GMT -4. The time now is 04:50 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-18 in 0.10 seconds with 19 queries on phoenix via your IP 54.221.136.62