NexusFi: Find Your Edge


Home Menu

 





help creating a list.


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
kidvic
Los Angeles, CA
 
Posts: 92 since Mar 2015
Thanks Given: 13
Thanks Received: 3

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.


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Coinbase Launches Regulated Crypto Futures Across 26 Eur …
Cryptocurrency
Orban Crashes to 21pct on Record Turnout -- McIlroy Drop …
Prediction Markets & Event Contracts
Prediction Markets Lock Fed Pause at 99pct for April 29 …
Prediction Markets & Event Contracts
CFTC Advances Prediction Markets Regulation -- Chairman …
Prediction Markets & Event Contracts
Fabrication or Framework? Irans Denied MOU Explains the …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
7 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 2,947 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,860


yes, correct
where [0] is most recent


Follow me on X Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
kidvic
Los Angeles, CA
 
Posts: 92 since Mar 2015
Thanks Given: 13
Thanks Received: 3


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)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 2,947 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,860

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]);
}


Follow me on X Visit my NexusFi Trade Journal Reply With Quote
  #6 (permalink)
kidvic
Los Angeles, CA
 
Posts: 92 since Mar 2015
Thanks Given: 13
Thanks Received: 3


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)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 2,947 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,860

(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]);
}


Follow me on X Visit my NexusFi Trade Journal Reply With Quote
  #8 (permalink)
kidvic
Los Angeles, CA
 
Posts: 92 since Mar 2015
Thanks Given: 13
Thanks Received: 3


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)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 2,947 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,860


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


Follow me on X Visit my NexusFi Trade Journal Reply With Quote
  #10 (permalink)
kidvic
Los Angeles, CA
 
Posts: 92 since Mar 2015
Thanks Given: 13
Thanks Received: 3



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
Thanked by:




Last Updated on July 28, 2016


© 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