개요 | |
MQL5 의 OnChartEvent 내에서 키 입력, 마우스 이벤트 처리하는 코드 예. 관련 기본지식. MQL5의 이벤트 : http://igotit.tistory.com/1817 | |
|
소스.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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
|
///1818.
'트레이딩 > 메타트레이더 코딩' 카테고리의 다른 글
메타트레이더 5. MQL5. 클래스 CTrade. 주문처리. (2) | 2018.08.25 |
---|---|
메타트레이더 . MQL5 Storage. 원격저장소. 버전 관리. (0) | 2018.08.25 |
메타트레이더 5. MQL5 주문함수. OrderSend (9) | 2018.08.23 |
메타트레이더 5. MQL5 문자열 출력함수들. (0) | 2018.08.23 |
메타트레이더 5. MetaEditor. MQL5 EA 생성. (0) | 2018.08.19 |
댓글