본문 바로가기
트레이딩/메타트레이더 코딩

MQL5. EventChartCustom

by i.got.it 2019. 5. 11.

https://igotit.tistory.com/2156

 

Custom Event 발생예제코드. 

 

void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
{
   switch(id)
   {
      case CHARTEVENT_KEYDOWN:
         EventFire();          
      break; 
   }
}

// eventing to all charts except this chart.
void EventFire()
{
   long currChart = ChartFirst(); 

   int i=1;//1 for except current chart id =0 
   while(i<CHARTS_MAX)
   {      
      EventChartCustom(currChart,1,0,0,0); 
      currChart=ChartNext(currChart);
      if(currChart == -1) break;
      i++;
   }   
}

 

다른 챠트에서 상기 이벤트 수신처리하는 부분.

void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
{
     
   int id_event_custom;    

   if(id >= CHARTEVENT_CUSTOM && id <= CHARTEVENT_CUSTOM_LAST)
   {
      id_event_custom = id-CHARTEVENT_CUSTOM; 
      Print(id_event_custom);
      
      switch(id_event_custom)
      {
         case 1: 
         
            Print("event from other chart");    
            
         break;
      }
   }
}

 

 

 

 

연관 상세 정보. 

https://www.mql5.com/en/docs/eventfunctions/eventchartcustom

 

Documentation on MQL5: Working with Events / EventChartCustom

//+------------------------------------------------------------------+ //|                                            ButtonClickExpert.mq5 | //|                        Copyright 2009, MetaQuotes Software Corp. | //|                                        

www.mql5.com

https://www.mql5.com/en/forum/170560

 

Custom Event: Call from EA1 to EA2

Let's say in the same MT4 terminal there is one EA running on a EURUSD chart and one EA running on a GBPUSD chart...

www.mql5.com

https://www.mql5.com/en/forum/227307

불러오는 중입니다...

 

https://www.mql5.com/en/forum/151368

 

How to extend the Event data

The custom event can carry only very tiny data...

www.mql5.com

 

https://www.mql5.com/en/forum/7576

 

question to MetaQuotes - event handling queue

Hello MetaQuotes, I am currently preparing a flexible framework for multicurrency EA for the ATC2012 and therefore I would like to ask for clarific...

www.mql5.com

 

 

https://www.mql5.com/en/articles/1163

 

MQL5 Cookbook: Handling Custom Chart Events

This article considers aspects of design and development of custom chart events system in the MQL5 environment. An example of an approach to the events classification can also be found here, as well as a program code for a class of events and a class of cu

www.mql5.com

 

 

 

 

 

 본 글 포함된 상위 정리글

1. MQL5의 이벤트 : http://igotit.tistory.com/1817 의 OnChartEvent
 

 

 


첫등록 : 2019년 5월 11일 

최종수정 : 

 

본 글 단축주소 : https://igotit.tistory.com/2156

 


 

댓글



 

비트코인




암호화폐       외환/나스닥/골드       암호화폐/외환/나스닥/골드 암호화폐/외환/나스닥/골드   암호화폐/외환/나스닥/골드
     
현물 |선물 인버스 |선물 USDT       전략매니저(카피트레이딩)     롤오버 이자 없는 스왑프리계좌
( 스왑프리 암호화폐도 거래 가능 )    
MT4, MT5 , cTrader 모두 지원     FTMO 계좌 매매운용. MT4,MT5