[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 222

 
smartemiy:

Dear Professionals!

I am asking for your help!

I have a trading robot that makes 20-80 trades each. I can not understand it depends on the brokerage company?

Instead of one - puts 100 pcs.

Please help !!!

The start function is executed on every tick and if the order opening condition is fulfilled a new order will be opened on every tick.

Put limits on the maximum number of open orders or one order per bar etc.

 
splxgf:

The start function is executed on every tick, and if the condition to open an order is met, a new order will be opened on every tick.

Put limits on the maximum number of open orders or one order per bar, etc.

Thanks so much for the reply!

Splxgf , I was thinking about that too:

int init()
{  RefreshRates();
   if (NumberOfOrders()>15) return(0); // если число открытых ордеров превышает число 15, тогда советние не торгует
   if (OpenStop()>30) return(0);       // если число отложеных ордеров превышает число 15, тогда советние не торгует
}

NumberOfOrders is a f-from which counts the number of open orders. OpenStop - f-rd counts the number of pending orders.

The condition for opening the order is fulfilled and the EA puts any number of orders in a row.

>splxgf: This is a variant of the code which stops the Expert Advisor when the number of trades is exceeded. How do I write for one order to be placed when the condition is triggered?

 

init is only executed once https://docs.mql4.com/ru/basis/functions/special

int MaxOpenOrders=15;

int start()
  { 
    //bla-bla
    if (((OrderOpenPrice()-pAsk) >= -60 || OrdersTotal()<MaxOpenOrders) //открываем новые если количество открытых и отложенных ордеров не превышает 15
    OrderSend...
  

In fact, there is a tutorial at https://book.mql4.com/ru/

If you want the condition to be triggered only once, it is more complicated

 
Gentlemen! So can someone answer my question about netbook and 3G modem (on page 221). Thanks in advance.
 
splxgf:

init is only executed once https://docs.mql4.com/ru/basis/functions/special

In fact, there is a tutorial at https://book.mql4.com/ru/

If you want the condition to be triggered only once, it's more complicated.

Thank you!

I will look into it!

 

I searched the database and couldn't find it, but maybe I wasn't looking hard enough.

Tell me, dear ones, do you have something similar:

The algorithm is simple: an analogue of a grid in which an order is opened every n pips (buy or sell, depending on price direction). Orders are opened until there is a profit of m pips. When this value is reached, all orders are closed and everything starts over again.

Thank you in advance for your attention.

 
Zhunko:
The task was to save the downloaded history to the history files. During the downloading process all the history is kept in memory. After closing the MT4 window the saving to the files using MT4 tools starts. This is not a quick process.

Vadim, I solved the saving problem this way:

if(Bars<7000)
  {
    int handle, bar, wParam;
    handle=WindowHandle(Symbol(),Period());
    switch(Period())
            {
                  case PERIOD_M1:  wParam = 33137; break;
                  case PERIOD_H1:  wParam = 33135; break;
                  case PERIOD_D1:  wParam = 33134; break;
            }
    for(bar=1;bar<7000;bar=+100)
      {
        Comment(Bars);
        PostMessageA(handle,WM_KEYDOWN,VK_HOME,0); Comment(Bars); Sleep(10000); 
        PostMessageA(handle,WM_COMMAND,33135,0);  Comment(Bars); Sleep(10000); 
        PostMessageA(handle,WM_KEYDOWN,VK_HOME,0); Comment(Bars); Sleep(10000); 
        PostMessageA(handle,WM_COMMAND,33134,0);  Comment(Bars); Sleep(10000); 
        PostMessageA(handle,WM_KEYDOWN,VK_HOME,0); Comment(Bars); Sleep(10000); 
        PostMessageA(handle,WM_COMMAND,33137,0);  Comment(Bars); Sleep(10000); 
        bar=Bars;
        RefreshRates();
        if(Bars>=7000) {PostMessageA(handle,WM_KEYDOWN,VK_END,0); StartProfit();} //обязательный выход, иначе просто остается и подкачивает данные
        
      }
   }

Thanks to the jumping between timeframes, history is saved on several timeframes simultaneously (in this case it is 1 minute, 1 hour and 1 day). Thus, it is not necessary to switch off the terminal, but the loading is not very fast, the speed is about 1 minute (at these conditions) for one currency pair, i.e. if we start it for many currencies, the terminal will hang up for half an hour. The Expert Advisor starts to use historical data without reloading the terminal.

 
forexnew:

Vadim, I solved the preservation problem this way:

Thanks to the jumping between timeframes, history is simultaneously saved for several timeframes (in this case it is 1 minute, 1 hour and 1 day). Thus, there is no need to turn off the terminal, but the loading is not very fast, the speed is about 1 minute (at these conditions) for one currency pair, i.e. if we start it for many currencies, the terminal will hang up for half an hour. The Expert Advisor starts to use historical data without reloading the terminal.

I have the same thing only many times more reliable. When switching the TF, the history is not saved to files. Only when unloading the terminal.

Sometimes the terminal sometimes saves the history itself but it has nothing to do with TFswitching.

 
Zhunko:

I have the same thing only many times more reliable. When switching the TF, the history is not saved to files. Only when the terminal is unloaded.

Sometimes the terminal starts saving history by itself, but it is not related to TF switching.

How can I set it to download only some timeframes (not all of them): minutes, 1 hour and days?

Thus: string sTimeFrame = {"M1", "H1", "D1"}; // The string listing the TF to be scanned.

It will not download more than 2000 bars on one minute but my Expert Advisor needs more than 7000. After downloading with this script, my Expert Advisor will finish it.

Is it designed this way, not all bars are downloaded?

 

Hello dear community.

I have such a problem. I am using "Bollinger Bands" indicator in my template (iBands - https://docs.mql4.com/ru/indicators/iBands) and one of its parameters - deviation (standard deviation) is defined there as int. Is it possible to change it to double? In MT4, in the "Custom Indicators" section, there are other Bollinger Bands (marked as "Bands") where deviation is defined as double . But how to insert it into MQL4? It is not included in the standard set of built-in indicators, is it? I have no idea how to use it in MQL4.