흥미로운 거래 아이디어가 있습니다. 코드(mql4)에서 오류를 찾는 데 도움을 주세요. - 페이지 17

 
Karputov Vladimir :

코드를 올바르게 붙여넣으십시오 . 포럼에 코드를 올바르게 붙여넣었습니다(메시지 수정).

추가됨: 코드 스타일러 를 사용하는 것이 좋습니다. 오류를 감지하는 데 도움이 됩니다( 소스 코드 작업: Styler - 프로그램 개발 ).

업데이트된 기능을 사용하기 위한 강력한 권장 사항을 추가하겠습니다.

~와 같은

 int OnInit ()
 void OnTick ()

다른...

 
vladislavch19 :

어드바이저 '}'에서 2개의 오류를 수정하는 데 도움을 줄 수 있는 위치 또는 도움을 줄 사람을 알려주십시오. 프로그램이 예기치 않게 종료됩니다. '{' - 불균형 괄호 TMA.mq4



Uuuuuuuh 얼마나 많은 구문 오류.

 //+------------------------------------------------------------------+
//|                                                      ProjectName |
//|                                      Copyright 2012, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+
extern int    TakeProfit       = 100 ;
extern int    StopLoss         = 50 ;
extern double Lots            = 0.01 ;
extern int     Slippage        = 5 ;
extern string comment         = "Продажа" ;
extern int     Megic           = 123 ;
extern string Indi            = "данные индикатора" ;
extern string TimeFrame= "current time frame" ; //текущее время кадра
extern int     HalfLength      = 56 ;
extern int     Price           = PRICE_CLOSE ;
extern double ATRMultiplier   = 2.0 ;
extern int     ATRPeriod       = 100 ;
extern bool    Interpolate     = true ;

double PriceHigh,PriceLow,SL,TP;
int ticket;
bool res;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   if ( Digits == 3 || Digits == 5 )
     {
      TakeProfit*= 10 ;
      StopLoss*= 10 ;
      Slippage*= 10 ;
     }
   return ( 0 );
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()

  {
   PriceHigh= iCustom ( Symbol (), 0 , "TMA with Distancer" ,TimeFrame,HalfLength,Price,ATRMultiplier,ATRPeriod,Interpolate, 1 , 0 );
   PriceLow= iCustom ( Symbol (), 0 , "TMA with Distancer" ,TimeFrame,HalfLength,Price,ATRMultiplier,ATRPeriod,Interpolate, 2 , 0 );

   if ( Bid >=PriceHigh)
     {
      SL= NormalizeDouble ( Bid +StopLoss* Point , Digits );
      TP= NormalizeDouble ( Bid -TakeProfit* Point , Digits );

      ticket= OrderSend ( Symbol (), OP_SELL ,Lots, Bid ,Slippage, 0 , 0 ,comment, 123 , 0 ,Maroon);

       if (ticket> 0 )
        {
         if ( OrderSelect (ticket, SELECT_BY_TICKET )== true )
            res= OrderModify (ticket, OrderOpenPrice (),SL,TP, 0 );
        }
     }

   if ( Ask <PriceLow)
     {
      SL= NormalizeDouble ( Ask -StopLoss* Point , Digits );
      TP= NormalizeDouble ( Ask +TakeProfit* Point , Digits );

      ticket= OrderSend ( Symbol (), OP_BUY ,Lots, Ask ,Slippage, 0 , 0 ,comment, 123 , 0 , clrDarkBlue );

       if (ticket> 0 )
        {
         if ( OrderSelect (ticket, SELECT_BY_TICKET )== true )
            res= OrderModify (ticket, OrderOpenPrice (),SL,TP, 0 );
        }
     }
   return ( 0 );
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CountSell()
  {
   int count= 0 ;
   for ( int trede= OrdersTotal ()- 1 ;trede>= 0 ;trede--)
     {
       if ( OrderSelect (trede, SELECT_BY_POS , MODE_TRADES ))
        {
         if ( OrderSymbol ()== Symbol () && OrderMagicNumber ()==Megic)
           {
             if ( OrderType ()== OP_SELL )count++;
           }
        }
     }
   return (count);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CountBuy()
  {
   int count= 0 ;
   for ( int trede= OrdersTotal ()- 1 ;trede>= 0 ;trede--)
     {
       if ( OrderSelect (trede, SELECT_BY_POS , MODE_TRADES ))
        {
         if ( OrderSymbol ()== Symbol () && OrderMagicNumber ()==Megic)
           {
             if ( OrderType ()== OP_BUY )count++;
           }
        }
     }
   return (count);
  }
//+------------------------------------------------------------------+
 
아침에 나는 그것을 실제에 두기로 결정했지만 올빼미의 마지막 버전이 유지하지 않는 것, 첫 번째 옵션이 중단 된 것 같으며이 6은 날아가고 재부팅됩니다. 데모에서 잘 작동했습니다 ... 아니면 너무 좋은 - 그들은 그것이 작동하도록 두지 않습니다 ...))
 
