3개월 전에 쓴 EA는 지금 전략 테스트를 통과할 수 없지만 2, 3개월 전에 잘 사용했습니다!! - 페이지 3

 

거래, 자동 거래 시스템 및 거래 전략 테스트에 관한 포럼


항해사 , 2014.02.11 17:59

여보세요,

코드를 게시할 때 SRC 버튼 을 사용하십시오. 고맙습니다.


이번에는 여러분을 위해 편집했습니다.


 
jitanic :

안녕

데모 계정 으로 주문 작업을 보내는데 실제 계정에서 작동하지 않습니다(2014.11.30 18:21:00.062 55 (اخابر,D1) BuyA: 오류 4756, retcode = 10006)


그런 표기법을 사용하는 것은 이해하기 어렵습니다.

   request.action= 5 ;
   request.type= 6 ;
   request.type_filling= 2 ;

대신 사용:

   request.action= TRADE_ACTION_PENDING ;
   request.type= ORDER_TYPE_BUY_STOP_LIMIT ;
   request.type_filling= ORDER_FILLING_RETURN ;  

그건 그렇고, 두 경우 모두 저에게 효과적입니다.


 

죄송합니다

이 스크립트를 확인 하고 내 잘못을 알려주십시오.

 

 #property description "Expert Advisor for sending trade requests "
" using OrderSendAsync() function.\r\n"
#property description "Handling trading events using"
" OnTrade() and OnTradeTransaction() handler functions is displayed\r\n"
#property description "Expert Advisor parameters allow setting Magic Number"
" (unique ID) "
#property description "and the mode of displaying messages in Experts log. All details are displayed by default.\r\n"
input int   MagicNumber= 1234567 ;       // Expert Advisor ID
input bool DescriptionModeFull= true ; // Detailed output mode
input double   Price= 2652 ;
input double   Volume= 1000 ;
input double   stoplimit= 2681 ;
input double   sl= 1000 ;
input double   tp= 2681 ;
//+------------------------------------------------------------------+
int OnInit ()
  {
//--- check if autotrading is allowed
   if (! TerminalInfoInteger ( TERMINAL_TRADE_ALLOWED ))
     {
       Alert ( "Autotrading in the terminal is disabled, Expert Advisor will be removed." );
       ExpertRemove ();
       //--     return(-1);
     }
   CreateBuySellButtons();
   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
void OnDeinit ( const int reason)
  {
   ObjectDelete ( 0 , "Buy" );
   ObjectDelete ( 0 , "Sell" );
   ObjectDelete ( 0 , "HALL" );
  }
//+------------------------------------------------------------------+
void OnTradeTransaction ( const MqlTradeTransaction &trans,
                         const MqlTradeRequest &request,
                         const MqlTradeResult &result)
  {

  }
//+------------------------------------------------------------------+
void OnTrade ()
  {

  }
//+------------------------------------------------------------------+
void OnChartEvent ( const int id,
                   const long &lparam,
                   const double &dparam,
                   const string &sparam)
  {
//--- handling CHARTEVENT_CLICK event ("Clicking the chart")
   if (id== CHARTEVENT_OBJECT_CLICK )
     {
       //--- if "Buy" button is pressed, then buy
       if (sparam== "Buy" )
        {
         BuyA(Volume);
         //--- unpress the button
         ObjectSetInteger ( 0 , "Buy" , OBJPROP_STATE , false );
        }
       //--- if "Sell" button is pressed, then sell
       if (sparam== "Sell" )
        {
         SellA(Volume);
         //--- unpress the button
         ObjectSetInteger ( 0 , "Sell" , OBJPROP_STATE , false );
        }
       ChartRedraw ();
     }
  }
//+------------------------------------------------------------------+
void CreateBuySellButtons()
  {
   ObjectCreate ( 0 , "Buy" , OBJ_BUTTON , 0 , 0 , 0 ); // create "Buy" button
   ObjectSetInteger ( 0 , "Buy" , OBJPROP_CORNER , CORNER_RIGHT_UPPER );
   ObjectSetInteger ( 0 , "Buy" , OBJPROP_XDISTANCE , 100 );
   ObjectSetInteger ( 0 , "Buy" , OBJPROP_YDISTANCE , 50 );
   ObjectSetInteger ( 0 , "Buy" , OBJPROP_XSIZE , 70 );
   ObjectSetInteger ( 0 , "Buy" , OBJPROP_YSIZE , 30 );
   ObjectSetString ( 0 , "Buy" , OBJPROP_TEXT , "Buy" );
   ObjectSetInteger ( 0 , "Buy" , OBJPROP_COLOR , clrRed );
   ObjectCreate ( 0 , "Sell" , OBJ_BUTTON , 0 , 0 , 0 ); // create "Sell" button
   ObjectSetInteger ( 0 , "Sell" , OBJPROP_CORNER , CORNER_RIGHT_UPPER );
   ObjectSetInteger ( 0 , "Sell" , OBJPROP_XDISTANCE , 100 );
   ObjectSetInteger ( 0 , "Sell" , OBJPROP_YDISTANCE , 100 );
   ObjectSetInteger ( 0 , "Sell" , OBJPROP_XSIZE , 70 );
   ObjectSetInteger ( 0 , "Sell" , OBJPROP_YSIZE , 30 );
   ObjectSetString ( 0 , "Sell" , OBJPROP_TEXT , "Sell" );
   ObjectSetInteger ( 0 , "Sell" , OBJPROP_COLOR , clrBlue );
   ObjectCreate ( 0 , "HALL" , OBJ_LABEL , 0 , 0 , 0 ); // create LABEL
   ObjectSetInteger ( 0 , "HALL" , OBJPROP_CORNER , CORNER_RIGHT_UPPER );
   ObjectSetInteger ( 0 , "HALL" , OBJPROP_XDISTANCE , 100 );
   ObjectSetInteger ( 0 , "HALL" , OBJPROP_YDISTANCE , 150 );
   ObjectSetInteger ( 0 , "HALL" , OBJPROP_XSIZE , 70 );
   ObjectSetInteger ( 0 , "HALL" , OBJPROP_YSIZE , 30 );
   ObjectSetString ( 0 , "HALL" , OBJPROP_TEXT , _Symbol );
   ObjectSetInteger ( 0 , "HALL" , OBJPROP_COLOR , clrBlue );
   ChartRedraw ();
  }
//+------------------------------------------------------------------+
void BuyA( double volume)
  {
//--- prepare the request
   MqlTradeRequest request;
   MqlTradeResult   result;
   MqlTradeCheckResult check;
   ZeroMemory (request);
   ZeroMemory (result);
   ZeroMemory (check);
   request.action= TRADE_ACTION_PENDING ;
   request.symbol= _Symbol ;
   request.volume= 1000.00 ;
  request.price= 2652.000 ;
   request.stoplimit= 2652.000 ;
   request.sl= 0 ;
   request.tp= 0 ;
request.type= ORDER_TYPE_BUY_STOP_LIMIT ;
request.type_filling= ORDER_FILLING_RETURN ; 
   request.type_time= 0 ;
   request.expiration= 0 ;
  request.magic= 0 ;
request.comment= "" ;
   if (! OrderSend (request,result))
     {
       Print ( __FUNCTION__ , ": error " , GetLastError (), ", retcode = " ,result.retcode);
     }
//---
  }
//+------------------------------------------------------------------+
void SellA( double volume)
  {
//--- prepare the request
   MqlTradeRequest request;
   request.action= TRADE_ACTION_DEAL ;
   request.symbol= _Symbol ;
   request.magic= 0 ;
   request.volume=Volume;
   request.type= ORDER_TYPE_SELL ;
   request.price= SymbolInfoDouble (request.symbol, SYMBOL_BID );
   request.deviation= 10 ;
   request.comment= "Sell using OrderSendAsync()" ;
   MqlTradeResult   result;
   if (! OrderSendAsync (request,result))
     {
       Print ( __FUNCTION__ , ": error " , GetLastError (), ", retcode = " ,result.retcode);
     }
  }
//+------------------------------------------------------------------+
 
jitanic :

죄송합니다

이 스크립트를 확인하고 내 잘못을 알려주십시오.

 

그것은 나를 위해 작동합니다. TadbirTrader-Server를 사용하여 테스트했습니다.
 
angevoyageur :
그것은 나를 위해 작동합니다. TadbirTrader-Server를 사용하여 테스트했습니다.
실제 계정이 있습니까 아니면 데모 계정 에 체크인 하시겠습니까?
Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Account Properties - Reference on algorithmic/automated trading language for MetaTrader 5
 
jitanic :
실제 계정이 있습니까 아니면 데모 계정 에 체크인 하시겠습니까?

데모 계정 전용.

추신: 죄송합니다. 데모 계정에서도 작동하고 있다는 점을 놓쳤습니다.

다음을 통해 실제 계정에 반환되는 값:

   printf ( "expiration=%i" , SymbolInfoInteger ( _Symbol , SYMBOL_EXPIRATION_MODE ));
   printf ( "filling=%i" , SymbolInfoInteger ( _Symbol , SYMBOL_FILLING_MODE ));
 

그것은 나를 위해 데모에서 작동하고 있습니다.

서버에서 제한될 수 있습니까?

 
jitanic :

그것은 나를 위해 데모에서 작동하고 있습니다.

서버에서 제한될 수 있습니까?

이 보류 주문을 하는 것을 제한하는 것이 분명히 있습니다. 실제 계정에서 이 기호에 대한 설정이 다를 수 있습니다(이전 게시물 참조).

오류 10006: 거부된 요청은 그다지 유용한 메시지가 아닙니다. 이 주문을 몇 번이나 시도하셨습니까?

데모 계정 의 현재 Bid/Ask/Last는 2638/2652/2640입니다. 실제 계정에서도 동일한가요?

 
angevoyageur :

이 보류 주문을 하는 것을 제한하는 것이 분명히 있습니다. 실제 계정에서 이 기호에 대한 설정이 다를 수 있습니다(이전 게시물 참조).

오류 10006: 거부된 요청은 그다지 유용한 메시지가 아닙니다. 이 주문을 몇 번이나 시도하셨습니까?

데모 계정 의 현재 Bid/Ask/Last는 2638/2652/2640입니다. 실제 계정에서도 동일한가요?

안녕하세요 답변 감사합니다

나는 기호 속성의 사진을 첨부합니다

도움이 되지 않으면 다음과 같이 말했습니다: 내 코드에서 인쇄 주문은 어디에 삽입합니까?

파일:
Untitled.png  47 kb
 
jitanic :

안녕하세요 답변 감사합니다

나는 기호 속성의 사진을 첨부합니다

도움이 되지 않으면 다음과 같이 말했습니다: 내 코드에서 인쇄 주문은 어디에 삽입합니까?

작동하지 않는 이유를 알 수 없습니다.

지금 다시 시도할 수 있습니까? 여전히 작동하지 않습니까?

사유: