Multicurrency - multitime advisor - page 5

 
Vladimir Karputov:

Ah, there it is :)

Then I politely take my leave.

If that's what it takes to solve my question, I'm willing to write what you're suggesting! I just don't understand why it's needed, can you tell me?

 
Vladimir Karputov:

Ah, there it is :)

Then I politely take my leave.


//+------------------------------------------------------------------+
//|                                                      ProjectName |
//|                                      Copyright 2012, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+
#property copyright   "Copyright 2013"
#property link        "http://"
#property description "email:"
#property version     "1.0"
//--- Количество торгуемых символов
#define  NUMBER_OF_SYMBOLS 5
//--- Количество периодов торгуемых символов
#define  NUMBER_OF_PERIODS 19
//--- Имя эксперта
#define  EXPERT_NAME MQL5InfoString(MQL5_PROGRAM_NAME)
//--- Массивы для хранения внешних параметров
string          Symbols[NUMBER_OF_SYMBOLS]={"EURUSD.m","USDCHF.m","GBPUSD.m","NZDUSD.m","AUDUSD.m"};// Символ
ENUM_TIMEFRAMES Periods[NUMBER_OF_PERIODS]=
  {
   PERIOD_M1,PERIOD_M2,PERIOD_M3,PERIOD_M4,PERIOD_M5,
   PERIOD_M6,PERIOD_M10,PERIOD_M12,PERIOD_M15,PERIOD_M20,
   PERIOD_M30,PERIOD_H1,PERIOD_H2,PERIOD_H3,PERIOD_H4,
   PERIOD_H6,PERIOD_H8,PERIOD_H12,PERIOD_D1
  };
//--- Массив хэндлов сигнальных индикаторов
int signal_indicator_handles[NUMBER_OF_SYMBOLS][NUMBER_OF_PERIODS];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnInit()
  {
//--- Получим хэндлы индикаторов
   Print("Загрузка хендлов ......");
   for(int s=0; s<NUMBER_OF_SYMBOLS; s++)
      for(int p=0; p<NUMBER_OF_PERIODS; p++)
        {
         //--- Получим хэндл индикатора
         signal_indicator_handles[s][p]=iCustom(Symbols[s],Periods[p],"adxcrossing");
         //--- Если не удалось получить хендл индикатора
         if(signal_indicator_handles[s][p]==INVALID_HANDLE)
            Print("Не удалось получить хэндл индикатора для символа "+Symbols[s]+"!");
        }
   Print("Загрузка окончена!!!");
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- При удалении с графика
   if(reason==REASON_REMOVE)
     {
      for(int s=0;s<NUMBER_OF_SYMBOLS;s++)
         for(int p=0;p<NUMBER_OF_PERIODS;p++)
            IndicatorRelease(signal_indicator_handles[s][p]);

     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick()
  {
   double ind_buy[1],ind_sell[];
   datetime t[1];
   for(int s=0;s<NUMBER_OF_SYMBOLS;s++)
      for(int p=0;p<NUMBER_OF_PERIODS;p++)
        {
         CopyTime(Symbols[s],Periods[p],0,1,t);
         //--- Получим значения индикатора
         if(CopyBuffer(signal_indicator_handles[s][p],0,0,1,ind_sell)<1 || CopyBuffer(signal_indicator_handles[s][p],1,0,1,ind_buy)<1)
           {
            Print("Не удалось скопировать значения ");
            return;
           }
         if(ind_buy[0]!=0 && Periods[p]==PERIOD_M1) Print(Symbols[s]," ",Periods[p]," ",ind_buy[0]," ",t[0]);
         if(ind_sell[0]!=0 && Periods[p]==PERIOD_M1) Print(Symbols[s]," ",Periods[p]," ",ind_sell[0]," ",t[0]);
        }
  }


5 currency pairs - 19 periods on each tick read indicator values - what next?)

 
Tango_X:
Maybe who knows another way to get a signal from the indicator from all periods and several currency pairs in EXPERT?

If possible, transfer the indicator code to a function (or several functions) and install it in the EA. I think everything will become much clearer.

 
Реter Konow:

If possible, transfer the indicator code to a function (or several functions) and install it in the EA. I think it will make a lot more sense.

This may not be necessary.

If I understand correctly, does the EA get a signal on a new bar?

 
Fast528:

dark forest this OnChartEvent, forgot it like a bad dream, Anatoly Kazarsky author of 648 also fought with it) there are long topics, multisymbol + multitimeframe at strong movements I think the chart will stand up, unlike OnTick this thing saves the queue

I don't understand what's so dark about it. It is a quite simple function. Maybe it is not used as intended?

 
Tango_X:

The problem is that my indicator is not giving a signal at a new bar but at a TICK event - what should I do?

A new bar event is always a tick event. By the way, in MT new bars appear at any second of the minute, not at the beginning of it. Hence, a new bar appears at any moment. If there are many symbols, new bar events will arrive asynchronously.

zy. Trying to understand your problem.
 
Реter Konow:

A new bar event is always a tick event. By the way, in MT new bars occur at any second of the minute, not at the beginning of the minute. Consequently, a new bar appears at any moment. If there are many symbols, new bar events will arrive asynchronously.

This is closer to my problem)

 
Tango_X:

This is closer to my problem.)

I feel I can help you, but I haven't got into the subject yet. I do not deal with indicators and Expert Advisors for a long time. But I want to remember.

 
Реter Konow:

I feel I can help you, but I haven't "got into it" yet. I have not dealt with indicators and advisers for a long time. But I want to remember.

I have described everything in detail in post #19, it's hard to explain in words)

 
Реter Konow:

I feel I can help you, but I haven't "got into it" yet. I have not dealt with indicators and advisers for a long time. But I want to remember.

The trick is that the onchartivent consists of a queue of events, so a new bar on strong moves arrives with the indicator data of the previous bar

Reason: