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

메타트레이더 5. MQL5.Code Example. OnChartEvent. mouse, key.

by i.got.it 2018. 8. 24.


 

개요

 

MQL5 의 OnChartEvent 내에서 키 입력, 마우스 이벤트 처리하는 코드 예. 

관련 기본지식.
MQL5의 이벤트 :  http://igotit.tistory.com/1817
 
 


 


소스. 


/*
OnChartEvent key and mouse test.
*/
void OnChartEvent(const int id,
const long &lparam,
const double &dparam,
const string &sparam)
{
switch(id)
{
case CHARTEVENT_KEYDOWN: // key stroke. lparam=code of a key.
Alert(StringFormat("OnChartEvent:Keyboard key = %d pressed", lparam));
if(lparam == 0x42) // B key
{
Comment("keyboard b pressed");
}
else if(lparam == 0x53) // S key
{
Comment("keyboard s pressed");
}
break;
case CHARTEVENT_CLICK: // mouse left click. lpara=x dparam=y.
Alert("OnChartEvent:Mouse Click");
Comment(StringFormat("Mouse Click x=%d, y=%d", lparam, (long)dparam));
break;
}// switch(id)
}



상기 소스 코드에서 키별 코드 값은  http://igotit.tistory.com/218   에서 확인가능하다. 



실행화면. 















본 글 포함된 상위 정리글.


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


2. 메타트레이더 5 체계정리. 활용법/지식 :  http://igotit.tistory.com/1775





///1818.



비트코인




암호화폐       외환/나스닥/골드         암호화폐/외환/나스닥/골드
     
현물 |선물 인버스 |선물 USDT       전략매니저(카피트레이딩)         프랍 트레이더 온라인 지원가능. MT4,MT5