도움이 필요합니다 - 페이지 2

 
WHRoeder :
tickvalue 자체를 사용하지 마십시오 https://www.mql5.com/en/forum/133792/page3#512466

무슨 말을 하고 싶은지 이해할 수 없었고,

pipValue = ( MarketInfo ( Symbol (), MODE_TICKVALUE ))* 10 ;

공유한 링크에서도 요점을 이해하지 못했습니다. 내 코드에서

 if ( Digits == 5 || Digits == 3 )
   {            
      pips2dbl = Point * 10 ; pips2point = 10 ; pipValue = ( MarketInfo ( Symbol (), MODE_TICKVALUE ))* 10 ;
   } 
   else 
   {    
      pips2dbl = Point ;   pips2point = 1 ; pipValue = ( MarketInfo ( Symbol (), MODE_TICKVALUE ))* 1 ;
   }
   
   Slippage = pips2dbl*MaxSlippage;
   TP = pips2dbl*Limit_TP;
   SL = pips2dbl*Limit_SL;

수정해 주시겠습니까? 그래서 더 잘 이해할 수 있었습니다.

@RaptorUK 이번에는...

 int i,j,k;

and

int i = 0 , j, k;

둘 다 작동했고 오류가 없었습니다. 이상한. 그러나 여전히 나는 그것을 바꿨다.

 
지금 https://docs.mql4.com/indicators/iama를 어디에서 찾을 수 있습니까???
 
qgmql :
지금 https://docs.mql4.com/indicators/iama를 어디에서 찾을 수 있습니까???

고장나서 서비스 데스크에 티켓을 제출했습니다. . . 그 동안 . . .

아이마

이동 평균 표시기를 계산하고 해당 값을 반환합니다.

이중 iMA (
기호 , // 기호
정수 타임프레임 , // 타임프레임
정수 ma_period , // MA 평균 주기
정수 ma_shift , // MA 시프트
정수 ma_method , // 평균화 방법
정수 apply_price , // 적용 가격
정수 옮기다 // 옮기다
);

매개변수

상징

【인】 지표가 계산될 데이터의 기호 이름입니다. NULL 은 현재 기호를 의미합니다.

기간

【인】 기간. ENUM_TIMEFRAMES 열거형 값 중 하나일 수 있습니다. 0은 현재 차트 기간을 의미합니다.

ma_period

【인】 계산을 위한 평균 기간입니다.

ma_shift

【인】 MA 교대. 지표 라인 오프셋은 시간대별로 차트와 관련됩니다.

ma_method

【인】 이동 평균 방법. ENUM_MA_METHOD 열거형 값 중 하나일 수 있습니다.

적용 가격

【인】 적용된 가격입니다. ENUM_APPLIED_PRICE 열거형 값 중 하나일 수 있습니다.

옮기다

【인】 표시기 버퍼에서 가져온 값의 인덱스(주어진 기간 전에 현재 막대에 상대적으로 이동).

반환된 값

이동 평균 표시기의 숫자 값입니다.

예시:

AlligatorJawsBuffer[i]= iMA ( NULL ,0,13,8, MODE_SMMA , PRICE_MEDIAN ,i);

 
RaptorUK :

고장나서 서비스 데스크에 티켓을 제출했습니다. . . 그 동안 . . .

지원팀 2014.02.18 08:09
결정된. 고맙습니다.


아이마()
 

전문가가 기능 을 시작하려면 무엇을 사용해야 합니까?

 void ontick() {
}
return ;

//OR...

int start() {
}
return (o);

아니면 새 메타 편집기에서 둘 다 사용할 수 있습니까?

(나는 매우 기본적인 것에 대해 묻는 것 같지만 실제로는 지식이 전혀 없고 배우는 데 관심이 있습니다.)

 
qgmql :

전문가가 기능을 시작하려면 무엇을 사용해야 합니까?

아니면 새 메타 편집기에서 둘 다 사용할 수 있습니까?

(나는 매우 기본적인 것에 대해 묻는 것 같지만 실제로는 지식이 전혀 없고 배우는 데 관심이 있습니다.)

