help creating a list. - NinjaTrader Programming | futures io social trading
futures io futures trading


help creating a list.
Updated: Views / Replies:266 / 9
Created: by kidvic Attachments:0

Welcome to futures io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • 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, and we will never resell your private information.

-- Big Mike

Reply
 
Thread Tools Search this Thread
 

help creating a list.

  #1 (permalink)
Trading for Fun
Los Angeles, CA
 
Futures Experience: Intermediate
Platform: NinjaTrader, ThinkOrSwim
Favorite Futures: Options, Futures
 
Posts: 92 since Mar 2015
Thanks: 13 given, 2 received

help creating a list.

hi.
if i have int = 20,

how do i get the close of int candles? (the last 20)

so it would get me Close[20], Close[19], Close[18] etc until Close[0]?

Thanks in advance.


Last edited by kidvic; July 27th, 2016 at 10:01 PM. Reason: clarification
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
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 1,970 since Sep 2013
Thanks: 1,388 given, 2,951 received
Forum Reputation: Legendary


yes, correct
where [0] is most recent

Reply With Quote
 
  #4 (permalink)
Trading for Fun
Los Angeles, CA
 
Futures Experience: Intermediate
Platform: NinjaTrader, ThinkOrSwim
Favorite Futures: Options, Futures
 
Posts: 92 since Mar 2015
Thanks: 13 given, 2 received


rleplae View Post
yes, correct
where [0] is most recent


Sorry I wasnt clear, I want to creat a list.

not just int, so that the list contains the values.

so lets say int is 40, then it would enumerate (populate a list) 40 values of what I want it to calculate.

it would then keep those values, for when I call on them.

so lets say there was a true on when the value was 30 (of the 40),
then it would give that value.

Reply With Quote
 
  #5 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 1,970 since Sep 2013
Thanks: 1,388 given, 2,951 received
Forum Reputation: Legendary

This is probably what you want to do :

 
Code
// create a list of int
List<int> myCloseList = new List<int>();

// store the last 20 Close prices in the list
for (int i = 0; i < 20; i++)
{
    myCloseList.Add(Close[i]);
}

Reply With Quote
 
  #6 (permalink)
Trading for Fun
Los Angeles, CA
 
Futures Experience: Intermediate
Platform: NinjaTrader, ThinkOrSwim
Favorite Futures: Options, Futures
 
Posts: 92 since Mar 2015
Thanks: 13 given, 2 received


rleplae View Post
This is probably what you want to do :

 
Code
// create a list of int
List<int> myCloseList = new List<int>();

// store the last 20 Close prices in the list
for (int i = 0; i < 20; i++)
{
    myCloseList.Add(Close[i]);
}

Thank you, this is exactly!, now how do I retrieve out of that list, all the ones that had high of 45.00 or greater?

Reply With Quote
 
  #7 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 1,970 since Sep 2013
Thanks: 1,388 given, 2,951 received
Forum Reputation: Legendary

(The list can be a list of a class and then you can
store various information in every record.)

 
Code
// create a list of int
List<int> myCloseList = new List<int>();

// store the last 20 Close prices in the list
for (int i = 0; i < 20; i++)
{
    myCloseList.Add(Close[i]);
}

// second logic
for (int i= 0; i < myCloseList.Count; i++)
{
 if (myCloseList[i] > 45
  Print("Found record : "+i+" with Close "+Close[i]);
}

Reply With Quote
 
  #8 (permalink)
Trading for Fun
Los Angeles, CA
 
Futures Experience: Intermediate
Platform: NinjaTrader, ThinkOrSwim
Favorite Futures: Options, Futures
 
Posts: 92 since Mar 2015
Thanks: 13 given, 2 received


rleplae View Post
(The list can be a list of a class and then you can
store various information in every record.)

 
Code
// create a list of int
List<int> myCloseList = new List<int>();

// store the last 20 Close prices in the list
for (int i = 0; i < 20; i++)
{
    myCloseList.Add(Close[i]);
}

// second logic
for (int i= 0; i < myCloseList.Count; i++)
{
 if (myCloseList[i] > 45
  Print("Found record : "+i+" with Close "+Close[i]);
}

so lets say close[3] and close[6] and close[18] was greater than 45.00 how do I get each of them to exist in a new list, where I can chose based on math.max, and math.min which one value I want, so 18 for math.max and 3 for math.min?
not sure if thats the right logic, but thats what I want to do.

Reply With Quote
 
  #9 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 1,970 since Sep 2013
Thanks: 1,388 given, 2,951 received
Forum Reputation: Legendary


kidvic View Post
so lets say close[3] and close[6] and close[18] was greater than 45.00 how do I get each of them to exist in a new list, where I can chose based on math.max, and math.min which one value I want, so 18 for math.max and 3 for math.min?
not sure if thats the right logic, but thats what I want to do.

you could create a new list
and add the once that are found to that list

then you will walk through that list and get the max and min out of it

it that sound a bit like chinese
then i would recommend taking the time to read a small c# introduction book
it will greatly pay off

Reply With Quote
 
  #10 (permalink)
Trading for Fun
Los Angeles, CA
 
Futures Experience: Intermediate
Platform: NinjaTrader, ThinkOrSwim
Favorite Futures: Options, Futures
 
Posts: 92 since Mar 2015
Thanks: 13 given, 2 received



rleplae View Post
you could create a new list
and add the once that are found to that list

then you will walk through that list and get the max and min out of it

it that sound a bit like chinese
then i would recommend taking the time to read a small c# introduction book
it will greatly pay off

Greatly appreciate again.

Reply With Quote
The following user says Thank You to kidvic for this post:

Reply



futures io > > > > > help creating a list.

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

FIO Journal Challenge featuring NinjaTrader ($2,000+ of prizes)

May
 

Portfolio Diversification w/Brendon Delate @ Diversify Portfolio

Elite only

An overview of volumetric analytical tools w/Sergey Sokolov @ PTMC

Elite only

John Hoagland (TBA)

Elite only

FuturesTrader71 Extended Ask Me Anything (AMA)

Elite only

Pete @ Jigsaw Trading (TBA)

Elite only

John @ No BS Day Trading (TBA)

Elite only

An Afternoon with FIO member Softsoap (being rescheduled)

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing Bar Color? ericson NinjaTrader Programming 2 December 14th, 2013 05:59 PM
Accessing Trade Markers Xav1029 NinjaTrader Programming 8 November 28th, 2012 05:48 PM
Accessing the clipboard from within an indicator Tempo NinjaTrader Programming 4 February 7th, 2011 04:23 PM
Accessing a chart from a strategy richtobey NinjaTrader Programming 3 December 31st, 2010 04:07 AM
coding to put range of candle beneath each candle anniebee321 NinjaTrader 13 June 18th, 2010 04:20 PM


All times are GMT -4. The time now is 09:02 AM.

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-05-25 in 0.13 seconds with 19 queries on phoenix via your IP 54.162.19.123