MQL4 및 MQL5에 대한 초보자 질문, 알고리즘 및 코드에 대한 도움말 및 토론 - 페이지 1374

 
Andrey Sokolov :

이것은 외환 브로커 또는 무엇입니까?

BANK입니다.
 
MakarFX :
BANK입니다.

명확하지 않습니다. 알겠습니다.

그들은 MICEX(FORTS)에 있는 것을 기록하고 Alpari에서도 경쟁 계정 에 있는 내용을 말했습니다.

아마도 " 만", "항상"이라는 표현으로. "절대", "아무도" 등은 더욱 조심해야 합니다.

일반 거래 계정에서 다음과 같은 상황 알려주세요.   브로커 폐쇄   오픈 포지션   그리고 재발견이 일어났습니까?
 
Andrey Sokolov :

명확하지 않습니다.

그들은 MICEX(FORTS)에 있는 것을 기록하고 Alpari에서도 경쟁 계정 에 있는 내용을 말했습니다.

아마도 " 만", "항상"이라는 표현으로. "절대", "아무도" 등은 더욱 조심해야 합니다.

일반 거래 계정에서 다음과 같은 상황 알려주세요.   브로커 폐쇄   오픈 포지션   그리고 재발견이 일어났습니까?
이것은 개별입니다. 우크라이나에서는 법률에 따라 은행이 당일 외환 시장에서 거래를 마감합니다(예: 보고용).
 
친애하는 프로. 도움이 필요하다. 예를 들어 MACD 표시기 가 있습니다. 구조는 iMACD(NULL,0,InpFastEMA,InpSlowEMA,InpSignalSMA,PRICE_CLOSE,MODE_MAIN,0)입니다. 이 통화 쌍이 아닌 동일한 차트의 다른 통화 쌍에 대한 계산을 얻기 위해 NULL을 변경하는 방법은 무엇입니까? iMACD("USDJPY",0,InpFastEMA,InpSlowEMA,InpSignalSMA,PRICE_CLOSE,MODE_MAIN,0)를 수행했지만 아무 것도 발생하지 않습니다. 모든 계산은 0입니다. 옳지 않은 것은?
 
Michail_David :
친애하는 프로. 도움이 필요하다. 예를 들어 MACD 표시기 가 있습니다. 구조는 iMACD(NULL,0,InpFastEMA,InpSlowEMA,InpSignalSMA,PRICE_CLOSE,MODE_MAIN,0)입니다. 이 통화 쌍이 아닌 동일한 차트의 다른 통화 쌍에 대한 계산을 얻기 위해 NULL을 변경하는 방법은 무엇입니까? iMACD("USDJPY",0,InpFastEMA,InpSlowEMA,InpSignalSMA,PRICE_CLOSE,MODE_MAIN,0)를 수행했지만 아무 것도 발생하지 않습니다. 모든 계산은 0입니다. 옳지 않은 것은?

시장 리뷰에 "USDJPY" 기호가 있습니까?

 
Michail_David :
친애하는 프로. 도움이 필요하다. 예를 들어 MACD 표시기 가 있습니다. 구조는 iMACD(NULL,0,InpFastEMA,InpSlowEMA,InpSignalSMA,PRICE_CLOSE,MODE_MAIN,0)입니다. 이 통화 쌍이 아닌 동일한 차트의 다른 통화 쌍에 대한 계산을 얻기 위해 NULL을 변경하는 방법은 무엇입니까? iMACD("USDJPY",0,InpFastEMA,InpSlowEMA,InpSignalSMA,PRICE_CLOSE,MODE_MAIN,0)를 수행했지만 아무 것도 발생하지 않습니다. 모든 계산은 0입니다. 옳지 않은 것은?

그리고 그렇게 속이면

GBPJPYH4

 //+------------------------------------------------------------------+
//|                                                 ExamplesMACD.mq5 |
//|                   Copyright 2009-2020, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright    "2009-2020, MetaQuotes Software Corp."
#property link          "http://www.mql5.com"
#property description "Moving Average Convergence/Divergence"
#include <MovingAverages.mqh>
//--- indicator settings
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_plots    2
#property indicator_type1    DRAW_HISTOGRAM
#property indicator_type2    DRAW_LINE
#property indicator_color1   Silver
#property indicator_color2   Red
#property indicator_width1    2
#property indicator_width2    1
#property indicator_label1    "Examples MACD"
#property indicator_label2    "Examples Signal"
//--- input parameters
input string              InpPara= "USDJPY" ;             // Para
input int                 InpFastEMA= 12 ;               // Fast EMA period
input int                 InpSlowEMA= 26 ;               // Slow EMA period
input int                 InpSignalSMA= 9 ;               // Signal SMA period
input ENUM_APPLIED_PRICE InpAppliedPrice= PRICE_CLOSE ; // Applied price
//--- indicator buffers
double ExtMacdBuffer[];
double ExtSignalBuffer[];
double ExtFastMaBuffer[];
double ExtSlowMaBuffer[];

int     ExtFastMaHandle;
int     ExtSlowMaHandle;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void OnInit ()
  {
//--- indicator buffers mapping
   SetIndexBuffer ( 0 ,ExtMacdBuffer, INDICATOR_DATA );
   SetIndexBuffer ( 1 ,ExtSignalBuffer, INDICATOR_DATA );
   SetIndexBuffer ( 2 ,ExtFastMaBuffer, INDICATOR_CALCULATIONS );
   SetIndexBuffer ( 3 ,ExtSlowMaBuffer, INDICATOR_CALCULATIONS );
//--- sets first bar from what index will be drawn
   PlotIndexSetInteger ( 1 , PLOT_DRAW_BEGIN ,InpSignalSMA- 1 );
//--- name for indicator subwindow label
   string short_name= StringFormat ( "ExamplesMACD(%d,%d,%d)" ,InpFastEMA,InpSlowEMA,InpSignalSMA);
   IndicatorSetString ( INDICATOR_SHORTNAME ,short_name);
//--- get MA handles
   ExtFastMaHandle= iMA ( InpPara , 0 ,InpFastEMA, 0 , MODE_EMA ,InpAppliedPrice);
   ExtSlowMaHandle= iMA ( InpPara , 0 ,InpSlowEMA, 0 , MODE_EMA ,InpAppliedPrice);
  }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
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[])
  {
   if (rates_total<InpSignalSMA)
       return ( 0 );
//--- not all data may be calculated
   int calculated= BarsCalculated (ExtFastMaHandle);
   if (calculated<rates_total)
     {
       Print ( "Not all data of ExtFastMaHandle is calculated (" ,calculated, " bars). Error " , GetLastError ());
       return ( 0 );
     }
   calculated= BarsCalculated (ExtSlowMaHandle);
   if (calculated<rates_total)
     {
       Print ( "Not all data of ExtSlowMaHandle is calculated (" ,calculated, " bars). Error " , GetLastError ());
       return ( 0 );
     }
//--- we can copy not all data
   int to_copy;
   if (prev_calculated>rates_total || prev_calculated< 0 )
      to_copy=rates_total;
   else
     {
      to_copy=rates_total-prev_calculated;
       if (prev_calculated> 0 )
         to_copy++;
     }
//--- get Fast EMA buffer
   if ( IsStopped ()) // checking for stop flag
       return ( 0 );
   if ( CopyBuffer (ExtFastMaHandle, 0 , 0 ,to_copy,ExtFastMaBuffer)<= 0 )
     {
       Print ( "Getting fast EMA is failed! Error " , GetLastError ());
       return ( 0 );
     }
//--- get SlowSMA buffer
   if ( IsStopped ()) // checking for stop flag
       return ( 0 );
   if ( CopyBuffer (ExtSlowMaHandle, 0 , 0 ,to_copy,ExtSlowMaBuffer)<= 0 )
     {
       Print ( "Getting slow SMA is failed! Error " , GetLastError ());
       return ( 0 );
     }
//---
   int start;
   if (prev_calculated== 0 )
      start= 0 ;
   else
      start=prev_calculated- 1 ;
//--- calculate MACD
   for ( int i=start; i<rates_total && ! IsStopped (); i++)
      ExtMacdBuffer[i]=ExtFastMaBuffer[i]-ExtSlowMaBuffer[i];
//--- calculate Signal
   SimpleMAOnBuffer(rates_total,prev_calculated, 0 ,InpSignalSMA,ExtMacdBuffer,ExtSignalBuffer);
//--- OnCalculate done. Return new prev_calculated.
   return (rates_total);
  }
//+------------------------------------------------------------------+
 
Alexey Viktorov :

시장 리뷰에 "USDJPY" 기호가 있습니까?

네. 현재, 빅터.

 
SanAlex :

그리고 그렇게 속이면

알렉스, 작동하지 않습니다. 이 지표에는 두 통화 쌍에 대해 두 MACD를 동시에 그리는 것이 포함됩니다. 그리고 이 코드를 사용하면 불가능할 정도로 부풀려집니다. 동시에 상관 계산을 추가하고 싶습니다. 그러나 감사합니다. 통화 쌍을 표시해야 하는 형식에 대한 정보를 제공했습니다.

 

내가 올바르게 이해했다면 통화 쌍은 표시기에서 통화 쌍을 지정할 때 "EURUSD"와 같은 형식으로 표시되어야 합니다. 이와 관련하여 질문


 void OnInit ()

  {
input string Currency = "JPY" ; //Выбор валютной пары
input string Major_pair = "USD" ; // Выбор валюты для корреляции
input bool Direct_correlation = true ; // Выбор прямой и обратной корреляции
string Major_currpair = Symbol ();
string two_pair;
//--------------------------------------------------------------------
int position = StringFind (Major_currpair,Major_pair, 0 );
   if (position == - 1 )
       Print ( "Не верно указана валюта корреляции" );
   if (Direct_correlation == true )
      two_pair = StringConcatenate (Currency,Major_pair);
   else
      two_pair = StringConcatenate (Major_pair,Currency);
   Print ( "Two_pair = " , two_pair);
   Print ( "Major_currpair = " ,Major_currpair);
}

문자 "를 문자열에 삽입하려면 어떻게 해야 합니까? 통화 쌍이 로그에 "USDJPY"가 아닌 USDJPY로 인쇄되기 때문입니다.

 
Michail_David :

문자 "를 문자열에 삽입하려면 어떻게 해야 합니까? 통화 쌍이 로그에 "USDJPY"가 아닌 USDJPY로 인쇄되기 때문입니다.

https://www.mql5.com/ru/docs/basis/types/stringconst

https://www.mql5.com/ru/docs/basis/types/integer/symbolconstants