둘 중 하나를 사용할 수 있습니다. . . 그러나 향후 호환성을 위해 OnTick() 을 사용하십시오.
 

내 EA의 "LotsProgression" 기능에 대한 코드를 얻으려고 많이 시도했지만 혼란스럽습니다. 많은 진행을 위해 작성된 아래 소스의 코드를 강조 표시해 주시겠습니까? (그리고 여기 와 같이 소스의 일부를 강조 표시하는 방법도 알려주십시오.

 extern int expertId = 183547 ;
extern int TakeProfit= 40 ;
extern int StopLoss= 10 ;
extern int BreakevenStop = 30 ;

extern bool TimeEntry= true ;
extern string StartTime= "7:00" ;
extern string StopTime= "17:00" ;
extern bool PriceEntry= false ;
extern double Price= 1.5500 ;
extern bool FirstLong= false ;
extern string LotsProgression= "0.1;0.1;0.2;0.3;0.4;0.6;0.8;1.1;1.5;2.0;2.7;3.6;4.7;6.2;8.0;10.2;13.0;16.5;20.8;26.3;33.1;41.6;52.2;65.5;82.5;103.9;130.9;165;207.9;262;330.1;416;524.7;661.1" ;
extern bool RestartNewCycle = true ;

extern int     slippage= 3 ;       //slippage for market order processing
extern int     OrderTriesNumber= 10 ; //to repeat sending orders when you receive an error or requote

extern string     EAName= "PowerSM" ; 

bool buysig,sellsig,cycleended;
int tries, long , short ,co,plen,lord,mord,lpos;
double Lot,lots[],tlot,lop,lcp,lsl,ltp;

double lbid = - 1 ;

int counter = 0 ;

int init() 
{
   int i,j,k;
   string ls;
   while ( true ) {
        j= StringFind (LotsProgression, ";" ,i);
         if (j> 0 ) {
                ls= StringSubstr (LotsProgression,i,j-i);
                i=j+ 1 ;
                k++;
                 ArrayResize (lots,k);
                lots[k- 1 ]= StrToDouble (ls);
        } else {
                ls= StringSubstr (LotsProgression,i);
                k++;
                 ArrayResize (lots,k);
                lots[k- 1 ]= StrToDouble (ls);
                 break ;
        }
   }

   plen= ArraySize (lots);
}

void start()  {
   
   //---- check for history and trading
   if ( Bars < 100 || IsTradeAllowed ()== false ) return ;
   
   if (lbid == - 1 ) lbid = Bid ;

   co=CalculateCurrentOrders();
   if (co > 0 ) counter = 1 ;
      
   CheckForSignals();
   CheckForOpen();  
   DoBreakEven(BreakevenStop, 0 );
   
   lbid = Bid ;
}


int CalculateCurrentOrders() {
   int ord; string c;
//----
   for ( int i= 0 ;i< OrdersTotal ();i++) {
       if ( OrderSelect (i, SELECT_BY_POS , MODE_TRADES )== false ) break ;
       if ( OrderSymbol ()== Symbol () && OrderMagicNumber ()==expertId) {
         ord++;
         if ( OrderType ()== OP_BUY ) {
            mord= 1 ;
             if ( OrderClosePrice ()- OrderOpenPrice ()>BreakevenStop* Point ) tlot= MathAbs (tlot); else tlot=- MathAbs (tlot);
         }
         if ( OrderType ()== OP_SELL ) {
            mord=- 1 ;
             if (- OrderClosePrice ()+ OrderOpenPrice ()>BreakevenStop* Point ) tlot= MathAbs (tlot); else tlot=- MathAbs (tlot);
         }
         c= StringSubstr ( OrderComment (), 0 , StringFind ( OrderComment (), "_" , 0 ));
         lpos= StrToInteger (c);
         return (ord);
      }
   }
//---- return orders volume
   return (ord);
}

double GetLastTrade() 
{
   int ord; lord= 0 ;
   string c;
//----
   for ( int i= OrdersHistoryTotal ()- 1 ;i>= 0 ;i--) 
   {
       if (! OrderSelect (i, SELECT_BY_POS , MODE_HISTORY )) continue ;
       if ( OrderSymbol ()== Symbol () && OrderMagicNumber ()==expertId) 
      {
         if ( OrderType ()== OP_BUY ) lord= 1 ;
         if ( OrderType ()== OP_SELL ) lord=- 1 ;
         c= StringSubstr ( OrderComment (), 0 , StringFind ( OrderComment (), "_" , 0 ));
         lpos= StrToInteger (c);
         
         lop = NormalizeDouble ( OrderOpenPrice (), Digits );
         lcp = NormalizeDouble ( OrderClosePrice (), Digits );
         lsl = NormalizeDouble ( OrderStopLoss (), Digits );
         ltp = NormalizeDouble ( OrderTakeProfit (), Digits );
         
         if ( OrderProfit ()> 0 ) 
           return ( OrderLots ()); 
         else 
           return (- OrderLots ());
      }
   }
   return ( 0 );
}

bool IsEntryTime()
{
   datetime tm0 = TimeCurrent ();
   datetime tm1 = StrToTime ( TimeToStr (tm0, TIME_DATE ) + " " + StartTime);
   datetime tm2 = StrToTime ( TimeToStr (tm0, TIME_DATE ) + " " + StopTime);

   bool isTm = false ; 
   if (tm1 <= tm2) 
    isTm = isTm || (tm1 <= tm0 && tm0 < tm2);
   else
    isTm = isTm || (tm1 <= tm0 || tm0 < tm2);
  
   return (isTm);
}

void CheckForSignals() 
{
  buysig = false ;
  sellsig = false ;
      
         if (co > 0 ) return ;

   if (TimeEntry)
  {
     bool cond = IsEntryTime();
     if (!cond) return ;
  }

   if (PriceEntry)
  { 
    cond = (( Bid >= Price && lbid < Price) || ( Bid <= Price && lbid > Price));
     if (!cond) return ;
  }
        
         double lastlot = GetLastTrade();
         if (lastlot >= 0 )
        {
           if (counter > 0 )
          {
             if (!RestartNewCycle) return ;
          }
        
     if (FirstLong) 
      buysig = true ; 
     else 
      sellsig = true ;
      
    lpos = 0 ;
    Lot = lots[ 0 ];
        }

         else
        {
    lpos++;

     int BE = 0 ;
     if (lord > 0 && lcp == lop+BE* Point ) lpos--;
     if (lord < 0 && lcp == lop-BE* Point ) lpos--;

    Lot = lots[lpos];
     if (lord > 0 ) 
      sellsig = true ;
     else if (lord < 0 ) 
      buysig = true ;
  }
}

void CheckForOpen() {
   int     res,tr,TP;
   //---- sell conditions
   if (sellsig && co== 0 )  {
           Print ( "sell open " ,Lot, " " ,lpos);
      res = OpenAtMarket( OP_SELL ,Lot,TakeProfit,lpos);
           if (res> 0 ) { tlot=Lot; }
       return ;
   }
   //---- buy conditions
   if (buysig && co== 0 )  {
           Print ( "buy open " ,Lot, " " ,lpos);
      res = OpenAtMarket( OP_BUY ,Lot,TakeProfit,lpos);
           if (res> 0 ) { tlot=Lot; }
       return ;
   }
}
  
int OpenAtMarket( int mode, double lot, int TP, int pos) {
   int     res,tr,col;
   double openprice,sl,tp;
   tries= 0 ;
   while (res<= 0 && tries<OrderTriesNumber) {
      tr= 0 ; while (tr< 5 && ! IsTradeAllowed ()) { tr++; Sleep ( 2000 ); }
       RefreshRates ();
       if (mode== OP_SELL ) {
         openprice= Bid ; 
         if (StopLoss> 0 ) sl=openprice+StopLoss* Point ;
         if (TP> 0 ) tp=openprice-TP* Point ;
         col=Red;
      } else {
         openprice= Ask ;
         if (StopLoss> 0 ) sl=openprice-StopLoss* Point ;
         if (TP> 0 ) tp=openprice+TP* Point ;
         col=Blue;
      }
      res= OrderSend ( Symbol (),mode,lot,openprice,slippage,sl,tp,pos+ "_" +EAName+ "_" +expertId,expertId, 0 ,col);
      tries++;
   }
   Print ( "market order:: " , Symbol (), "  " ,mode, "  " ,lot, "  " ,openprice, "  " ,sl, "  " ,tp, "  " ,pos+ "_" +EAName+ "_" +expertId);
   if (res<= 0 ) Print ( "error opening order : " ,ErrorDescription(GetLastError()));
   return (res);
}


void DoBreakEven( int BP, int BE) {
   bool bres;
   for ( int i = 0 ; i < OrdersTotal (); i++) {
       if ( ! OrderSelect (i, SELECT_BY_POS ) )   continue ;
       if ( OrderSymbol () != Symbol () || OrderMagicNumber () != expertId )   continue ;
       if ( OrderType () == OP_BUY ) {
         if ( Bid < OrderOpenPrice ()+BP* Point ) continue ;
         if ( OrderOpenPrice ()+BE* Point - OrderStopLoss ()> Point / 10 ) {
               //Print(BP,"  ",BE," bestop");
               bres= OrderModify ( OrderTicket (), OrderOpenPrice (), OrderOpenPrice ()+BE* Point , OrderTakeProfit (), 0 , Black);
                                   if (!bres) Print ( "Error Modifying BE BUY order : " ,ErrorDescription(GetLastError()));
         }
      }

       if ( OrderType () == OP_SELL ) {
         if ( Ask > OrderOpenPrice ()-BP* Point ) continue ;
         if ( OrderStopLoss ()-( OrderOpenPrice ()-BE* Point )> Point / 10 ) {
               //Print(BP,"  ",BE," bestop");
               bres= OrderModify ( OrderTicket (), OrderOpenPrice (), OrderOpenPrice ()-BE* Point , OrderTakeProfit (), 0 , Gold);
                                   if (!bres) Print ( "Error Modifying BE SELL order : " ,ErrorDescription(GetLastError()));
         }
      }
   }
   return ;
}

/*
int FindPos(double ls) {
   for (int i=0; i<plen; i++) {
      if (NormalizeDouble(MathAbs(lots[i]-ls),3)<0.001) return(i);
   }
   return(-1);
}
*/
 
qgmql : 로트 진행을 위해 작성된 아래 소스의 코드를 강조 표시합니까? (또한 소스의 일부를 강조 표시 하는 방법을 알려주십시오.

  1. 초기화에서
    extern string LotsProgression= "0.1;0.1;0.2;0.3;0.4;0.6;0.8;1.1;1.5;2.0;2.7;3.6;4.7;6.2;8.0;10.2;13.0;16.5;20.8;26.3;33.1;41.6;52.2;65.5;82.5;103.9;130.9;165;207.9;262;330.1;416;524.7;661.1" ;
    된다
      double lots[]

  2. 들여쓰기를 수정하면 lot[] 이 사용되는 위치를 볼 수 있습니다.
     double lastlot = GetLastTrade();
    if (lastlot >= 0 ){
       if (counter > 0 ){
           if (!RestartNewCycle) return ;
       }
    
       if (FirstLong) buysig = true ; 
       else            sellsig = true ;
    
       lpos = 0 ;
       Lot = lots[ 0 ];
    }
    else {
       lpos++;
    
       int BE = 0 ;
       if (lord > 0 && lcp == lop+BE* Point ) lpos--;
       if (lord < 0 && lcp == lop-BE* Point ) lpos--;
    
       Lot = lots[lpos];
       if (lord > 0 )        sellsig = true ;
       else if (lord < 0 )   buysig = true ;
    }
    
  3. if (lord > 0 && lcp == lop+BE* Point )
    == 피연산자. - MQL4 포럼


 
qgmql :

내 EA의 "LotsProgression" 기능에 대한 코드를 얻으려고 많이 시도했지만 혼란스럽습니다.


뭐가 헷갈리나요? 문제를 설명할 수 있나요?
 

#property strict로 i,j,k를 값으로 초기화해야 한다고 생각합니다...


정수 i=0,j=0,k=0;

핍핍...짐단디