symbol format help

 
string list[]= {"EUR","USD","GBP","JPY","AUD","CAD","NZD","CHF"};
     for(int i=0; i<ArraySize(list); i++) 
     {
      string primer=list[0];
       for(int y=0; y<ArraySize(list); y++)
     {
     string second = list[1];   
     string currency = StringConcatenate("\"",primer, second,"\"")
     OrderSend(currency ,OP_SELL,0.1,Bid,Slip,0,0,"FirstSell",Magic,0,Green); 
     }
     }
  
  

currency output is = "EURUSD

but i can't ordersend. how can i fix it ? how can i send order. thank you.

i want to use for loop and open different currencies next, at the same chart. this is why i asked the question.

 
YILMAZ KAHYA:

currency output is = "EURUSD" 

but i can't ordersend. how can i fix it ? how can i send order. thank you.

i want to use for loop and open different currencies next, at the same chart. this is why i asked the question.

currency output is = "EURUSD"  :: 

string primer=list[0];
 string second = list[1]

you are selecting only [0] and[1] ..first is EUR second is USD...you are doing the loop, but for every "  i  " you are selecting [0] and for every " y " you are selecting [1]...

 
Daniel Cioca #:

currency output is = "EURUSD"  :: 

you are selecting only [0] and[1] ..first is EUR second is USD...you are doing the loop, but for every "  i  " you are selecting [0] and for every " y " you are selecting [1]...

İt is not a problem, i can fix it. But ordersend does not work. if i write i and y, for loop return all currencies that i want, but i can't open order, can you help me
 
YILMAZ KAHYA #:
İt is not a problem, i can fix it. But ordersend does not work. if i write i and y, for loop return all currencies that i want, but i can't open order, can you help me

you don't understand .. your output is "EURUSD"  ....    should be EURUSD    ... without " "... also if you loop like this you will get EURUSD but also USDEUR... ??...


anyway : 

string currency = StringConcatenate(primer, second);

try

 
YILMAZ KAHYA:

currency output is = "EURUSD" 

but i can't ordersend. how can i fix it ? how can i send order. thank you.

i want to use for loop and open different currencies next, at the same chart. this is why i asked the question.

Why don’t you say what error you get then you know what to look at

The symbol name must match exactly with your broker symbol name in market watch

You do not need to put quotes around the symbol name


 

I recommend: Do not trade multiple currencies in one EA.

  1. You can't use any {MT4: predefined variables, MT5: predefined variables,}

  2. Must poll (not OnTick, unless you use specific indicators)
              The Implementation of a Multi-currency Mode in MetaTrader 5 - MQL5 Articles (2011)

  3. and usually other problems, e.g. A problem with iBarShift - MQL4 programming forum - Page 2

  4. You must handle History {MT4:4066/4073 errors: Download history in MQL4 EA - MQL4 programming forum, MT5: Timeseries and Indicators Access /  Data Access - Reference on algorithmic/automated trading language for MetaTrader 5.}

  5. Code it to trade the chart pair only. Look at the others if you must. Don't assume that Time[i] == iTime(otherPair, TF, i) always use iBarShift.

Then put it on other charts to trade the other pairs. Done.
 
Daniel Cioca #:

you don't understand .. your output is "EURUSD"  ....    should be EURUSD    ... without " "... also if you loop like this you will get EURUSD but also USDEUR... ??...


anyway : 

try

it works. thank you very much

 
Paul Anscombe #:
Why don’t you say what error you get then you know what to look at

The symbol name must match exactly with your broker symbol name in market watch

You do not need to put quotes around the symbol name


expert mq4 file 0 errors. but it doesn't work too. corrected by  this code. thank you.

string currency = StringConcatenate(primer, second);
 
William Roeder #:

I recommend: Do not trade multiple currencies in one EA.

  1. You can't use any {MT4: predefined variables, MT5: predefined variables,}

  2. Must poll (not OnTick, unless you use specific indicators)
              The Implementation of a Multi-currency Mode in MetaTrader 5 - MQL5 Articles (2011)

  3. and usually other problems, e.g. A problem with iBarShift - MQL4 programming forum - Page 2

  4. You must handle History {MT4:4066/4073 errors: Download history in MQL4 EA - MQL4 programming forum, MT5: Timeseries and Indicators Access /  Data Access - Reference on algorithmic/automated trading language for MetaTrader 5.}

  5. Code it to trade the chart pair only. Look at the others if you must. Don't assume that Time[i] == iTime(otherPair, TF, i) always use iBarShift.

Then put it on other charts to trade the other pairs. Done.

i use an expert on eurusd, gbpusd,usdcad,audusd etc. i want adding that special feature; for example if there is "eurusd buy " in open orders, my ea will not open "gbpusd buy", but ea will can open "gbp usd sell" or "usdcad buy." that means, there is a usd sell position. don't open order again all usd sell options. i want use this feature with all pairs. if i use it different charts, it will open for example eurusd buy and gbpusd buy. i couldn't fix it and i think to use multi currency. how can i fix this problem ? (i try time delay but i couldn't) thank you very much

 
YILMAZ KAHYA:

currency output is = "EURUSD" 

but i can't ordersend. how can i fix it ? how can i send order. thank you.

i want to use for loop and open different currencies next, at the same chart. this is why i asked the question.

void OnTick()
  {

              
   bool OrderSendResult;
   string list[]= {"EUR","USD","GBP","JPY","AUD","CAD","NZD","CHF"};
     for(int i=0; i<ArraySize(list); i++) 
     {
    
       string primer=list[i];
      
       for(int y=i+1; y<ArraySize(list); y++)
     {
     string second = list[y];   
     string currency = StringConcatenate(primer+second);
     double Fiyat=(MarketInfo(currency,MODE_ASK));
     if(Fiyat==0) // Tanımsız Sembol
      {
     currency = StringConcatenate(second+primer);
     }
     
     OrderSendResult=OrderSend(currency ,OP_SELL,0.02,MarketInfo(currency,MODE_BID),Slip,0,0,"FirstSell",Magic,0,Green); 
   
    
    // if(GetLastError()!=0) Print("Hata ",GetLastError());
     }
     }
     ExpertRemove();
  }
yk
 
YILMAZ KAHYA #:

i use an expert on eurusd, gbpusd,usdcad,audusd etc. i want adding that special feature; for example if there is "eurusd buy " in open orders, my ea will not open "gbpusd buy", but ea will can open "gbp usd sell" or "usdcad buy." that means, there is a usd sell position. don't open order again all usd sell options. i want use this feature with all pairs. if i use it different charts, it will open for example eurusd buy and gbpusd buy. i couldn't fix it and i think to use multi currency. how can i fix this problem ? (i try time delay but i couldn't) thank you very much

You can used it on individual chart as William said, and add this feature with restricting trades same asset . You will differentiate your individual EA on every chart with magic number.

And you add this filter for opening trades ...e.g. "do not open another USD sell/buy trade" ...or open it with half size... 


But you should approach that different ... loop through all open trades... separate them into base/quote...establish which one is buy which one is sell... e.g.  Sell EURUSD ...means Sell-EUR ... Buy-USD.... because if Open Sell order for EURUSD ..you are buying USD... and for Buy USDJPY...you also buying USD... tricky ...