[경고, 주제 닫힘!] 포럼을 어지럽히지 않도록 모든 초보자 질문. 프로, 놓치지 마세요. 당신 없이는 어디에도 없습니다. - 페이지 414

 
costy_ >> :

고맙습니다! 나는 그것을 여기 에서 찾았습니다. 아마도 누군가가 그것을 필요로 할 것입니다. 성배를 마치겠습니다 :)

 
costy_ >> :

배열이 이중이고 int가 필요한 경우? 제가 제대로 이해한건가요?

아니요. 소켓을 통해 다른 응용 프로그램과 함께 많은 MT4를 작성 중입니다. 소켓 함수는 int 배열을 반환합니다.

 extern "C" __declspec ( dllexport ) int * CALLBACK SendInfoBySocket ( int * MessageStr , int MessageLength , int PORT ) ;

이 dll을 전문가에게 가져옵니다. 그러나 이 함수를 호출하려면 Expert Advisor에서 다음과 같이 선언해야 합니다.

 int SendInfoBySocket ( int str [ ] , int len , int port ) ;

위에 작성된 선언은 올바르지 않을 가능성이 높습니다. dll의 함수는 배열을 반환하고 EA에서 선언된 함수는 하나의 int를 반환합니다.

단일 숫자가 아닌 배열을 반환하도록 Expert Advisor에서 어떻게 선언합니까?

 
모두 감사합니다. int* 대신 char*(c++) 및 string(mql4)을 사용하면 문제가 해결됩니다.
 

누가 알아?

숫자를 반올림 하지 않고 지정된 정밀도 형식으로 이중 변수를 지정하는 방법(예: Bid=1.3988은 Bid=1.398 ???로 지정)

 
admin86 >> :

누가 알아?

숫자를 반올림하지 않고 지정된 정밀도 형식으로 이중 변수를 지정하는 방법(예: Bid=1.3988은 Bid=1.398로 지정 ???

그렇게?

 

모든 답이 여기에 있습니다: https://forum.mql4.com/ru/25945

 

도와주세요, 제발...

'\end_of_program' - 불균형 왼쪽 괄호


extern double Lots = 0.1;
extern int TrailingStop=0;
extern string symbol="GBPUSD";
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   double ma_close,ma_close_pr,ma_open,ma_open_pr;
   double spread,sl_buy,sl_sell,high,high_n,low,low_n;
   int cnt, ticket, total;


   if(Bars<55)
     {
      Print("bars less than 55");
      return(0);  
     }

// to simplify the coding and speed up access
// data are put into internal variables
         ma_close=iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,1);
         ma_close_pr=iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,2);      
         ma_open=iMA(NULL,0,5,0,MODE_EMA,PRICE_OPEN,1);
         ma_open_pr=iMA(NULL,0,5,0,MODE_EMA,PRICE_OPEN,2);
         spread=MarketInfo(symbol,MODE_SPREAD);
         sl_buy=iLow(NULL,0,1)-spread*Point;
         sl_sell=iHigh(NULL,0,1)+spread*Point;
         high=iHigh(NULL,0,1);
         high_n=iHigh(NULL,0,0);
         low=iLow(NULL,0,1);
         low_n=iLow(NULL,0,0);
        
   

//----
    
   total=OrdersTotal();
   if(total<1) 
     {
      // no opened orders identified
      if(AccountFreeMargin()<(1000*Lots))
        {
         Print("We have no money. Free Margin = ", AccountFreeMargin());
         return(0);  
        }
      // check for long position (BUY) possibility
      if(ma_close>ma_open && ma_close_pr<ma_open_pr && high_n>high)
        {
        ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,sl_buy,0,"FXJEDDI_MTF:Buy",16384,0,Lime);

         if(ticket>0)
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
           }
         else Print("Error opening BUY order : ",GetLastError()); 
         return(0); 
        }
      // check for short position (SELL) possibility
      if(ma_close<ma_open && ma_close_pr>ma_open_pr && low_n<low)
        {
            ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,sl_sell,0,"FXJEDDI_MTF:Sell",16384,0,Red);
         if(ticket>0)
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
           }
         else Print("Error opening SELL order : ",GetLastError()); 
         return(0); 
        }
       
       
        for(int i = 0; i < OrdersTotal(); i++)
   {
      // выбор одера
      if(OrderSelect(i, SELECT_BY_POS) == false) continue;
      // not current symbol
      if(OrderSymbol() != Symbol()) continue;
  }
if(OrderType() == OP_SELL)
{
//при профите >20 pips добавится или докупится ... 
 if(OrderProfit()>20)
 OrderSend(Symbol(),OP_SELL,Lots,Bid,3,sl_sell,0,"FXJEDDI:Sell",16384,0,Red);
}
if(OrderType() == OP_BUY)
{
//при профите >20 pips добавится или докупится ... 
 if(OrderProfit()>20)
 OrderSend( (Symbol(),OP_BUY,Lots,Ask,3,sl_buy,0,"FXJEDDI:Buy",16384,0,Lime);
}
      return(0);
     }

뭐가 문제 야?
 
네크론 이 브래킷을 어딘가에 닫지 않았어, 봐봐...
 

2 부.

 // it is important to enter the market correctly, 
   // but it is more important to exit it correctly...   
   for ( cnt = 0 ; cnt < total ; cnt + + )
     {
       OrderSelect ( cnt , SELECT_BY_POS , MODE_TRADES ) ;
       if ( OrderType ( ) < = OP_SELL & &    // check for opened position 
         OrderSymbol ( ) = = Symbol ( ) )    // check for symbol
         {
 OrderSend ( 
         if ( OrderType ( ) = = OP_BUY )    // long position is opened
           {
             // should it be closed?
             if ( ma_close < ma_open & & ma_close_pr > ma_open_pr & & low_n < low )
                 {
                 OrderClose ( OrderTicket ( ) , OrderLots ( ) , Bid , 3 , Violet ) ; // close position
                 return ( 0 ) ; // exit
                 }
             // check for trailing stop
             if ( TrailingStop > 0 )   
               {                  
               if ( Bid - OrderOpenPrice ( ) > Point * TrailingStop )
                 {
                   if ( OrderStopLoss ( ) < Bid - Point * TrailingStop )
                     {
                     OrderModify ( OrderTicket ( ) , OrderOpenPrice ( ) , Bid - Point * TrailingStop , OrderTakeProfit ( ) , 0 , Green ) ;
                     return ( 0 ) ;
                     }
                 }
               }
           }
         else // go to short position
           {
             // should it be closed?
             if ( ma_close > ma_open & & ma_close_pr < ma_open_pr & & high_n > high )
               {
               OrderClose ( OrderTicket ( ) , OrderLots ( ) , Ask , 3 , Violet ) ; // close position
               return ( 0 ) ; // exit
               }
             // check for trailing stop
             if ( TrailingStop > 0 )   
               {                  
               if ( ( OrderOpenPrice ( ) - Ask ) > ( Point * TrailingStop ) )
                 {
                   if ( ( OrderStopLoss ( ) > ( Ask + Point * TrailingStop ) ) | | ( OrderStopLoss ( ) = = 0 ) )
                     {
                     OrderModify ( OrderTicket ( ) , OrderOpenPrice ( ) , Ask + Point * TrailingStop , OrderTakeProfit ( ) , 0 , Red ) ;
                     return ( 0 ) ;
                     }
                 }
               }
           }
         }
     }
   return ( 0 ) ;
   
   }
// the end.
 
Techno >> :
Necron скобку где то не закрыл, ищи...

코드를 제대로 입력하셨나요?

사유: