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

 
yiduwi :

덕분에. 그러나 화살표가 첫 번째 막대가 아닌 두 번째 막대에 있는 이유는 말하지 마십시오.

그래서 첫 번째 막대가 아닌 두 번째 막대에 화살표를 놓습니다. 자체적으로 그리지 않습니까? )))

아마도 여기에 하나의 BufferDN[i+1]=high[i+1]를 추가했을 것입니다.

 
Igor Makanu :

그래서 첫 번째 막대가 아닌 두 번째 막대에 화살표를 놓습니다. 자체적으로 그리지 않습니까? )))

아마도 여기에 하나의 BufferDN[i+1]=high[i+1]를 추가했을 것입니다.

와우 유닛없으면 일반적으로 화살표 3번째 막대에 꽂혀있고 코드가 작아서 어디서 망친거죠?

 #property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots    2
//--- plot UP
#property indicator_label1    "UP"
#property indicator_type1    DRAW_ARROW
#property indicator_color1    clrLawnGreen
#property indicator_style1    STYLE_SOLID
#property indicator_width1    1
//--- plot DN
#property indicator_label2    "DN"
#property indicator_type2    DRAW_ARROW
#property indicator_color2    clrDeepPink
#property indicator_style2    STYLE_SOLID
#property indicator_width2    1

//--- indicator buffers
double          BufferUP[];
double          BufferDN[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
//--- indicator buffers mapping
   SetIndexBuffer ( 0 ,BufferUP);
   SetIndexBuffer ( 1 ,BufferDN);
   PlotIndexSetInteger ( 0 , PLOT_ARROW , 233 );
   PlotIndexSetInteger ( 1 , PLOT_ARROW , 234 );

//---

   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[])
  {
//---
   if (rates_total< 3 ) return ( 0 );
   int limit=rates_total-prev_calculated;
   if (limit> 1 )
     {
      limit=rates_total- 3 ;
       ArrayInitialize (BufferUP, EMPTY_VALUE );
       ArrayInitialize (BufferDN, EMPTY_VALUE );
     }
   for ( int i=limit; i>= 0 ; i--)
     {
       if ( fabs (high[i+ 1 ]-high[i+ 2 ]) <= 0.0 * _Point )
        {
         BufferDN[i]=high[i];
        }
     }
//--- return value of prev_calculated for next call

   return (rates_total);
  }
첫 번째 막대에 배치된 경우
BufferDN[i+ 2 ]=high[i+ 2 ];
난 이해가 안 돼요.
 
Igor Makanu :

나는 해결책을 집어 들었지만 내 의견으로는 나는 무언가를 고려하지 않았다

논리적으로 모든 것이 맞습니다.

 
yiduwi :

와우 유닛없으면 일반적으로 화살표 3번째 막대에 꽂혀있고 코드가 작아서 어디서 망친거죠?

첫 번째 막대에 배치되어 있다면 이해가 되지 않습니다.

그럴수도 있지만 MT5로 글을 잘 안쓰는데 실수할수도 있어요

 //+------------------------------------------------------------------+
//|                                                          tst.mq5 |
//|                                                            IgorM |
//|                              https://www.mql5.com/ru/users/igorm |
//+------------------------------------------------------------------+
#property copyright "IgorM"
#property link        "https://www.mql5.com/ru/users/igorm"
#property version    "1.00"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots    2
//--- plot UP
#property indicator_label1    "UP"
#property indicator_type1    DRAW_ARROW
#property indicator_color1    clrLawnGreen
#property indicator_style1    STYLE_SOLID
#property indicator_width1    1
//--- plot DN
#property indicator_label2    "DN"
#property indicator_type2    DRAW_ARROW
#property indicator_color2    clrDeepPink
#property indicator_style2    STYLE_SOLID
#property indicator_width2    1

input int Pips= 5 ;
//--- indicator buffers
double          BufferUP[];
double          BufferDN[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
//--- indicator buffers mapping
   SetIndexBuffer ( 0 ,BufferUP);
   SetIndexBuffer ( 1 ,BufferDN);
   PlotIndexSetInteger ( 0 , PLOT_ARROW , 233 );
   PlotIndexSetInteger ( 1 , PLOT_ARROW , 234 );
//---
   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[])
  {
//---
   int limit=rates_total-prev_calculated;
   if (limit> 1 || prev_calculated== 0 )
     {
      limit=rates_total- 2 ;
       ArrayInitialize (BufferUP, EMPTY_VALUE );
       ArrayInitialize (BufferDN, EMPTY_VALUE );
     }
   for ( int i=limit; i>= 0 ; i--)
     {
       if ( fabs (high[i+ 1 ]-high[i])<= _Point *( double )Pips) BufferDN[i]=high[i];
     }
//--- return value of prev_calculated for next call
   return (rates_total);
  }
//+------------------------------------------------------------------+
 
Igor Makanu :

그럴수도 있지만 MT5로 글을 잘 못써서 실수할수도 있어요

또한, 그것은 나를 두 번째 막대에 넣습니다)

 
Igor Makanu :

고마워, 이것은 오류 중 하나이지만 여전히 159,002초에서 44시간 10분 2초를 얻는 방법을 알 수 없습니다(온라인 계산기))


나는 해결책을 집어 들었지만 내 의견으로는 나는 무언가를 고려하지 않았다

2019.06.18 11:46:22.691 tssts EURUSD,H1: h = 44 , m = 10 , s = 2

내 생각에는 더 쉽다

 int timeinsec = 159002 ;
 int sec = timeinsec% 60 ;
 int min = ((timeinsec-sec)% 3600 )/ 60 ;
 int hou = (timeinsec-sec-min)/ 3600 ;
 
yiduwi :

또한, 그것은 나를 두 번째 막대에 넣습니다)

화살표는 조건이 충족되는 곳에만 넣어야 하지만 그건 그렇고, MT5의 경우 처지는 조건을 완료하는 것이 더 낫다는 것을 기억했습니다.

 if ( fabs (high[i+ 1 ]-high[i])<= _Point *( double )Pips) BufferDN[i]=high[i]; else BufferDN[i]= EMPTY_VALUE ;
알렉세이 빅토로프 :

내 생각에는 더 쉽다

좋은! 감사하다! 네, 그게 바로 제가 원했던 것입니다!

 
Print 에 대한 호출 이 많은 코드가 있습니다. 인쇄 코드에서 제거하지 않고 모든 항목을 빠르게 비활성화/다시 활성화할 수 있습니까? 지금까지 내가 볼 수있는 유일한 옵션은 다음과 같습니다.
 bool L= true ;
if (L) Print ( "123" );

즉, 모든 "Print(" 를 "if(L)Print(" 로 바꾸십시오. 다른 옵션이 있습니까?

 
pivomoe :
Print 에 대한 호출 이 많은 코드가 있습니다. 인쇄 코드에서 제거하지 않고 모든 항목을 빠르게 비활성화/다시 활성화할 수 있습니까? 지금까지 내가 볼 수있는 유일한 옵션은 다음과 같습니다.

즉, 모든 "Print(" 를 "if(L)Print(" 로 바꾸십시오. 다른 옵션이 있습니까?

입력 매개변수에 "인쇄" 플래그를 표시합니다. 코드처럼 작동하며 플래그 자체(bool 변수)만 입력 매개변수에 있습니다.

 

안녕하세요 !

MT5 테스터의 모든 기호에 대한 최적화가 작동을 거부합니다...

깨우쳐주세요, 그녀를 설득하는 방법은 무엇입니까?

감사하다.

사유: