Convert Single Symbol function to Multi Symbol

MQL5 Indicadores Asesores Expertos

Trabajo finalizado

Plazo de ejecución 20 minutos
Comentario del Cliente
Highly recommended, Work delivered very fast and with 100% satisfaction,

Tarea técnica

ON an EA (not for trading but only for reading buffers) which has a function SearchZigZagExtremums

I want this function to be converted into multi symbols  multi period

below is my attempt to modify the free program which is available in mql codebase

//+------------------------------------------------------------------+
//|                           ZigZag EA(barabashkakvn's edition).mq5 |
//|                                   Copyright © 2009, Tokman Yuriy |
//|                                            yuriytokman@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Tokman Yuriy"
#property link      "yuriytokman@gmail.com"
#property version   "1.002"

//--- input parameters
input string      ____1___          = "Настройки индикатора ZigZag";
input int         ExtDepth          = 12;             // Depth
input int         ExtDeviation      = 5;              // Deviation
input int         ExtBackstep       = 3;              // Backstep
//---
//---
int            handle_iCustom;               // variable for storing the handle of the iCustom indicator
#define RESET 0
int min_rates_total;
int symbolCount;
string symbolsList[];
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit() {
//---
   min_rates_total=100;
//--- indicator buffers mapping
   symbolCount=SymbolsTotal(true);
   if( ArrayResize(symbolsList, symbolCount) < symbolCount ) return (INIT_FAILED);

//--- create handle of the indicator iCustom
   for(int i=0; i<symbolCount; i++) {
      symbolsList[i] = SymbolName(i,true);
      handle_iCustom=iCustom(symbolsList[i],Period(),"Examples\\ZigZag");
//--- if the handle is not created
      if(handle_iCustom==INVALID_HANDLE) {
         //--- tell about the failure and output the error code
         PrintFormat("Failed to create handle of the iCustom indicator for the symbol %s/%s, error code %d",
                     symbolsList[i],
                     EnumToString(Period()),
                     GetLastError());

         //--- the indicator is stopped early
         return(INIT_FAILED);
      }
   }

//---
   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason) {
//---

}
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick() {
//---

//---
for(int j=0; j<symbolCount; j++) {
      symbolsList[j] = SymbolName(j,true);
      
   double array_results[];
 
      if(!SearchZigZagExtremums(4,array_results))
         return;
         
      double high=0.0,low=0.0;
      double room_0 = array_results[0]; // index 0
      double room_1 = array_results[1]; // index 1
      double room_2 = array_results[2]; // index 2
      double room_3 = array_results[3]; // index 3

//--- находим верх и низ
      if(room_1>room_2) {
         high=room_1;
         low=room_2;
      } else {
         high=room_2;
         low=room_1;
      }
     
      Print(symbolsList[j], array_results[0]);
      Sleep(1000);
      }
      


//---

   }

//+------------------------------------------------------------------+
//| Search for indicator extremums                                   |
//+------------------------------------------------------------------+
   bool SearchZigZagExtremums(const int count,double &array_results[]) {
      if(!ArrayIsDynamic(array_results)) {
         Print("This a no dynamic array!");
         return(false);
      }
      ArrayFree(array_results);
      ArrayResize(array_results,count);
      ArraySetAsSeries(array_results,true);
      int      buffer_num=0;           // indicator buffer number
      double   arr_buffer[];
      ArraySetAsSeries(arr_buffer,true);
//--- reset error code
      ResetLastError();
//--- fill a part of the iCustom array with values from the indicator buffer
      int copied=CopyBuffer(handle_iCustom,buffer_num,0,100,arr_buffer);
      if(copied<0) {
         //--- if the copying fails, tell the error code
         PrintFormat("Failed to copy data from the iCustom indicator, error code %d",GetLastError());
         //--- quit with zero result - it means that the indicator is considered as not calculated
         return(false);
      }
      int elements=0;
      for(int i=0; i<copied; i++) {
         if(arr_buffer[i]!=0) {
            array_results[elements]=arr_buffer[i];
            elements++;
            if(elements==count)
               break;
         }
      }
      if(elements==count)
         return(true);
//---
      return(false);
   }


Goal : I want this program to be modified so it can read buffers 

      double room_0 = array_results[0]; // index 0
      double room_1 = array_results[1]; // index 1
      double room_2 = array_results[2]; // index 2
      double room_3 = array_results[3]; // index 3

for each symbol existed in marketwatch and when i print

Print(symbolsList[j], array_results[0]);

I get results like

Symbol_1 buffer_for_Symbol_1 for PERIOD_1

Symbol_2 buffer_for_Symbol_2 for PERIOD_2

like this

Han respondido

1
Desarrollador 1
Evaluación
(361)
Proyectos
643
26%
Arbitraje
92
72% / 14%
Caducado
12
2%
Trabaja
Ha publicado: 1 ejemplo
2
Desarrollador 2
Evaluación
(38)
Proyectos
50
10%
Arbitraje
1
0% / 0%
Caducado
8
16%
Libre
Solicitudes similares
Hi, I’m currently looking to purchase a profitable Expert Advisor (EA) for XAUUSD on MT4 and different Symbols . If you have an EA that has consistently been profitable, I’d be interested in purchasing the source code. I would like to backtest the strategy and evaluate it before making any purchases. What I’m ideally looking for: Designed specifically for XAUUSD (MT4) Consistent profitability with solid risk
Hello, good day to you Developers, I am looking for someone that can deliver on a project with the following requirements: The job I am about to give out will involve "Tradingview" and "Metatrader 5" Tradingview: for analysis, as the Strategy uses one second charts/candles, Metatrader 5: for executing and managing the trades. For this EA to work well for the project's aims, SPEED of execution is of upmost
Bhalzdeep 30+ USD
Anything is possible no job too big no job too small. Equal opportunity entity if we don't have it then we can get it. Completely satisfied customers is our top priority
1. Objective Create an MT5 automation script (or set of scripts) that fully automates my strategy optimization workflow, including: • Batch optimization runs • Automatic filtering of results • Automatic forward testing • Exporting and organizing results into structured files/folders The goal is to reduce manual work and allow one‑click execution of the entire pipeline. 2. Platform & Environment • MetaTrader 5 •
I'd like to optimize in Strategy Tester by Custom Optimization of strategies ran by Win Rate %. I can't find a way to view each scenario's win rate without running them individually and looking at Backtest
Would it be possible to connect Futures prop firm with Rithmic or Tradeovate platform to Ninjatrader automated trading ? If anyone can do this for me I will be happy to get started with the person right away
hello great developer I want to modify my NT8 indicator to change its arrow printing logic so that arrows appear on the first candled dot, not after the series. no repaint and no back painting. all in real time. This will help me get timely signals. Scope of work - Modify NT8 indicator logic to print arrows on the first candled dot. - Ensure arrow print matches 90%+ accuracy compared to the current functionality. -
Saya ingin dibuatkan Expert Advisor untuk MetaTrader 5 berbasis strategi EMA 50/200 + Breakout 20 candle dengan sistem risk percentage otomatis. EA harus memiliki fitur ATR stop loss, trailing stop, break even, max spread filter, dan daily loss limit. Dilarang menggunakan martingale, grid, atau averaging. Target RR minimal 1:2 dan drawdown di bawah 20%
I am building a professional-grade survival EA for USDJPY designed to: Repeatedly pass FTMO-style challenges Sustain long-term funded accounts Deploy safely across multiple prop accounts This is not a retail scalper. This is a controlled EMA pullback engine with strict risk governance and anti-correlation logic . All parameters must be configurable. Defaults must match exactly as listed. Core Strategy – EMA Pullback
I’m after someone to make me a forex ex for meta trader 5 it will be trading GBPUSD only but having to align with EURUSD and rules and entry’s based off weekly and daily vwap with 20 EMA

Información sobre el proyecto

Presupuesto
30+ USD