saving values from a multi-dimensional array - MultiCharts | futures io social day trading
futures io futures trading


saving values from a multi-dimensional array
Updated: Views / Replies:268 / 3
Created: by infe2015 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
 

saving values from a multi-dimensional array

  #1 (permalink)
Trading Apprentice
stockholm Sweden
 
Futures Experience: Intermediate
Platform: multichart
Favorite Futures: omxs30
 
Posts: 5 since Mar 2016
Thanks: 2 given, 1 received

saving values from a multi-dimensional array

Hi i need too saving some values in a multi-dimensional array
i have done it i a singel array like this
Upp1 = CUpp[1];
Upp2 = CUpp[2];
Upp3 = CUpp[3];
Upp4 = CUpp[4];
Upp5 = CUpp[5];
CuppSum = Summationarray(CUpp,5);
but i cant find the solution for multi-dimensional.
Thanks Infe

Reply With Quote
 
  #2 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,465 since Apr 2013
Thanks: 224 given, 835 received

infe2015,

what exactly seems to be the problem?

When storing values in a multidimensional array the only difference is that you have to specify all dimensions.

For your summation you will likely have to build your own function/code that cycles through all the array elements that you want to sum using a for loop.

Regards,

ABCTG

Reply With Quote
 
  #3 (permalink)
Trading Apprentice
Salt Lake City, UT
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: Emini ES
 
Posts: 11 since Jun 2017
Thanks: 0 given, 1 received


You can certainly achieve this using a recursive method.

BE AWARE, RECURSION CAN BE VERY SLOW AND MEMORY INTENSIVE!

Here is some C# code where I create an array with the following elements:
Element 0: Value 1
Element 1: Array with values 2 and 3
Element 2: Value 4
Element 3: Array with 2 elements:
Element 0: Array with two values: 5 and 6
Element 1: Value 7

The sum should be 28.

static void Main(string[] args)
{
object[] o = new object[4];
int value1 = 1;
object[] array1 = new object[2] {2, 3};
int value2 = 4;

object[] array_2_element_0 = new object[]{5,6};
object[] array2 = new object[2]{array_2_element_0, 7};

o[0] = value1;
o[1] = array1;
o[2] = value2;
o[3] = array2;

int sum = Sum(o);
Console.WriteLine(sum);
}

private static int Sum(object obj)
{
int result = 0;

if (obj is object[])
{
object[] arr = (object[]) obj;
foreach (object o in arr)
{
result += Sum(o);
}
}
if (obj is int)
{
result = (int) obj;
}

return result;
}


Last edited by zaruski; August 17th, 2017 at 01:01 PM.
Reply With Quote
 
  #4 (permalink)
Trading Apprentice
Salt Lake City, UT
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: Emini ES
 
Posts: 11 since Jun 2017
Thanks: 0 given, 1 received

Also, it just occurred to me, that you might be asking how to access array elements beyond the first dimension. It is done like this:

int x = array[0][0];

However, if you don't know how many dimensions you will have, then you must iterate through every element, rather than access elements by index.

Reply With Quote

Reply



futures io > > > > saving values from a multi-dimensional array

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

RandBots: AutoTrading Bots to diversify your trading

Oct 24
 

TopstepTrader: Profiting Without Risking Your Own Money

Oct 26

Building Open Source Indicators for NT8 w/Fat Tails @ Lizard Indicators

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to initialization two-dimensional array huzisg TradeStation 1 October 31st, 2016 11:26 PM
How to initialization two-dimensional array huzisg MultiCharts 1 October 21st, 2016 05:18 AM
Multi Time Frame - Index was outside the bounds of the array Jayswiss NinjaTrader Programming 5 July 3rd, 2016 03:48 PM
Dynamic BI-Dimensional Array no erocla MultiCharts 1 February 12th, 2016 10:22 AM
Two dimensional array in EasyLanguage Big Mike EasyLanguage Programming 6 August 17th, 2010 06:23 PM


All times are GMT -4. The time now is 03:06 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-10-20 in 0.08 seconds with 27 queries on phoenix via your IP 54.166.245.10