Мне нужно передавать из одного терминала МТ5 в другой, количество открытых позиций. На пример, из первого при помощи индикаторa.

MQL5 Indicators Experts Text writing

Job finished

Execution time 1 day
Feedback from customer
Alles TipTop
Feedback from employee
Всё прошло успешно! Я рад сотрудничеству!

Specification

Мне нужно передавать из одного терминала МТ5 в другой, количество открытых позиций.
На пример, из первого при помощи индикаторы, через файл, и потом во втором терминале, функцией блоком в советнике, читать эти данные.

Привожу пример индикатора. Задача или исправить этот индикатор, или предлагать другой и другие решения. Спасибо.

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots 1
//----- Indicator Parameters
//+------------------------------------------------------------------+
input string SubFolder = "MetaTrader 5";
//+------------------------------------------------------------------+
int Handle;
//---
int BearPositions;
int BullPositions;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit() {return(0);}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
  Comment("");
  Handle=FileOpen(SubFolder+"\\MQL5\\Files\\"+Symbol()+".csv",FILE_WRITE);
  Print(Symbol()+".csv"+" File Created: ",(bool)FileIsExist(SubFolder+"\\MQL5\\Files\\"+Symbol()+".csv"));
  FileClose(Handle);
  Print(Symbol()+".csv"+" File Deleted: ",(bool) FileDelete(SubFolder+"\\MQL5\\Files\\"+Symbol()+".csv"));
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,    // number of bars in history at the current tick
                const int prev_calculated,// number of bars calculated at previous call
                const datetime &time[],
                const double &open[],
                const double& high[],     // price array of maximums of price for the indicator calculation
                const double& low[],      // price array of minimums of price for the indicator calculation
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
//-----
  TotalPositions();
//-----
  Handle=FileOpen(SubFolder+"\\MQL5\\Files\\"+Symbol()+".csv",FILE_WRITE|FILE_SHARE_READ|FILE_ANSI,';');
  if(Handle!=INVALID_HANDLE)
  {
    FileWrite(Handle,BullPositions,BearPositions);
    FileClose(Handle);
    Comment("\n","\n","\n","\n","\n","\n","\n","\n","\n","\n",Symbol(),": ","Bull: ",(string)BullPositions,", Bear: ",(string)BearPositions);  
    //"\n","Ask: ",NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),_Digits),
    //"\n","Bid : ",NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits));
  }
//-----
  else Print("File open Failed: "+SubFolder+"\\"+Symbol()+".csv, error",GetLastError());
//----- Done 
  return(rates_total);
}
//+------------------------------------------------------------------+
//| Bear Positions Counter                                           |
//+------------------------------------------------------------------+
void TotalPositions()
{
//-----
  int Cnt=0;
//-----
  BearPositions=0; BullPositions = 0;
//-----
  for(Cnt=PositionsTotal()-1;Cnt>=0;Cnt--)
  {
    if(PositionGetSymbol(Cnt)==_Symbol)
    {
       if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_SELL && PositionGetDouble(POSITION_SL) == NULL)  BearPositions++;
       if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY  && PositionGetDouble(POSITION_SL) == NULL)  BullPositions++;
    }
  }
  return;
}
//+------------------------------------------------------------------+


Responded

1
Developer 1
Rating
(68)
Projects
78
27%
Arbitration
13
31% / 62%
Overdue
15
19%
Free
Published: 4 codes
2
Developer 2
Rating
(32)
Projects
53
36%
Arbitration
0
Overdue
0
Free
3
Developer 3
Rating
(588)
Projects
663
41%
Arbitration
2
100% / 0%
Overdue
1
0%
Working
Published: 9 codes
4
Developer 4
Rating
(83)
Projects
154
29%
Arbitration
1
100% / 0%
Overdue
27
18%
Free
5
Developer 5
Rating
(185)
Projects
241
20%
Arbitration
22
50% / 18%
Overdue
0
Working
6
Developer 6
Rating
(1)
Projects
1
0%
Arbitration
0
Overdue
0
Free
7
Developer 7
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
8
Developer 8
Rating
(361)
Projects
643
26%
Arbitration
92
72% / 14%
Overdue
12
2%
Working
Published: 1 code
Similar orders
Суть ТС:Приход в POI старшего тф, вход в позицию на младшем тф Анализ графика начинается всегда со старшего тф. Должен быть понятный контекст для работы. Активы: EURUSD, XAUUSD POI старшего таймфрейма: Liquidity (1M, 1W, 1D, 4H, 1H) Imbalance (1M, 1W, 1D, 4H, 1H) Order Block (1M, 1W, 1D, 4H, 1H) HTF Fractals (1M, 1W, 1D, 4H, 1H) Всегда дожидаться цену в POI старшего таймфрейма. Вход в позицию: Слом LTF структуры на
к примеру 10 стратегий выстреливают одновременно в одну и ту же милисекунду при открытие бара надо их сделать последовательными один за другим, с проверкой, что предыдущий ордер был открыт и модифицирован SL TP оредра могут быть отложенные и маркет пока один ордер исполняется другие ждут в очереди так как используется ММ настоящий баланс double Total_Current_Risk() { double res = 0; for (int i = 0; i <

Project information

Budget
34+ USD
Deadline
to 8 day(s)