포럼을 어지럽히 지 않도록 모든 초보자 질문. 프로, 놓치지 마세요. 너 없이는 아무데도 - 6. - 페이지 856

 
//+------------------------------------------------------------------+
//|                                                         SSMA.mq4 |
//|                                            Copyright 2014, Vinin |
//|                                             http://vinin.ucoz.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, Vinin"
#property link        "http://vinin.ucoz.ru"
#property version    "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 8
#property indicator_plots    1
//--- plot average
#property indicator_label1   "average"
#property indicator_type1   DRAW_ARROW
#property indicator_color1   clrRed
#property indicator_style1   STYLE_SOLID
#property indicator_width1   1
//--- input parameters
extern int       CountMA= 200 ;
extern int       Period_start = 1 ;
extern int       Period_shift = 5 ;
//--- indicator buffers
double          averageBuffer[];
double          maxBuffer[];
double          minBuffer[];
double          Label1Buffer[];
double          scBuf[][ 2 ];

double tmparray[],tmparrayF1[];
//double tmparrayD[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
   // массив tmparrayF1[] является индикаторным буфером
   SetIndexBuffer ( 0 ,tmparrayF1);
   PlotIndexSetInteger ( 0 , PLOT_ARROW , 159 );
   
   ArrayResize (tmparray, CountMA+ 1 );  // массив для рассчитанных SMA 
   ArrayResize (scBuf, CountMA+ 1 );     // массив для значений повторений на цене  
   ArrayResize (tmparrayF1, CountMA+ 1 ); // массив для перевода в одномерный массив для отображения на графике

//---
   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<Period_start+Period_shift*CountMA+ 1 ) return ( 0 );
   ArrayInitialize (tmparray, 0 );
   ArrayInitialize (scBuf, 0 );
   
   int limit=rates_total-prev_calculated;
   if (limit> 1 ) limit=rates_total-(Period_start+Period_shift*CountMA+ 1 );
   
   double min=- 99999 ,max= 99999 , sum= 0 ;
   int count, countMA,schet;
   
   for ( int i=limit;i>= 0 ;i--)
   {
      sum= 0 ;
      count= 0 ;
      countMA= 0 ;
       // формируем массив со значения машек
       for ( int j= 0 ;j<Period_start+Period_shift*CountMA;j++)
      {
         sum+=(High[i+j]+Low[i+j])* 0.5 ;
         count++;
         if (count==Period_start+Period_shift*countMA)
         {
            tmparray[countMA]=sum/count;
            countMA++;
         }          
      }    
       // Массив создан. Можно обрабатывать
   }
 //***** Рассчитать количество повторений SMA, в десятичном интервале.
   for ( int b= 0 ;b<CountMA;b++)
   {
     schet= 0 ;
     for ( int a =CountMA;a>= 0 ;a--) 
     {
       if ( NormalizeDouble (tmparray[a], 4 )== NormalizeDouble (tmparray[b], 4 )&&tmparray[a]!= 0 ) // 1.3000 0 = 1.3000 4
       {
         scBuf[b][ 0 ]=schet;                       // количество повторений МА
         scBuf[b][ 1 ]=tmparray[b];                 // Цена
         tmparray[a]= 0 ;                           // Обнуляем посчитанную ячейку
         schet++;
       }
     } 
   }
   
   ArraySort (scBuf, WHOLE_ARRAY , 0 ,MODE_DESCEND);   // Сортируем массив по убыванию
  
   for ( int x= 0 ;x<CountMA;x++) 
   {
     tmparrayF1[x]=scBuf[x][ 1 ];           //переносим значения цены в одномерный массив, для отображения через индикатор
   }  
     
      
Print ( "rates_total = " ,rates_total,
"tmparray = " ,tmparray[ 0 ]
, "KolVBuf " , scBuf[ 0 ][ 0 ], "+" ,scBuf[ 0 ][ 1 ]
       , "/ " ,scBuf[ 1 ][ 0 ], "+" ,scBuf[ 1 ][ 1 ]
       , "/ " ,scBuf[ 2 ][ 0 ], "+" ,scBuf[ 2 ][ 1 ]
       , "/ " ,scBuf[ 3 ][ 0 ], "+" ,scBuf[ 3 ][ 1 ]
       , "/ " ,scBuf[ 4 ][ 0 ], "+" ,scBuf[ 4 ][ 1 ]
       , "/ " ,scBuf[ 5 ][ 0 ], "+" ,scBuf[ 5 ][ 1 ]
     );

   
//--- return value of prev_calculated for next call
   return (rates_total);
  }

트롤링에 대해 관리자에게 미리 사과드립니다. 별도의 스레드 https://www.mql5.com/en/forum/154928 , !)))에 비슷한 질문이 있습니다.)

표적:

- 2000개 단위로 이동 평균값의 배열을 생성합니다.

- 결합된 SMA에서 형성된 씰, 십자로 표시합니다.

그 결과 십자가는 아무 것도 없는 곳에 무질서하게 흩어져 있습니다.

문제:

SMA 클러스터의 위치에 따라 십자가가 위치하지 않는 오류는 SMA 어레이의 형성에 있음이 밝혀졌습니다 || ..?

 

안녕하세요. 이 문제를 해결하는 방법을 알려주세요. 배열을 만드는 것이 필요합니다. 예는 다음과 같습니다. ........... 그리고 완전한 말장난으로 밝혀졌습니다. 무엇이 잘못되었는지 알려주세요. 고맙습니다.

 for ( int i= 1 ;i<= 20 ;i++)
     {
     for ( int j= 1 ;j<= 20 ;j++)
        {
         for ( int q= 1 ;q<= 20 ;q++)
           {
           
             M5gooB[i,j,q]= false ;
             Print ( "M5gooB " ,i, " " ,j, " " ,q, " false." );
             
           }
        }
     }
 

아니면 그냥 이렇게

 bool M5gooB[ 50 ],M5gooS[ 50 ];
   for ( int i= 1 ;i<= 50 ;i++)
     {
     M5gooB[i]= false ;
     
     }

인쇄는 혼란스러운 할당 구성을 인쇄합니다.

 
laveosa :

아니면 그냥 이렇게

인쇄는 혼란스러운 할당 구성을 인쇄합니다.

아마도 도움이 될 것입니다

 bool M5gooB[ 50 ],M5gooS[ 50 ];
   for ( int i= 0 ;i< 50 ;i++)
     {
     M5gooB[i]= false ;
     
     }
 

십자가(DRAW_ARROW) 대신에 점을 설정하는 방법을 아는 사람은 누구입니까?

- 전역 변수 에 포인트 개체를 추가하는 방법에 대한 표시기가 있습니다.

 //--- plot average
#property indicator_label1   "average"
#property indicator_type1   DRAW_ARROW
#property indicator_color1   clrRed
#property indicator_style1   STYLE_SOLID
#property indicator_width1   1

 
Top2n :

십자가(DRAW_ARROW) 대신에 점을 설정하는 방법을 아는 사람은 누구입니까?

- 전역 변수에 포인트 개체를 추가하는 방법에 대한 표시기가 있습니다.


글로벌:

 input uchar arrowsCodes0= 159 ; //Wingdings: >= 33 or <= 255

또는

 uchar arrowsCodes0= 159 ; //Wingdings: >= 33 or <= 255

https://docs.mql4.com/ru/constants/objectconstants/wingdings

int OnInit() 에서 다음과 같습니다.

SetIndexArrow( 0 ,arrowsCodes0);// https://docs.mql4.com/ru/customind/setindexarrow

이 같은.

 

왜 내 요점은 역사에만 그려져 있습니까? 전략 테스터 및 Windows 차트 창에서는 히스토리만 새 포인트가 그려지지 않습니다.

코드:

 double sellArrowsBuffer[];
double buyArrowsBuffer[];
double closeArrowsBuffer[];

int jbnbHandle;

void OnInit ()
{
....
    jbnbHandle = iCustom ( _Symbol , _Period , "Projects\\iJBNB" );
}


int OnCalculate (...)
{
     double cbearsColor[];
     double cbears[];

     int to_copy;

     if (prev_calculated > rates_total || prev_calculated <= 0 )
        to_copy = rates_total;
     else
        to_copy = rates_total - prev_calculated + 1 ;


     if ( CopyBuffer (jbnbHandle, 4 , 0 , to_copy, cbearsColor) != to_copy) 
         return 0 ;


     if ( CopyBuffer (jbnbHandle, 3 , 0 , to_copy, cbears) != to_copy) 
         return 0 ;

     for ( int i = 2 ; i < to_copy; i++)
    {    
         if (cbearsColor[i] == 2
            && cbearsColor[i - 1 ] == 1
            && cbears[i] > 0.2
            )
        {
            sellArrowsBuffer[i] = open[i] - symPoint * 30 ;
        }
    }

     return rates_total;
}

 
그런 걸 알려주세요 - 실시간으로 HLINE을 드래그할 때 라인 바로 옆에 있는 주문의 정류장/차익이 달라붙지 않도록 하는 방법은 무엇입니까? 원 클릭 거래를 끄려고했지만 도움이되지 않고 여전히 달라 붙습니다. 테스터에는 그러한 영향이 없습니다. OnChartEvent를 사용하고 싶습니다. (그런데, 이벤트는 테스터에서 처리되지 않고 실시간으로만 처리되나요?
 

좋은 오후입니다. 튜토리얼에는 전문가 https://book.mql4.com/en/samples/expert의 예가 포함되어 있습니다.

그가 한 촛불에 여러 번 구매/판매를 하는 이유를 말해주세요.


닫은 손절매를 보았다

 
Pyro :
그런 것을 알려주십시오 - 실시간으로 HLINE을 끌 때 라인 바로 옆에있는 주문의 중지 / 이익이 달라 붙지 않도록하는 방법은 무엇입니까? 원 클릭 거래를 끄려고했지만 도움이되지 않고 여전히 달라 붙습니다. 테스터에는 그러한 영향이 없습니다. OnChartEvent를 사용하고 싶습니다. (그런데, 이벤트는 테스터에서 처리되지 않고 실시간으로만 처리되나요?