초보자의 질문 MQL5 MT5 MetaTrader 5 - 페이지 1337 1...133013311332133313341335133613371338133913401341134213431344...1503 새 코멘트 Кирилл Смирнов 2021.08.14 12:00 #13361 여기요! 함수의 구조 요소에 대한 변경 사항이 전역 수준에서 생성된 구조에 저장되도록 구조를 함수에 전달하는 방법을 알려주십시오. Vladimir Karputov 2021.08.14 12:34 #13362 Кирилл Смирнов : 여기요! 함수의 구조 요소에 대한 변경 사항이 전역 수준에서 생성된 구조에 저장되도록 구조를 함수에 전달하는 방법을 알려주십시오. 참조로 구조체를 전달합니다. 예시: //+------------------------------------------------------------------+ //| Expert 1.mq5 | //| Copyright © 2021, Vladimir Karputov | //+------------------------------------------------------------------+ #property copyright "Copyright © 2021, Vladimir Karputov" #property version "1.00" //+------------------------------------------------------------------+ //| Structure Positions | //+------------------------------------------------------------------+ struct STRUCT_POSITION { ENUM_POSITION_TYPE pos_type; // position type double volume; // position volume (if "0.0" -> the lot is "Money management") double lot_coefficient; // lot coefficient bool waiting_transaction; // waiting transaction, "true" -> it's forbidden to trade, we expect a transaction ulong waiting_order_ticket; // waiting order ticket, ticket of the expected order bool transaction_confirmed; // transaction confirmed, "true" -> transaction confirmed //--- Constructor STRUCT_POSITION() { pos_type = WRONG_VALUE ; volume = 0.0 ; lot_coefficient = 0.0 ; waiting_transaction = false ; waiting_order_ticket = 0 ; transaction_confirmed = false ; } }; STRUCT_POSITION SPosition; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit () { //--- //--- return ( INIT_SUCCEEDED ); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit ( const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick () { //--- Example(SPosition); Comment ( EnumToString (SPosition.pos_type)); } //+------------------------------------------------------------------+ //| Example | //+------------------------------------------------------------------+ void Example(STRUCT_POSITION &struct_position) { int res= MathRand (); if (res< 32767 / 2 ) struct_position.pos_type= POSITION_TYPE_BUY ; else struct_position.pos_type= POSITION_TYPE_SELL ; } //+------------------------------------------------------------------+ 파일: Expert_1.mq5 6 kb Kira27 2021.08.14 13:25 #13363 Vladimir Karputov : 참조로 구조체를 전달합니다. 예시: 고맙습니다! 이 예는 어디에서 왔습니까? 방금 내 질문에 대한 도움말을 찾았지만 찾지 못했습니다((( Vladimir Karputov 2021.08.14 14:05 #13364 Kira27 : 고맙습니다! 이 예는 어디에서 왔습니까? 방금 내 질문에 대한 도움말을 찾았지만 찾지 못했습니다((( 예를 들어 실제 구현 + 가상 기능. Kira27 2021.08.14 15:40 #13365 Vladimir Karputov : 예를 들어 실제 구현 + 가상 기능. 다시 한번 감사합니다! Alexey Viktorov 2021.08.14 16:56 #13366 Vladimir Karputov : 예를 들어 실제 구현 + 가상 기능. 나쁜 예. 구조와 전역 수준에서 선언된 모든 변수는 프로그램의 모든 부분에서 사용할 수 있습니다. 그것도 효과가 있을 것입니다. //+------------------------------------------------------------------+ //| Structure Positions | //+------------------------------------------------------------------+ struct STRUCT_POSITION { ENUM_POSITION_TYPE pos_type; // position type double volume; // position volume (if "0.0" -> the lot is "Money management") double lot_coefficient; // lot coefficient bool waiting_transaction; // waiting transaction, "true" -> it's forbidden to trade, we expect a transaction ulong waiting_order_ticket; // waiting order ticket, ticket of the expected order bool transaction_confirmed; // transaction confirmed, "true" -> transaction confirmed //--- Constructor STRUCT_POSITION() { pos_type = WRONG_VALUE ; volume = 0.0 ; lot_coefficient = 0.0 ; waiting_transaction = false ; waiting_order_ticket = 0 ; transaction_confirmed = false ; } }; STRUCT_POSITION SPosition; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit () { //--- //--- return ( INIT_SUCCEEDED ); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit ( const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick () { //--- Example(); Comment ( EnumToString (SPosition.pos_type)); } //+------------------------------------------------------------------+ //| Example | //+------------------------------------------------------------------+ void Example() { int res= MathRand (); if (res< 32767 / 2 ) SPosition.pos_type= POSITION_TYPE_BUY ; else SPosition.pos_type= POSITION_TYPE_SELL ; } //+------------------------------------------------------------------+ 또 다른 것은 구조 변수가 로컬로 선언된 경우입니다. //+------------------------------------------------------------------+ //| Structure Positions | //+------------------------------------------------------------------+ struct STRUCT_POSITION { ENUM_POSITION_TYPE pos_type; // position type double volume; // position volume (if "0.0" -> the lot is "Money management") double lot_coefficient; // lot coefficient bool waiting_transaction; // waiting transaction, "true" -> it's forbidden to trade, we expect a transaction ulong waiting_order_ticket; // waiting order ticket, ticket of the expected order bool transaction_confirmed; // transaction confirmed, "true" -> transaction confirmed //--- Constructor STRUCT_POSITION() { pos_type = WRONG_VALUE ; volume = 0.0 ; lot_coefficient = 0.0 ; waiting_transaction = false ; waiting_order_ticket = 0 ; transaction_confirmed = false ; } }; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit () { //--- //--- return ( INIT_SUCCEEDED ); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit ( const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick () { //--- STRUCT_POSITION SPosition; Example(SPosition); Comment ( EnumToString (SPosition.pos_type)); } //+------------------------------------------------------------------+ //| Example | //+------------------------------------------------------------------+ void Example(STRUCT_POSITION &struct_position) { int res= MathRand (); if (res< 32767 / 2 ) struct_position.pos_type= POSITION_TYPE_BUY ; else struct_position.pos_type= POSITION_TYPE_SELL ; } //+------------------------------------------------------------------+ Alexey Kolybelnikov 2021.08.15 11:48 #13367 안녕하세요. 여러 기기로 작업할 때 MT5는 기가바이트의 데이터를 로드합니다. 어떻게 든 설정에서 이것을 제한 할 수 있습니까? 동시에 차트의 월간, 주간, 일간 막대는 MT4와 같이 플롯됩니다. 즉, 각 막대는 불필요한 내부 이력 없이 (시가, 고가, 저가, 종가)로 표시됩니다. 그리고 이미 일중 막대가 있는 차트는 MT5의 현재 원칙(구현)에 따라 구축되었습니다. [ARCHIVE] 포럼을 어지럽히 지 무료로 어드바이저를 작성해 드립니다 라이브 데이터를 Excel로 내보내기 Valeriy Yastremskiy 2021.08.16 18:35 #13368 Vladimir Makhnin : MT5에서 단축키로 TF를 늘리거나 줄이는 방법은 무엇입니까? 거래, 자동 거래 시스템 및 거래 전략 테스트에 관한 포럼 지표: "단축키"를 사용하여 기간 변경 산알렉스 , 2020.08.07 11:59 mt4와 mt5는 같을 거라고 생각합니다. //+------------------------------------------------------------------+ //| hotKeys.mq5 | //| Copyright 2015,Mohit Marwaha | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, Mohit Marwaha" #property link "marwaha1@gmail.com" #property version "1.20" #property indicator_chart_window #property indicator_plots 0 #property description "Keys 1 through 9 change timeframes from 1 minute to Monthly" #define KEY_MONTHLY 57 #define KEY_WEEKLY 56 #define KEY_DAILY 55 #define KEY_4HOUR 54 #define KEY_1HOUR 53 #define KEY_30MIN 52 #define KEY_15MIN 51 #define KEY_5MIN 50 #define KEY_1MIN 49 //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit () { //--- indicator buffers mapping Comment ( "Copyright MohitMarwaha" ); //--- return ( INIT_SUCCEEDED ); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate ( const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- //--- return value of prev_calculated for next call return (rates_total); } //+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent ( const int id, const long &lparam, const double &dparam, const string &sparam) { //--- if (id== CHARTEVENT_KEYDOWN ) { switch ( int (lparam)) { case KEY_WEEKLY: ChartSetSymbolPeriod ( 0 , NULL , PERIOD_W1 ); break ; case KEY_DAILY: ChartSetSymbolPeriod ( 0 , NULL , PERIOD_D1 ); break ; case KEY_4HOUR: ChartSetSymbolPeriod ( 0 , NULL , PERIOD_H4 ); break ; case KEY_1HOUR: ChartSetSymbolPeriod ( 0 , NULL , PERIOD_H1 ); break ; case KEY_5MIN: ChartSetSymbolPeriod ( 0 , NULL , PERIOD_M5 ); break ; case KEY_30MIN: ChartSetSymbolPeriod ( 0 , NULL , PERIOD_M30 ); break ; case KEY_15MIN: ChartSetSymbolPeriod ( 0 , NULL , PERIOD_M15 ); break ; case KEY_MONTHLY: ChartSetSymbolPeriod ( 0 , NULL , PERIOD_MN1 ); break ; case KEY_1MIN: ChartSetSymbolPeriod ( 0 , NULL , PERIOD_M1 ); break ; } ChartRedraw (); } } //+------------------------------------------------------------------+ Kira27 2021.08.16 20:45 #13369 Alexey Viktorov : 나쁜 예. 구조와 전역 수준에서 선언된 모든 변수는 프로그램의 모든 부분에서 사용할 수 있습니다. 그것도 효과가 있을 것입니다. 또 다른 것은 구조 변수가 로컬로 선언된 경우입니다. 감사해요!!! Vladimir Makhnin 2021.08.17 10:50 #13370 Valeriy Yastremskiy : 감사해요 1...133013311332133313341335133613371338133913401341134213431344...1503 새 코멘트 트레이딩 기회를 놓치고 있어요: 무료 트레이딩 앱 복사용 8,000 이상의 시그널 금융 시장 개척을 위한 경제 뉴스 등록 로그인 공백없는 라틴 문자 비밀번호가 이 이메일로 전송될 것입니다 오류 발생됨 Google으로 로그인 웹사이트 정책 및 이용약관에 동의합니다. 계정이 없으시면, 가입하십시오 MQL5.com 웹사이트에 로그인을 하기 위해 쿠키를 허용하십시오. 브라우저에서 필요한 설정을 활성화하시지 않으면, 로그인할 수 없습니다. 사용자명/비밀번호를 잊으셨습니까? Google으로 로그인
여기요! 함수의 구조 요소에 대한 변경 사항이 전역 수준에서 생성된 구조에 저장되도록 구조를 함수에 전달하는 방법을 알려주십시오.
참조로 구조체를 전달합니다. 예시:
참조로 구조체를 전달합니다. 예시:
고맙습니다! 이 예는 어디에서 왔습니까? 방금 내 질문에 대한 도움말을 찾았지만 찾지 못했습니다(((
고맙습니다! 이 예는 어디에서 왔습니까? 방금 내 질문에 대한 도움말을 찾았지만 찾지 못했습니다(((
예를 들어 실제 구현 + 가상 기능.
예를 들어 실제 구현 + 가상 기능.
다시 한번 감사합니다!
예를 들어 실제 구현 + 가상 기능.
나쁜 예. 구조와 전역 수준에서 선언된 모든 변수는 프로그램의 모든 부분에서 사용할 수 있습니다.
그것도 효과가 있을 것입니다.
또 다른 것은 구조 변수가 로컬로 선언된 경우입니다.
MT5에서 단축키로 TF를 늘리거나 줄이는 방법은 무엇입니까?
거래, 자동 거래 시스템 및 거래 전략 테스트에 관한 포럼
지표: "단축키"를 사용하여 기간 변경
산알렉스 , 2020.08.07 11:59
mt4와 mt5는 같을 거라고 생각합니다.
나쁜 예. 구조와 전역 수준에서 선언된 모든 변수는 프로그램의 모든 부분에서 사용할 수 있습니다.
그것도 효과가 있을 것입니다.
또 다른 것은 구조 변수가 로컬로 선언된 경우입니다.
감사해요!!!