need help conceptualizing approach to identify multiple groups, should i use string or array to assign numbers to the variables?

 

Hi

I can assign the ticket numbers to the variables and continually check them against the OrderProfit of all the other open orders, but my problem is this.......What if a 2nd hedge group opens while hedge1 is still open? my variables hedge1ticket1 and hedge1ticket2 are already assigned; or worse, what if 20 hedge orders become open...... how do i assign Hedge1(tickets 1 and 2), hedge2(tickets 1 and 2),  hedge3(tickets 1 and 2), hedge4(tickets 1 and 2),  etc to them?

 

If i do it the way i am currently trying, i will be typing "if" and "then" for weeks...  

 

Should i use an array or string and for loop to assign a number to the first hedge group (ticket 1 and 2 in the first "hedge"),  and then assign #2 the next two hedge tickets(hedge2 ticket1 and ticke2) etc?

Any suggestion will be helpful. Im a new programmer and i tried several days to conceptualize this and cant yet figure it out. I have never used Arrays yet and have not tried yet using strings to assign number like  Hedge("") could be Hedge1 ?    ......see its going to be a lot of work for me in this project learning.

  

 Thank you, ps one day ill come back and answer questions like these for noobs like me.

 
c3po: how do i assign Hedge1(tickets 1 and 2), hedge2(tickets 1 and 2),  hedge3(tickets 1 and 2), hedge4(tickets 1 and 2),  etc to them?
struct Hedge{ int ticket1; int ticket2; };
int nHedge = 0;
Hedge Hedges[20];
:
Hedge newHedge; newHedge.ticket1=...; newHedge.ticket2=...;
Hedge[nHedge]=newHedge; ++nHedge;
 

the first thing came in my mind, is: don't use variables for that, especially if you wanna use multiple sets,

the smallest problem you have and you forced to restart the terminal/computer and you end up with losing those information

use Global Variables / write to a file instead

 
WHRoeder:
 
 

wow thanks WHRoder, you make it look so easy. My code would have been 1000 lines and yours is only 6... wow

 
qjol:

the first thing came in my mind, is: don't use variables for that, especially if you wanna use multiple sets,

the smallest problem you have and you forced to restart the terminal/computer and you end up with losing those information

use Global Variables / write to a file instead

Thanks for the tip qjol.
 

I've been at it all day, and I understand the structure so far, but would you mind explaining why the colon, what i read applied to a class, and i couldn't relate it to it, "Specifiers of access to elements always end with a colon (:) ..."


struct Hedge{ int ticket1; int ticket2; };
int nHedge = 0;
Hedge Hedges[20];
:
Hedge newHedge; 
newHedge.ticket1=...; 
newHedge.ticket2=...;
Hedge[nHedge]=newHedge; 
++nHedge;
 
c3po: would you mind explaining why the colon, ..."
  1.  ...
  2. :
    :
    :
Reason: