초보자의 질문 MQL5 MT5 MetaTrader 5 - 페이지 1111

 
Roman Sharanov :

변경된 사항은 없으며 e+321도 표시됩니다.

전체 코드를 표시하지 않았습니다. 표시기에서 데이터를 수신하는 배열의 종류와 차원이 무엇인지 알 수 없습니다.

 
아 제가 너무 멍청해서 초기화에서 멍청한 실수를 해서 다 안되네요 도와주셔서 감사합니다
 
Vitaly Muzichenko :

작동합니다. 가장 간단한 솔루션입니다!

 void OnStart ()
{
   double d = 1.5 ;
  
   Print (( long )d == d ? ( string )( long )d : ( string )d);
}
 
Roman Sharanov :

다음은 예입니다. 모든 표시기 버퍼 에서 막대 #0, 막대 #1 및 막대 #2의 세 가지 요소를 복사합니다.

각 버퍼에서 막대 #0의 값을 인쇄합니다.

 //+------------------------------------------------------------------+
//|                                           Simple Heiken_Ashi.mq5 |
//|                              Copyright © 2019, Vladimir Karputov |
//|                                           http://wmua.ru/slesar/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2019, Vladimir Karputov"
#property link        "http://wmua.ru/slesar/"
#property version    "1.000"
/*
   barabashkakvn Trading engine 3.025
*/
int     handle_iCustom;               // variable for storing the handle of the iCustom indicator 
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit ()
  {
//--- create handle of the indicator iCustom
   handle_iCustom= iCustom ( Symbol (), Period (), "Examples\\Heiken_Ashi" );
//--- if the handle is not created 
   if (handle_iCustom== INVALID_HANDLE )
     {
       //--- tell about the failure and output the error code 
       PrintFormat ( "Failed to create handle of the iCustom indicator for the symbol %s/%s, error code %d" ,
                   Symbol (),
                   EnumToString ( Period ()),
                   GetLastError ());
       //--- the indicator is stopped early 
       return ( INIT_FAILED );
     }
//---
   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit ( const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick ()
  {
//---
   double heiken_ashi_open[],heiken_ashi_high[],heiken_ashi_low[],heiken_ashi_close[];
   ArraySetAsSeries (heiken_ashi_open, true );
   ArraySetAsSeries (heiken_ashi_high, true );
   ArraySetAsSeries (heiken_ashi_low, true );
   ArraySetAsSeries (heiken_ashi_close, true );
   int start_pos= 0 ,count= 3 ;
   if (!iGetArray(handle_iCustom, 0 ,start_pos,count,heiken_ashi_open) || 
      !iGetArray(handle_iCustom, 1 ,start_pos,count,heiken_ashi_high) || 
      !iGetArray(handle_iCustom, 2 ,start_pos,count,heiken_ashi_low) || 
      !iGetArray(handle_iCustom, 3 ,start_pos,count,heiken_ashi_close))
     {
       return ;
     }
   Comment ( DoubleToString (heiken_ashi_open[ 0 ], Digits ()), "\n" ,
           DoubleToString (heiken_ashi_high[ 0 ], Digits ()), "\n" ,
           DoubleToString (heiken_ashi_low[ 0 ], Digits ()), "\n" ,
           DoubleToString (heiken_ashi_close[ 0 ], Digits ()));
  }
//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction ( const MqlTradeTransaction &trans,
                         const MqlTradeRequest &request,
                         const MqlTradeResult &result)
  {
//--- 

  }
//+------------------------------------------------------------------+
//| Get value of buffers                                             |
//+------------------------------------------------------------------+
double iGetArray( const int handle, const int buffer, const int start_pos,
                 const int count, double &arr_buffer[])
  {
   bool result= true ;
   if (! ArrayIsDynamic (arr_buffer))
     {
       Print ( "This a no dynamic array!" );
       return ( false );
     }
   ArrayFree (arr_buffer);
//--- reset error code 
   ResetLastError ();
//--- fill a part of the iBands array with values from the indicator buffer
   int copied= CopyBuffer (handle,buffer,start_pos,count,arr_buffer);
   if (copied!=count)
     {
       //--- if the copying fails, tell the error code 
       PrintFormat ( "Failed to copy data from the indicator, error code %d" , GetLastError ());
       //--- quit with zero result - it means that the indicator is considered as not calculated 
       return ( false );
     }
   return (result);
  }
//+------------------------------------------------------------------+
파일:
 
fxsaber :

이것은 매우 "가벼움"이 필요한 것입니다. 고맙습니다!

 

MT5 터미널 공통 폴더 경로를 알려주세요

 //--- открытие файла для записи, с флагом совестного пользования для чтения
   int han= FileOpen (subfolder+ "\\experts\\files\\" +folder+ ".csv" , FILE_WRITE | FILE_SHARE_READ | FILE_ANSI , "," );
   if (han!= INVALID_HANDLE ) // если файл открыт удачно
     {
       //ЗДЕСЬ ПРОЦЕДУРА ЗАПИСИ В ФАЙЛ
     }
 
yiduwi :

MT5 터미널 공통 폴더 경로를 알려주세요

FILE_COMMON 플래그는 모든 클라이언트 터미널의 공통 폴더를 담당합니다.

Документация по MQL5: Константы, перечисления и структуры / Константы ввода/вывода / Флаги открытия файлов
Документация по MQL5: Константы, перечисления и структуры / Константы ввода/вывода / Флаги открытия файлов
  • www.mql5.com
Файл открывается для чтения. Флаг используется при открытии файлов (FileOpen()). При открытии файла обязательно должен быть указан флаг FILE_WRITE и/или флаг FILE_READ Файл открывается для записи. Флаг используется при открытии файлов (FileOpen()). При открытии файла обязательно должен быть указан флаг FILE_WRITE и/или флаг FILE_READ Файл...
 
yiduwi :

MT5 터미널 공통 폴더 경로를 알려주세요

플래그 추가 FILE_COMMON

https://www.mql5.com/ru/docs/constants/io_constants/fileflags

폴더 찾기: 터미널에서: 파일 - 데이터 디렉토리 열기 - Windows 탐색기에서 한 수준 위로 올라가면 \Common\Files 폴더가 있습니다.

 
감사해요
 
좋은 하루, 동료 프로그래머! 어리석은 질문을 용서해 주십시오. 그러나 마음의 평화를 얻지는 못합니다. 프로그램은 어떻게 실행됩니까, 또는 더 정확하게는 터미널이 행을 어떻게 읽습니까? 실행 순서는 무엇입니까 ??? 아니면 모든 일이 어떻게 일어나는지 보고 이해할 수 있는 일종의 비디오가 있습니까? 아토는 프로그램에서 어떻게 읽는지도 모르고 언어를 배우는 것은 어렵다!!!
사유: