Cycle Operator 'for' questions - page 14

 
RaptorUK:

However, this does not work as intended because the concept is fatally flawed . . .  until you understand why there is no point in continuing . . .


As I said . . . 
 

Simon,

I do believe I understand.

I am dealing with two order position indexes. The first order position index is an "Acitve order index" and the second order position index is a "History order index".

The program is printing an order ticket number close time from a different order in the "History order index". I must save the present order ticket in order to select the proper ticket number for the program to execute the Print() function including the correct order ticket number close time.

Thank you.

 

Simon,

I wish to read your response and respond to it so I can complete other duties. I hope to continue this discussion again soon. Much has been accomplished.

Thank you.

 
You are welcome . . . .  take your time,  let it sink in,  LEARN.
 

Yeah, I believe I'm learning much, on and off the MQL4 forum. Yes, I'll be covering some basics too. Haha ;)

Thanks very much.

 

Simon,

I've been goin' over arrays to switch gears for a lil' bit. This is what I believe to have learned regarding multiple-dimension arrays.

Arrays can be one,two,three, or four dimensional. They are indexed. Indexes begin with zero and continue (example: 0,1,2,3,4)

indexes look like so, |0|1|2|3|4|...

An example of a two dimensional array would be like so-

int two_dim_array[5,2][4,3];

A two dimensional array kinda' looks like a chess board. If you've ever played chess I believe you'd agree that the pieces are moved like so, "move king to d2" or "move rook to h4".

Array dimensions involving more than one dimensions are simply additional "virtual chess boards" ;)

An example of a three dimensional array would be like so-

int three_dim_array[5,2][3,6][7,5]; // each "[]" aka index represents a virtual chess board. (three indexes/virtual chessboards)

I believe that should cover it for now. What is your response to what I believe I have learned?


The underlying issue that is caused by the way you have codded your while loop . . . the issue that was causing Invalid ticket for OrderClose function  and  Unknown ticket 2 for OrderModify   you haven't fixed thee cause you have addressed the symptom.

I wish to discuss this issue with you in fine detail by itself, allowing me to focus my thoughts on resolving the issue without any distraction from other points.


Thank you.

 
WhooDoo22:

I believe that should cover it for now. What is your response to what I believe I have learned?

I don't know,  what have you learned ?  do you know what a bubble sort is ? do you know how to correctly declare an array ?  do you know how to incorrectly declare an array ?  


I learned about a bubble sort over 30 years ago,  I can't remember any of the details but I remember that one way to sort an array is to use a bubble sort.
 

Simon,


"do you know how to correctly declare an array ?"

I've been declaring arrays in this form (below SRC is a one-dimensional array example)

int one_dim_vector[]={0,0,0,0,0};  // one dimensional array declaration;


"I learned about a bubble sort over 30 years ago,"

I just turned 22 last October, so you've got a couple years on me sir. ;)

Bubble sort. Hmm, I'll definitely look into this!


The underlying issue that is caused by the way you have codded your while loop . . . the issue that was causing Invalid ticket for OrderClose function  and  Unknown ticket 2 for OrderModify   you haven't fixed thee cause you have addressed the symptom.

I wish to discuss this issue with you in fine detail by itself, allowing me to focus my thoughts on resolving the issue without any distraction from other points.


Thank you.
 

Simon,

I declared all variables, initialized all arrays etc. I am ready to begin writing code for my order sends. I wish to write the code differently so as to "get the ball rolling". The code needs to select an order (I currently don't know which order it needs to choose). You mentioned that an EA needs to be able to just pop on a chart and begin trading regardless of current account trading activity. What does this require? I am sure I can code it.

Thank you.

 
WhooDoo22:

Simon,

I declared all variables, initialized all arrays etc. I am ready to begin writing code for my order sends. I wish to write the code differently so as to "get the ball rolling". The code needs to select an order (I currently don't know which order it needs to choose). You mentioned that an EA needs to be able to just pop on a chart and begin trading regardless of current account trading activity. What does this require? I am sure I can code it.

Thank you.

If you can't figure out what is required you will never code it . . .  figure it out first,  that is the hard bit,  coding is easy by comparison.  Don't think "code" all the time . . .  it is a common mistake to make . . .  but
 you must wean yourself off it.

 

If your code does nothing with open orders because they are left to run to TP or SL then your code doesn't need to concern itself with any open orders when it is started . . . .  on the other hand if your code manages open orders in some way,  for example trailing SL then it need to first find any open orders that belong to it and manage their trailing SL as it would for an order it had just placed . . .  do you have a flowchart for the EA you are trying to code ?

Reason: