[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 390

 
drknn:

The wording is very good. What the questioner is asking...


there are scripts that simultaneously open sell on one symbol on the second buy.

I am interested in a script that can simultaneously open a sell/buy on 7-10 symbols, with a volume specified for each symbol, at current prices.

Example:

sell EURUSD 1

buy GBPUSD 1.5

sell USDCAD 1.2

buy AUDUSD 1.1

buy NZDUSD 2

buy USDCHF 3

The MultiOrders script is almost perfect, only there are 5 fields for the symbols.

 
Snegovik:


There are scripts that simultaneously open sell on one symbol on the second buy.

I am interested in a script that can simultaneously open a sell/buy on 7-10 symbols, with a volume specified for each symbol, at current prices.

Example:

sell EURUSD 1

buy GBPUSD 1.5

sell USDCAD 1.2

buy AUDUSD 1.1

buy NZDUSD 2

buy USDCHF 3

The MultiOrders script is almost perfect, only there are 5 fields for the symbols.

Likewise. Figure out this script and you, in your script, will come out even better, and you can even add extra functionality.
 
snail09_1:
Is it hard to check, or lazy? It's easier to ask the question. Can the bid price be zero? It can if nothing is sold8-(
it's not the question if the terminal can reset the bid at some point (personal experience is interesting)
 
YOUNGA:
It's not a question of whether the terminal can reset the bid at some point (personal experience is of interest).

I've never seen one. Have you seen absolute zero on the thermometer?

Well, that can't be the problem. Maybe you have no one to talk to?

 
snail09_1:
Likewise. Figure out this script and your script will do even better, and you may even be able to add additional functionality.


I don't quite understand how to write a .dll

if I understand correctly, the basis of the script is in this file.

 
Guys! In the strategy tester on the history, the Expert Advisor does not feed information to the file, only when trading online. What is the reason and how can I fix it? I have no idea how to cure it. Thank you.
 
net:
Guys! In the strategy tester on the history, the Expert Advisor does not feed information to the file, only when trading online. What is the reason and how can I fix it? I have no idea how to cure it. Thank you.
It only saves it to the \MetaTrader 4\tester\experts\files directory
 
Snegovik:


I don't quite understand how to write a .dll

If I understand correctly, the basis of the script is in this file.


No 1 script can send an order to the server to open several orders at once. You have to open one at a time. The DLL offered to you simply creates a visual window and works with it. MQL4 tools may be enough for your task
 

Here is my lot (martin) calculation function:

double Lots()
 {
 //  double LotsArray[]={mode_1,mode_2,mode_3,mode_4,mode_5,mode_6};
 //  double LotsArray[]= {0.1,0.2,0.3,0.4,0.5,0.6};
   int LossCount = 0;
   double LotM=Lot;
   int total = OrdersHistoryTotal();
   for (int i = total-1; i >= 0; i--)
    {
      OrderSelect(i, SELECT_BY_POS, MODE_HISTORY);
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
       {
         if (OrderProfit() > 0)
          {
            LotM=LotsArray[0];
          }         
          else
           {
            LotM=LotsArray[LossCount+1];
            LossCount++;
           }
       }
    }
   return(LotM);
}

These are the global variables for this function:

double Lot = 0.1;
extern double mode_1 = 0.1;
extern double mode_2 = 0.2;
extern double mode_3 = 0.4;
extern double mode_4 = 0.8;
extern double mode_5 = 1.6;
extern double mode_6 = 3.2;
double LotsArray[5];

Here is what in int init()

 LotsArray[0] = mode_1;
 LotsArray[1] = mode_2;
 LotsArray[2] = mode_3;
 LotsArray[3] = mode_4;
 LotsArray[4] = mode_5;
 LotsArray[5] = mode_6;

When testing the Expert Advisor the following errors are displayed in the Expert Advisor log:

2012.09.19 23:14:22     2012.07.19 16:19  mmm2.1.1~ EURUSD.5,M5: ERROR BUYSTOP : 1.22443 SL:1.22377 TP:1.22506
2012.09.19 23:14:22     2012.07.19 16:19  mmm2.1.1~ EURUSD.5,M5: OrderSend error 4051
2012.09.19 23:14:22     2012.07.19 16:19  mmm2.1.1~ EURUSD.5,M5: invalid lots amount for OrderSend function
2012.09.19 23:14:22     2012.07.19 16:19  mmm2.1.1~ EURUSD.5,M5: Bid:1.22432 Ask:1.22438 avgSpread:0.00006  Commission rate:0.00003  Real avg. spread:0.00009  Lots:1.00   HIGH SPEED   MAX
2012.09.19 23:14:22     2012.07.19 16:19  mmm2.1.1~ EURUSD.5,M5: 2012.07.19 16:19 tick:514
2012.09.19 23:14:22     2012.07.19 16:19  mmm2.1.1~ EURUSD.5,M5: ERROR BUYSTOP : 1.22442 SL:1.22376 TP:1.22505
2012.09.19 23:14:22     2012.07.19 16:19  mmm2.1.1~ EURUSD.5,M5: OrderSend error 4051
2012.09.19 23:14:22     2012.07.19 16:19  mmm2.1.1~ EURUSD.5,M5: invalid lots amount for OrderSend function
2012.09.19 23:14:22     2012.07.19 16:19  mmm2.1.1~ EURUSD.5,M5: Bid:1.22431 Ask:1.22437 avgSpread:0.00006  Commission rate:0.00003  Real avg. spread:0.00009  Lots:1.00   HIGH SPEED   MAX
2012.09.19 23:14:22     2012.07.19 16:19  mmm2.1.1~ EURUSD.5,M5: 2012.07.19 16:19 tick:513

Is there something wrong with the code? What it may mean?

Here https://docs.mql4.com/ru/runtime/errors I see that this is an error:

ERR_INVALID_FUNCTION_PARAMVALUE (4051)

I.e. the error is due to wrong parameters. As I understood the wrong lot. But I don't understand what is wrong here.

 
hoz:

Here is my lot (martin) calculation function:

These are the global variables for this function:

Here is what in int init()

When testing the Expert Advisor the following errors are displayed in the Expert Advisor log:

Is there something wrong with the code? What it may mean?

Here https://docs.mql4.com/ru/runtime/errors I see that this is an error:

ERR_INVALID_FUNCTION_PARAMVALUE (4051)

I.e. the error is due to wrong parameters. As I understood the wrong lot. But I don't understand what is wrong here.


double LotsArray[5]; 5 to 6 correct.
Reason: