[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 25

 

Question:

How to correctly spell to insert Symbol1 and Symbol2 values in the code:

string SymbolMax[35] = {"Symbol1", "Symbol2"}

If you remove inverted commas, the code won't compile, and if you put inverted commas in it, it gives out text instead of value.

 
forexnew:

Question:

how to correctly write Symbol1 and Symbol2 values to be inserted in the code:

If you remove inverted commas, it won't compile, and if it's in inverted commas, it outputs text instead of value.



There are different options

string SymbolMax[35] = {EURUSD, .....}

or

string Symbol1 = EURUSD;
........
string SymbolMax[35] = {Symbol1, Symbol2,.....}
 
Vinin:


There are different options

or

string Symbol1 ="EURUSD";
string Symbol2 ="AUDUSD";

string SymbolMax[2] = {Symbol1, Symbol2};

It won't compile this way:

'{' - initialization expected D:\F\\9\experts\ASH_5_102.mq4 (4, 23)
'Symbol1' - expression on global scope not allowed D:\F\9\experts\ASH_5_102.mq4 (4, 31)
'Symbol2' - expression on global scope not allowed D:\F\9\experts\ASH_5_102.mq4 (4, 40)
'}' - unbalanced parentheses D:\F\9\experts\ASH_5_102.mq4 (4, 47)


And the first variant doesn't fit, you should take the names of the pairs from the file.

 
forexnew:
string Symbol1 ="EURUSD";
string Symbol2 ="AUDUSD";

string SymbolMax[2] = {Symbol1, Symbol2};

It does not compile this way:

'{' - initialization expected D:\F\9\experts\ASH_5_102.mq4 (4, 23)
'Symbol1' - expression on global scope not allowed D:\F\9\experts\ASH_5_102.mq4 (4, 31)
'Symbol2' - expression on global scope not allowed D:\F\9\experts\ASH_5_102.mq4 (4, 40)
'}' - unbalanced parentheses D:\F\9\experts\ASH_5_102.mq4 (4, 47)


The first variant doesn't fit, we should take the names of the pairs from the file.


I agree. I didn't write it correctly.

string Symbol1 ="EURUSD";
string Symbol2 ="AUDUSD";
string SymbolMax[2];

SymbolMax[0] = Symbol1;
SymbolMax[1] = Symbol2;

This should work

 
Vinin:


I agree. I didn't write it correctly.

That should work.

Thank you!!! That option worked.
 
My EA sets orders on the signal of the indicator, and if the indicator gives a signal to re-set an existing order, for example with 0.1 lot, then the EA sets one more order which is identical to the existing order, which makes the number of orders increase unreasonably. Question: How to make the EA simply increase the lot size of the existing order in such cases? Is such a modification possible in principle?
 
no, only delete the old one and put in a new one with a new lot, or add another order
 
yosuf:
My EA sets orders on the signal of the indicator, and if the indicator gives a signal to re-set an existing order, for example with 0.1 lot, then the EA sets one more order which is identical to the existing order, which makes the number of orders increase unreasonably. Question: How to make the EA simply increase the lot size of the existing order in such cases? Is such a modification possible in principle?
Switch to MT5 - there will only be one aggregate position there. ;))
 

Can you tell me why when running in the tester on "EURUSD"

MarketInfo("GBPUSD", MODE_BID);

returns 0.0 and how to get the price of another instrument in the tester.

 
T-G:

Can you tell me why when running in the tester on "EURUSD"

MarketInfo("GBPUSD", MODE_BID);

returns 0.0 and how to get the price of another instrument in the tester.

iClose()