Select a symbol in the settings - page 2

 
Alexey Viktorov:

We're talking about something different.

Yes. In the body of the programme it's easy.

And I'm talking about selecting parameters for optimisation, on the tester parameters tab...

input  ... это показывает)

That's where it would be very convenient to have a list of symbols from "market overview".

You don't have to convert anything there either. Just give to the public list, the already prepared internal list...

 

added more, couples

 
enum Enum_Symbol {EURUSD,GBPUSD,USDCHF,USDJPY,USDCAD,AUDUSD,AUDNZD,AUDCAD,AUDCHF,AUDJPY,
                  CHFJPY,EURGBP,EURAUD,EURCHF,EURJPY,EURNZD,EURCAD,GBPCHF,GBPJPY,CADCHF
                 };
//--- Входящие параметры
input  Enum_Symbol     SIMBOL_1                 = EURUSD;         // Пара
input  Enum_Symbol     SIMBOL_2                 = EURUSD;         // Пара
input  Enum_Symbol     SIMBOL_3                 = EURUSD;         // Пара
 
Aleksandr Klapatyuk:

added more, couples.

Yeah, well, someone will need it)

Now all that's left to do is to synchronise the "market overview" window with this list... I think such a possibility was mentioned somewhere, if I'm not mistaken.

But it would be easier to have a list ready!

 
Alexey Viktorov:

We're not talking about the same thing.

I pasted your code - to count all open pairs and subtract the correct lot. but i think i'm being silly here - maybe this code doesn't fit here ?

 
 

But it does change the lot.

//+------------------------------------------------------------------+
//| Calculate optimal lot size                                       |
//+------------------------------------------------------------------+
double TradeSizeOptimized(void)
  {
   double price=0.0;
   double margin=0.0;
   string arr[];
   int resize = 0, syTotal = SymbolsTotal(true);
   for(int i = 0; i < syTotal; i++)
     {
      string name = SymbolName(i, true);
      if(SymbolInfoInteger(name, SYMBOL_VISIBLE))
        {
         resize = ArrayResize(arr, i+1);
         arr[i] = name;
        }
      //--- select lot size

      if(!SymbolInfoDouble(arr[i],SYMBOL_ASK,price))
         return(0.0);
      if(!OrderCalcMargin(ORDER_TYPE_BUY,arr[i],1.0,price,margin))
         return(0.0);
      if(margin<=0.0)
         return(0.0);
     }
   double lot=NormalizeDouble(AccountInfoDouble(ACCOUNT_MARGIN_FREE)*MaximumRisk/margin,2);
//--- calculate number of losses orders without a break
   if(DecreaseFactor>0)
     {
      //--- select history for access
      HistorySelect(0,TimeCurrent());
      //---
      int    orders=HistoryDealsTotal();  // total history deals
      int    losses=0;                    // number of losses orders without a break

      for(int y=orders-1; y>=0; y--)
        {
         ulong ticket=HistoryDealGetTicket(y);
         if(ticket==0)
           {
            Print("HistoryDealGetTicket failed, no trade history");
            break;
           }
         for(int i = 0; i < syTotal; i++)
           {
            string name = SymbolName(i, true);
            if(SymbolInfoInteger(name, SYMBOL_VISIBLE))
              {
               resize = ArrayResize(arr, i+1);
               arr[i] = name;
              }
            //--- check symbol
            if(HistoryDealGetString(ticket,DEAL_SYMBOL)!=arr[i])
               continue;
            //--- check Expert Magic number
            if(HistoryDealGetInteger(ticket,DEAL_MAGIC)!=MA_MAGIC)
               continue;
            //--- check profit
            double profit=HistoryDealGetDouble(ticket,DEAL_PROFIT);
            if(profit>0.0)
               break;
            if(profit<0.0)
               losses++;
           }
        }
      //---
      if(losses>1)
         lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1);
     }
   for(int i = 0; i < syTotal; i++)
     {
      string name = SymbolName(i, true);
      if(SymbolInfoInteger(name, SYMBOL_VISIBLE))
        {
         resize = ArrayResize(arr, i+1);
         arr[i] = name;
        }
      //--- normalize and check limits
      double stepvol=SymbolInfoDouble(arr[i],SYMBOL_VOLUME_STEP);
      lot=stepvol*NormalizeDouble(lot/stepvol,0);
      double minvol=SymbolInfoDouble(arr[i],SYMBOL_VOLUME_MIN);
      if(lot<minvol)
         lot=minvol;
      double maxvol=SymbolInfoDouble(arr[i],SYMBOL_VOLUME_MAX);
      if(lot>maxvol)
         lot=maxvol;
     }
//--- return trading volume
   return(lot);
  }
//+------------------------------------------------------------------+
 

I don't know if it's your code that's doing this.

Snapshot222

 
Михаил:

Yes, someone will need it)

Now all that's left to do is to synchronise the "market overview" window with this list... I think this possibility was mentioned somewhere, if I'm not mistaken.

But it would be easier to have a list ready!

This would be suitable for a tester. create an Expert Advisor and test it with many pairs

 
Aleksandr Klapatyuk:

I pasted your code - to count all open pairs and subtract the correct lot. but i think i'm being silly here - maybe this code doesn't fit here ?

But it does change the lot.

I don't know if it's your code.



What if you fix profit by closing trades? )) When green has already moved away from blue? By n-th value? At the end it may become more cheerful?

 
Alexey Viktorov:

We're not talking about the same thing.

how to use it properly ?

in order to use it, it's like this.

enum Enum_Symbol {EURUSD,GBPUSD,USDCHF,USDJPY,USDCAD,AUDUSD,AUDNZD,AUDCAD,AUDCHF,AUDJPY,
                  CHFJPY,EURGBP,EURAUD,EURCHF,EURJPY,EURNZD,EURCAD,GBPCHF,GBPJPY,CADCHF
                 };
//--- Входящие параметры
input Enum_Symbol     SIMBOL_1                 = EURUSD;  // Пара
input Enum_Symbol     SIMBOL_2                 = EURUSD;  // Пара
input Enum_Symbol     SIMBOL_3                 = EURUSD;  // Пара

you have to do something else to make it work.

how do we use your code?

//+------------------------------------------------------------------+
//| function                                                         |
//+------------------------------------------------------------------+
void XXXXXX()
  {
   string arr[];
   int resize = 0, syTotal = SymbolsTotal(true);
   for(int i = 0; i < syTotal; i++)
     {
      string name = SymbolName(i, true);
      if(SymbolInfoInteger(name, SYMBOL_VISIBLE))
        {
         resize = ArrayResize(arr, i+1);
         arr[i] = name;
        }
     };
  };
//+------------------------------------------------------------------+
 
Aleksandr Klapatyuk:

how to use it properly ?

In order to use it like this.

you have to do something else to make it work.

How do I use your code?


Fill an array of characters and work with that array.

Here's a free EA using this piece of code ***


ps; tumblr, you should have removed the link for nothing. Among my products in the marketplace, only TWO are paid. One from 2017 has been rented 4 times, and the other from 2014 for 10 quid hasn't been bought even once. So there's no advertising to be expected here.

 
Alexey Viktorov:

... drubashka, you shouldn't have deleted the link....

Since the moderators are reading the forum, we can hope for such a list to appear!

 
Alexey Viktorov:

Fill in an array of characters and work with this array.

There's a free EA using the above piece of code ***


ps; drubashka, you shouldn't have removed the link. Among my products in the marketplace, only TWO are paid. One from 2017 has been rented 4 times, and the other from 2014 for 10 quid hasn't been bought once. So there's no advertising to be expected here.

Unfortunately you can't discuss anything from the Marketplace on the forum, either paid or free. It's been said a hundred times. If you have time, you can search it yourself.

Reason: