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

 
TheXpert :
터미널에 "주문 마감" 이벤트가 없습니다. 따라서 스크립트 또는 고문만 있습니다. 위에 표시된 대로.

흠. 이벤트 이름은 무엇입니까 - "십자가"를 누를 때 - 미결 주문 마감?

이 작업을 수행하고 사운드를 "할당"해야 합니다.

 
paladin800 :

정말 감사합니다!

제 실수도 찾았습니다. 사실 "Buy_close" 조건은 프로그램이 거래를 하도록 지시하고 포지션의 존재에 대한 확인은 "Buy_opened"입니다.

거래가 종료되고 "Buy_close" 조건이 일치하므로 오류가 발생합니다.

나는 다음과 같이 조건을 만들었다.

 if (Buy_close && Buy_opened== true )
 
trora :

이 작업을 수행하고 사운드를 "할당"해야 합니다.

그럼 행운을 빕니다 :)
 

-0.30%의 오프셋으로 MA 라인을 그리는 것은 불가능합니다.

이동이 발생할 이동 평균 을 호출하는 데 문제가 없습니다. 그러나 오프셋 라인은 얻을 수 없습니다.  

메인 코드:

 #property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots    2
#property indicator_type1   DRAW_LINE
#property indicator_color1   clrMediumVioletRed
#property indicator_style1   STYLE_SOLID
#property indicator_label1   ""
#property indicator_type2   DRAW_LINE
#property indicator_color2   clrRed
#property indicator_style2   STYLE_SOLID
#property indicator_label2   "Sell TP
input int Period_ = 34 ;         //Период
int ma1Handle;
double ma1Val[]; 
double ExtMapBuffer1[];
double ExtMapBuffer2[]
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {   
SetIndexBuffer ( 0 ,ExtMapBuffer1, INDICATOR_DATA );
SetIndexBuffer ( 1 ,ExtMapBuffer2, INDICATOR_DATA )
ma1Handle= iMA ( _Symbol , _Period ,Period_, 0 , MODE_EMA , PRICE_CLOSE ); 
   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[])
  {
CopyBuffer (ma1Handle, 0 , 0 , 2 ,ma1Val);
ArraySetAsSeries (ma1Val, true );
int bars= Bars ( _Symbol , _Period );
for ( int i= 0 ;i<bars;i++)
{
ExtMapBuffer2[i]=ma1Val[ 0 ] - ((ma1Val[ 0 ]/ 100 )* 0.3 ); //ЗДЕСЬ НЕ ПОЛУЧАЕТСЯ ПОЛУЧИТЬ ЛИНИЮ
}
//---   
//--- return value of prev_calculated for next call
   return (rates_total);
  }
 
#property indicator_label2  "Sell TP
두 번째 견적은 어디에 있습니까?
 
CopyBuffer (ma1Handle, 0 , 0 , 2 ,ma1Val);
이 행은 루프에 있어야 하며 인덱싱되어야 합니다.
 
sandex :
이 행은 루프에 있어야 하며 인덱싱되어야 합니다.

문자열을 인덱싱하는 방법은 무엇입니까? 하려고 하면 오류가 나옵니다

 ArraySetAsSeries (ma1Val, true );
int bars= Bars ( _Symbol , _Period );
for ( int i= 0 ;i<bars;i++)
    {
     CopyBuffer (ma1Handle, 0 , 0 , 2 ,ma1Val[i]);
    ExtMapBuffer2[i]=ma1Val[i] - ((ma1Val[i]/ 100 )* 0.3 ); //ЗДЕСЬ НЕ ПОЛУЧАЕТСЯ ПОЛУЧИТЬ ЛИНИЮ
    }
 

다음과 같이 인덱싱해야 합니다.

 CopyBuffer (ma1Handle, 0 ,i, 1 ,ma1Val);
 

이 줄은 다음과 같아야 합니다.

ExtMapBuffer2[i]=ma1Val[ 0 ] - ((ma1Val[ 0 ]/ 100 )* 0.3 );
 

배열은 차원이 1인 정적으로 선언됩니다.

 double ma1Val[ 1 ];
사유: