Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 488

 
Artyom Trishkin:

No, this topic is on both mql4 and mql5

there's a topic at https://www.mql5.com/ru/forum/6343
Вопросы от начинающих MQL5 MT5 MetaTrader 5
Вопросы от начинающих MQL5 MT5 MetaTrader 5
  • 2012.03.12
  • www.mql5.com
Подскажите пожалуйста, такой показатель тестера в жизни реален? И хороший это или плохой результат за год с депо 3000...
 
igrok333:
There's a topic at https://www.mql5.com/ru/forum/6343.

Don't get confused ;)

Here you can ask how to convert from a 4 to a 5, for example...

 
Artyom Trishkin:

mql5 distinguishes between positions and orders. A position is the result of a trade. And a trade is the result of triggering of an order.

First of all, a trade request is sent to the server, and either a pending order (if the request was to set one) or a market order (if the request was to open a position) appears.

If the market order triggered (a trade occurred), a position appears (or an existing position is modified) as a result of this trade.

On a hedge account, there can be many separate positions (including multidirectional), on a netting account there can be only one position.

So, to loop through all positions, you need to organize the loop by their number - respectively, use PositionsTotal() instead of usual for mql4 OrdersTotal().

If we need to search all orders in mql5, then (in mql5) we will use the usual for mql4 OrdersTotal().

Yes, I see.

But, where to insert this index, it's still unclear?

 
Is there a library that allows you to work with dynamic arrays?
I need to create multidimensional dynamic arrays, plus copy e.g. a one-dimensional array into a two-dimensional one
 
Roman Sharanov:
Is there any library that would allow working with dynamic arrays?
I need to create multidimensional dynamic arrays, plus copy, for example, a one-dimensional array into a two-dimensional one.

I have never even thought of checking the possibility of copying a one-dimensional array into a two-dimensional one. But the question immediately arose: "What happens if the number of elements of a one-dimensional array is odd?

There seems to be a library in mql4, but the documentation is only for mql5. And I don't know how it will work in mql4.

Документация по MQL5: Стандартная библиотека / Коллекции данных
Документация по MQL5: Стандартная библиотека / Коллекции данных
  • www.mql5.com
Этот раздел содержит технические детали работы с различными структурами данных (массивами, связанными списками и др.) и описание соответствующих компонентов стандартной библиотеки MQL5. Использование классов структур данных позволит сэкономить время при создании пользовательских хранилищ данных разнообразных форматов...
 
Can you please advise why the EA stops seeing its orders (opens several orders instead of one) if there are other orders in addition to its orders? If only EA's orders - no problems. When opening an order the "Medjik" is set and onlyorders with this "Medjik"are selectedaccording to the conditions of opening the order.
 
Anatoliy Ryzhakov:
Can you please advise why the EA stops seeing its orders (opens several orders instead of one) if there are other orders in addition to its orders? If only EA's orders - no problems. When opening an order the "Medjik" is set and onlyorders with this "Medjik"are selected according to the conditions of order opening.
You have a break and you need to continue
 
Good afternoon! I need help for a humanitarian (me) who is trying to make an indicator with the faintest knowledge of how to do it))) but have an understanding of what should appear)) So:
How to program a crutch/indicator/script (as an indicator with tabs "about, general, input parameters, colours, display") for MT4 so it will take data from .csv file, like format of source file:
EUR;TF;1.192;1.1733
EUR;TN;1.2037;1.1663
EUR;AB1;1.1906499615;1.1797479615
CHF;TF;1.0362;1.0183
CHF;TN;1.0479;1.0121
CHF;AB1;1.03484132734247;1.02549513556164


I.e.
the indicator took the recorded data from a file and put itwith a comment on a chart in the form of bars (TF, TA) or a coloured band(EA) with parameters of extent exactly "day" (from the border to the border of the vertical day separators on МТ4), for lines selection of the line colour, line type, selection of the text colour and comment size and adding to the line a comment segment, for example "TF - 1,192" the second line "TF - 1,1733" which are taken from the corresponding lines of the file. The first digit of the line EUR;TF;1.192;1,1733 is taken from the line EUR;TF;1.192;1,1733 as a distance and the second digit from the line 1.192 and the end of the distance 1.192.
There are also ranges, for example EA, the principle is the same from the beginning to the end of the day but the price is different and the line begins and ends with CHF;AB1;1.03484132734247;1.02549513556164 beginning is
1.03484132734247 end of the range1.02549513556164. It runs when you turn on MT4 (as a usual indicator on the gafik), every day on the chart and adds all the data exactly for the current day once, all the lines applied earlier are not deleted from the chart and do not duplicate it. With all this it selects and displays all of the segments and ranges for the day, only where the active window is now and on other active windows (i.e., where it is running) (i.e., it opened a pair and the indicator drew all of the segments and ranges of the current day and calmed down and so on for the pairs).

For example, how should look the tab of indicatorInput parameters:

Переменная________Значение
Funtik________//--Общие настройки--//
Draw TF________true
Draw TN _______true
Draw AB1______true
Draw AB2______false
Text caption colour _______Black
Шрифт подписей__________________Arial
Font size for text captions ________9
TF line colour ______________
Line type TF _______________
TN Line colour ______________
Line type TN _______________
Band colour AB1__________
Band colour AB2__________
File polling frequency in seconds ______2
File name ___________5.csv

I tried to scribble myself, but do not get a damn thing, but seemed easy (but I'm a humanitarian, what can you do....) Please help a drowning !!!!!!!!

//+------------------------------------------------------------------+
//|                                                        Funtik.mq4 |
//|                      Copyright © 2008, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
 
#property indicator_chart_window
//---- input parameters
extern string    Funtik="5.csv";
//+------------------------------------------------------------------+
//| extern variables                                       |
//+------------------------------------------------------------------+
extern  bool    РисоватьTB = false      ;
extern  bool    РисоватьTN = false      ;
extern  bool    РисоватьTF = false      ;
extern  bool    РисоватьAB1 = false     ;
extern  bool    РисоватьAB2 = false     ;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
      int handle,sst=1;
     double  NameCena;
     string NameF ,NameTi,NameFT;
      bool h1;
      
   while(sst>0)
                 {
   handle=FileOpen(Funtik,FILE_CSV|FILE_READ,';');
 //  Comment ("Файл ",Funtik,"открыт");
   if(handle>=0)
    {
     NameF=FileReadString(handle);           // Читается наименование бумаги
     NameTi=FileReadString(handle);          // Читается первая котировка и подставляется в начало первого отрезка линии или диапазона
     NameCena=FileReadNumber(handle);        // Читается цена последней котировки для первого отрезка линии или диапазона
     NameFT=FileReadString(handle);          // Читается последняя котировка для диапазона
     
     Alert(NameF," ",NameTi," ",NameCena," ",NameFT);
       if(FileIsEnding(h1))
       {
     FileClose(h1);
     return(false);
     sst=0;
       }
    }
               }
     FileClose(handle);   
 
  //fComment(Funtik);
//----
   return(0);
  }
//+------------------------------------------------------------------+




Example Line: http://SSMaker.ru/35997bd0/


help please...brain boiling from not knowing how to code...

MetaQuotes Software Corp.
MetaQuotes Software Corp.
  • www.metaquotes.net
Миллионы трейдеров и сотни брокеров не могут ошибаться — они выбрали MetaTrader 5 для торговли на Форексе и финансовых рынках! Узнать больше
 

inkosto:
Добрый день! нужна помощь гуманитарию ...

Please insert the code correctly.


It's even clearer:


 

I need to integrate zigzag into my indicator (now it's counting by handle)

The thing is, my indicator does not use OnCalculate().

So how do I make the zigzag work and where do I get rates_total and prev_calculated for its calculation?