Сергей Криушин :
아침에 나는 그것을 실제에 두기로 결정했지만 올빼미의 마지막 버전이 유지하지 않는 것, 첫 번째 옵션이 중단 된 것 같으며이 6은 날아가고 재부팅됩니다. 데모에서 잘 작동했습니다 ... 아니면 너무 좋은 - 그들은 그것이 작동하도록 두지 않습니다 ...))
나는 일반 청소를했습니다 - 이제 가치가 있습니다 ... 코드에서 13 개의 트로이 목마를 청소했습니다 ... 오래된 MT5 ... robo는 오랫동안 사용되지 않았습니다 ... 분명히 그들은 축적, 숨겼습니다 ...
 
Сергей Криушин :
아침에 나는 그것을 실제에 두기로 결정했지만 올빼미의 마지막 버전이 유지하지 않는 것, 첫 번째 옵션이 중단 된 것 같으며이 6은 날아가고 재부팅됩니다. 데모에서 잘 작동했습니다 ... 아니면 너무 좋은 - 그들은 그것이 작동하도록 두지 않습니다 ...))
d 충돌할 때 로그에 무엇이라고 표시됩니까? 오늘 나는 MT5를 위해 Martin과 함께 crossed EA를 다시 작성하는 것을 마쳤습니다.
 
Sergey Gritsay :
d 충돌할 때 로그에 무엇이라고 표시됩니까? 오늘 나는 MT5를 위해 Martin과 함께 crossed EA를 다시 작성하는 것을 마쳤습니다.
나도 몰라, 난 이미 그것을 만지기가 두렵다 ... 그리고 위험한 사람들을위한 마틴조차도, 또는 그냥 판매를 위해 - 대담하게 $ 1000를 걸었습니다 - 그들은 오늘날에도 실생활에서 관심을 가지고 갚을 것입니다. 이익은 $ 3에서 나갔습니다 ... 그래서 갈 것입니다 ... 그리고 내가 욕심을 부리지 않으면 아마도 소금을 먹지 않을 것이므로 두어 개의 계정을 더 열 수 있습니다 ... 대단히 감사합니다 .. .))
 
Сергей Криушин :

여기 보고서가 있습니다 ... 그리고 이것은 두 번째 돌파구입니다 ...

내가 무슨 말을 할 수 있습니까?
 
오류 'ST' 쓰기 - 선언되지 않은 식별자 test3.mq4 69 13 및 유형 변환으로 인한 데이터 손실 가능성 test3.mq4 85 열 다섯

extern string TMA= "Параметры" ;
extern int    TakeProfit       = 100 ;
extern int    StopLoss         = 50 ;
extern int     Megic           = 123 ;
extern double Lots            = 0.01 ;
extern int     Slippage        = 5 ;
extern string TimeFrame       = "current time frame" ;
extern int     HalfLength      = 56 ;
extern int     Price           = PRICE_CLOSE ;
extern double ATRMultiplier   = 2.0 ;
extern int     ATRPeriod       = 100 ;
extern bool    Interpolate     = true ;


double PriceHigh,PriceLow,SL,TP;
int ticket;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit ()
  {

   if ( Digits == 3 || Digits == 5 )
     {

      TakeProfit*= 10 ;
      StopLoss*= 10 ;
      Slippage*= 10 ;
      }
      



                 return ( INIT_SUCCEEDED );
                
     }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+


//---

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
   void OnTick ()
     {
      PriceHigh= iCustom ( NULL , 0 , "TMA_Fair" ,TimeFrame,HalfLength,Price,ATRMultiplier,ATRPeriod,Interpolate, 1 , 0 );
      PriceLow= iCustom ( NULL , 0 , "TMA_Fair" ,TimeFrame,HalfLength,Price,ATRMultiplier,ATRPeriod,Interpolate, 2 , 0 );

   if (CountBuy()== 0 && Ask <=PriceLow)

        {
         ticket= OrderSend ( Symbol (), OP_BUY ,Lots, Ask ,Slippage, 0 , 0 , "tma" ,Megic, 0 ,Blue);
         if (ticket> 0 )
           {
            TP= NormalizeDouble ( Ask +TakeProfit* Point , Digits );
            ST= NormalizeDouble ( Ask -StopLoss* Point , Digits );

             if ( OrderSelect (ticket, SELECT_BY_TICKET ))

               if ( OrderModify (ticket, OrderOpenPrice (),ST,TP, 0 ))
                 Print ( "Ошибка" );
               }
  
        }

       if (CountSell()== 0 && Bid >=PriceHigh)

        {
         ticket= OrderSend ( Symbol (), OP_SELL ,Lots, Bid ,Slippage, 0 , 0 , "tma" ,Megic, 0 ,Red);
         if (ticket> 0 )
           {
            ST= NormalizeDouble ( Bid +StopLoss* Point , Digits );
            TP= NormalizeDouble ( Bid -TakeProfit* Point , Digits );

             if ( OrderSelect (ticket, SELECT_BY_TICKET ))

               if ( OrderModify (ticket, OrderOpenPrice (),ST,TP, 0 ))
               Print ( "Ошибка" );
           }
           }
        }
       //+------------------------------------------------------------------+
       int CountSell()
        {
         int count= 0 ;
         for ( int trede= OrdersTotal ()- 1 ;trede>= 0 ;trede--)
           {
             if ( OrderSelect (trede, SELECT_BY_POS , MODE_TRADES ))
              {
               if ( OrderSymbol ()== Symbol () && OrderMagicNumber ()==Megic && OrderType ()== OP_SELL )

                  count++;
                  
              }
           }
         return (count);
        }

       int CountBuy()
        {
         int count= 0 ;
         for ( int trede= OrdersTotal ()- 1 ;trede>= 0 ;trede--)
           {
             if ( OrderSelect (trede, SELECT_BY_POS , MODE_TRADES ))
              {
               if ( OrderSymbol ()== Symbol () && OrderMagicNumber ()==Megic && OrderType ()== OP_BUY )

                  count++;
                  
              }
           }
        
       return (count);
     }
//+------------------------------------------------------------------+

 
vladislavch19 :
오류 'ST' 쓰기 - 선언되지 않은 식별자 test3.mq4 69 13 및 유형 변환으로 인한 데이터 손실 가능성 test3.mq4 85 열 다섯


하나의 변수 이름을 선언했습니다.

 double PriceHigh,PriceLow,SL,TP;

하지만 다른 것을 쓰십시오

ST= NormalizeDouble ( Ask -StopLoss* Point , Digits );
 

변수 "고마워요"를 알아냈는데 오류가 없습니다

이제 유형 변환으로 인한 데이터 손실 가능성 경고를 씁니다. test3.mq4 87 열 다섯

테스터에서 'C:\Users\Administrator\AppData\Roaming\MetaQuotes\Terminal\F8B0CF1E1FEED3B00D2D7E193237B799\MQL4\indicators\TMA_Fair.ex4' 파일을 열 수 없습니다. [2]