Muti symbols orders Problem need help .

[Deleted]  

greeting!

I am trade several symbols and want to creat an funtion to count how many symbols through my trading orders .

And now, I just know OrderSelect() and have no idea how to code funther ..

waiting .... thanks .

is it

double CountSymbol()

{



double iSymbol=1;

for(int i=OrdersTotal()-1; i>=0; i--)

{

if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))

{

if(OrderSymbol()!=Symbol())

{

iSymbol++;

}

else

iSymbol=iSymbol;

}

}

return(iSymbol);

}

??

dabbler
1091
dabbler  
oxeno:

greeting!

I am trade several symbols and want to creat an funtion to count how many symbols through my trading orders .

And now, I just know OrderSelect() and have no idea how to code funther ..

waiting .... thanks .

is it

double CountSymbol()

{


double iSymbol=1;

for(int i=OrdersTotal()-1; i>=0; i--)

{

if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))

{

if(OrderSymbol()!=Symbol())

{

iSymbol++;

}

else

iSymbol=iSymbol;

}

}

return(iSymbol);

}

??

Use the SRC button to to post code. It makes it easier to read as it is syntax coloured.

When counting whole numbers uses an int not a double.

There is no need for the

else iSymbol= iSymbol

part as a value is held (remembered) until changed

You will need a list of all the symbols so far found, not just "it isn't the same as my chart symbol"

[Deleted]  
dabbler:

Use the SRC button to to post code. It makes it easier to read as it is syntax coloured.

When counting whole numbers uses an int not a double.

There is no need for the

else iSymbol= iSymbol

part as a value is held (remembered) until changed

You will need a list of all the symbols so far found, not just "it isn't the same as my chart symbol"

thanks dabbler:

am I suppose to use array to build the list of all the symbols so far found ?

I cant get the mean ..may I have you help ?

[Deleted]  
dabbler:
I copied your code into the box which arrived after clicking the SRC button and look what I got.

I edited the top, and works ...
dabbler
1091
dabbler  
oxeno:

thanks dabbler:

am I suppose to use array to build the list of all the symbols so far found ?

I cant get the mean ..may I have you help ?

You will define an array of strings to hold the symbols. Suppose you know there will never be more than 100 different symbols

string symbolsArray[100];

Every time you get a new symbol you add it to this array. How do you know it is a new symbol? You have to check every symbol in the array of course. This is non-trivial for a beginner so you need to get better. I can't do that for you. There are plenty of FREE online tutorials on C programming to get you going.

The way we learned programming at college was we were given the book and told to get on with it. You ask when you can't understand something you have read.

dabbler
1091
dabbler  
oxeno:

I edited the top, and works ...
SUCCESS :-)
[Deleted]  
dabbler:

You will define an array of strings to hold the symbols. Suppose you know there will never be more than 100 different symbols

Every time you get a new symbol you add it to this array. How do you know it is a new symbol? You have to check every symbol in the array of course. This is non-trivial for a beginner so you need to get better. I can't do that for you. There are plenty of FREE online tutorials on C programming to get you going.

The way we learned programming at college was we were given the book and told to get on with it. You ask when you can't understand something you have read.

Thanks,the tip
string symbolsArray[100];

is very helpful . And I am going through the Book in my spared time, I need practise, so tips are the best .

I'll try it, programming needs to pile up, and hope to have your tip in the future .

thank you again~~ ^_^