의견 - 매우 성공적인 EA - 2주 안에 $3000 계정에서 $6300($9000일 수 있음) - 페이지 5

 

내가 일하러 가기 전에 빠른 1가지, 참 또는 거짓이 될 수 있는 부울 변수가 있습니다. 당신은 그것을 위해 문자열을 사용할 필요가 없습니다.

당신이 책을 따르고 있다는 것이 믿기지 않습니다.

 
zzuegg :

내가 일하러 가기 전에 빠른 1가지, 참 또는 거짓이 될 수 있는 부울 변수가 있습니다. 당신은 그것을 위해 문자열을 사용할 필요가 없습니다.

당신이 책을 따르고 있다는 것이 믿기지 않습니다.

나는 노력하고 있다. 트레이딩 + 프로그램 + MQL을 동시에 배우고 있습니다.

혼자 책을 읽으면서 자동차 운전을 배우나요?

하지만 감사합니다

 
MickGlancy :

OpenBuyOrder 및 OpenSellOrder 함수가 결과를 반환하지 않는다는 오류가 발생합니다.

내가 무엇을 잘못하고 있지 ?

OpenBuyOrder() 및 OpenSellOrder() 함수 가 실제로 결과를 반환하지 않기 때문에 이 오류가 발생합니다. .. 함수를 void 로 정의했습니다. 즉, 어떤 인수도 반환하지 않지만 정수(0)를 반환하려고 합니다.

다음은 몇 가지 주석이 있는 코드입니다.

 void OpenBuyOrder( double StopLoss, double TakeProfit )
{
         int Ticket;			
         double SL,TP,SLP,TPP,OPP;
         
         if (HideSL==false && StopLoss> 0 ){SL=Ask-StopLoss* Point ;}
         else {SL= 0 ;}
         
         if (SL> 0 && SL>(Bid-MarketInfo( Symbol (),MODE_STOPLEVEL)* Point )){SL=Bid-MarketInfo( Symbol (),MODE_STOPLEVEL)* Point ;}
         
         if (HideTP==false && TakeProfit> 0 ){TP=Ask+TakeProfit* Point ;}
         else {TP= 0 ;}
         
         Ticket= OrderSend ( Symbol (),OP_BUY,Lots,Ask,Slippage,SL,TP,EAName,Magic, 0 , Blue );	//-- this stores the value for Ticket, but it never gets used.. 
                                                                                        //-- you can simply call OrderSend() without storing the result 

   return ;    //--- void means the function returns no argument.. thus, no parentheses for return
}

void OpenSellOrder( double StopLoss, double TakeProfit)
{
         int Ticket;
         double SL,TP,SLP,TPP,OPP;
         
         if (HideSL==false && StopLoss> 0 ){SL=Bid+StopLoss* Point ;}
         else {SL= 0 ;}
         
         if (SL> 0 && SL<(Ask+MarketInfo( Symbol (),MODE_STOPLEVEL)* Point )){SL=Ask+MarketInfo( Symbol (),MODE_STOPLEVEL)* Point ;}
         
         if (HideTP==false && TakeProfit> 0 ){TP=Bid-TakeProfit* Point ;}
         else {TP= 0 ; /*TPP=0;*/ }
         
         Ticket= OrderSend ( Symbol (),OP_SELL,Lots,Bid,Slippage,SL,TP,EAName,Magic, 0 , Red );
         
     return ; 
}

GetSignal 함수를 기반으로 하면 실제로 일부 인수를 반환하는 대신 OpenBuy/SellOrder()를 사용하여 주문을 열기를 원하는 것 같습니다. 몇 가지 주석으로 GetSignal() 함수를 약간 정리했습니다.

 void GetSignal( int MaxBuyOrders, double StopLoss, double TakeProfit) 		//--- Why make this function a bool??
{
   int Op_Buy,Op_Sell,Op_BuyStop,Op_SellStop,Op_BuyLimit,Op_SellLimit;
        
   int total = OrdersTotal();
  
   for ( int x=total- 1 ; x>= 0 ; x--)
   {
      OrderSelect(x, SELECT_BY_POS, MODE_TRADES);
       int type   = OrderType();
       bool result = false ;     //-- not used anywhere??
      
       if (type==OP_BUY)       Op_Buy++;
       if (type==OP_SELL)      Op_Sell++;
       if (type==OP_BUYSTOP)   Op_BuyStop++;
       if (type==OP_SELLSTOP)  Op_SellStop++;         
   }
  
   int limit= 1 ;		        //--- why define limit to 1 
   for ( int i= 1 ;i<=limit;i++)    //--- your for-loop will always run once, in which case why even have a for-loop?
   {
       double MA1=iMA(NULL, 0 , 100 , 0 , 1 , 0 , 0 );
       double MA2=iMA(NULL, 0 , 100 , 0 , 1 , 0 , 1 );
       double MA3=iMA(NULL, 0 , 40 , 0 , 1 , 0 , 0 );
       double MA4=iMA(NULL, 0 , 40 , 0 , 1 , 0 , 1 );
      
       bool BUY= false ;   //-- as one guy mentioned better to go with booleans here
       bool SELL= false ;

       if (MA1 < MA3 && MA2 > MA4) BUY= true ;  
       if (MA1 > MA3 && MA2 < MA4) SELL= true ;
       // missed out  && total == 0 for now
       bool SignalBUY= false ;
       bool SignalSELL= false ;
      
       if (BUY) //-- dont need to write == for bool's ..BUY is same as BUY==true, !BUY same as BUY==false
       if (ReverseSystem) SignalSELL= true ;
       else SignalBUY= true ;
      
       if (SELL)
       if (ReverseSystem) SignalBUY= true ;
       else SignalSELL= true ;
      
       if (SignalBUY && Op_Buy < MaxBuyOrders )   OpenBuyOrder(StopLoss,TakeProfit); 	//--- no need to return the return of OpenBuyOrder().. simply calling it will run the code
       if (SignalSELL && Op_Sell < MaxSellOrders) OpenSellOrder(StopLoss,TakeProfit);	//-- same
   }
   return ;
}
 
supertrade :

OpenBuyOrder() 및 OpenSellOrder() 함수 가 실제로 결과를 반환하지 않기 때문에 이 오류가 발생합니다. .. 함수를 void 로 정의했습니다. 즉, 어떤 인수도 반환하지 않지만 정수(0)를 반환하려고 합니다.

다음은 몇 가지 주석이 있는 코드입니다.

GetSignal 함수를 기반으로 하면 실제로 일부 인수를 반환하는 대신 OpenBuy/SellOrder()를 사용하여 주문을 열기를 원하는 것 같습니다. 몇 가지 주석으로 GetSignal() 함수를 약간 정리했습니다.

그것은 톤을 설명합니다. 대단히 감사합니다. 지금 시도하고 있습니다.

내 자신의 코드는 기본적으로 다른 EA에서 복사하고 작동시키려고 하기 때문에 약간 엉망입니다.

 
문제 없습니다. 다른 문제가 발생하면 언제든지 문의하십시오.
 
void MoveTrailingStop()
{
   int cnt,total= OrdersTotal ();
   for (cnt= 0 ;cnt<total;cnt++)
   {
       OrderSelect (cnt,SELECT_BY_POS,MODE_TRADES);
       if (OrderType()<=OP_SELL  &&  OrderSymbol()== Symbol () ) //&&  OrderMagicNumber()==Magic
      {
         if (OrderType()==OP_BUY)
         {
             if (TrailingStop> 0 )  
            {                 
               if (( NormalizeDouble (OrderStopLoss(), Digits )< NormalizeDouble (Bid- Point *(TrailingStop+TrailingStep), Digits )) || (OrderStopLoss()== 0 ))
               {
                  OrderModify(OrderTicket(),OrderOpenPrice(), NormalizeDouble (Bid- Point *TrailingStop, Digits ),OrderTakeProfit(), 0 , Blue );
                   return ( 0 );
               }
            }
         }
         else 
         {
             if (TrailingStop> 0 )  
            {                 
               if (( NormalizeDouble (OrderStopLoss(), Digits )>( NormalizeDouble (Ask+ Point *(TrailingStop+TrailingStep), Digits )))||(OrderStopLoss()== 0 ))
               {
                  OrderModify(OrderTicket(),OrderOpenPrice(), NormalizeDouble (Ask+ Point *TrailingStop, Digits ),OrderTakeProfit(), 0 , Red );
                   return ( 0 );
               }
            }
         }
      }
   }
}
슈퍼 트레이드 :
문제 없습니다. 다른 문제가 발생하면 언제든지 문의하십시오.

ive는 후행 중지의 예를 많이 수집했지만 -ve 값을 통해 즉시 0으로 후행하기 시작한 다음 손익분기점처럼 중지하는 예가 필요합니다.

따라서 시장 진입 가격을 취하고 손절매 가 100이면 id 가격은 +25로 이동하고 후행 스탑은 -75로 이동하고 가격이 100에 도달하면 후행 스탑은 0에서 멈추고 더 이상 움직이지 않습니다 .

아무도 이것으로 나를 도울 수 있습니까? 나는 그것을 작동 시키려고 하루 종일 보냈고 나는 할 수 없습니다.

나는 내가 그것을했다고 생각했지만 나는하지 않았습니다. 내 후행 중지는 0을 따릅니다.

 

의사 코드:

 OrderSelect ()

if (Buyorder and stoploss < openrice) : we need to trail
if (Sellorder and stoploss > openprice): we need to trail
if (we need to trail):
Modify Stoploss to Currentprice (+ or -) original stoploss
 

주에그:

if (구매자 및 손절매 < openrice) : 추적해야 합니다.

손절매 는 항상 openprice보다 낮지 않습니까? 그 반대도 마찬가지입니까?

나는 결국 MaxLoss 기능을 사용할 계획이므로 OrderSend로 손절매를 두지 않을 것입니다.

If Op_구매

ifbid <= OpenOrderPrice()+(Trailing stop value) : trail -- 한 번 입찰 > TSV 이동을 계속해서는 안 됩니까?

그리고

If Op_Sell

if Ask >= OpenOrderPrice()-(후행 정지 값): 추적 ?

그런 다음 Trailingstop보다 높은 값에서 Breakeven은 작업을 완료할 수 있습니까?

 OrderSelect (SELECT_BY_POS,MODE_TRADES);
   if (TrailingStop> 0 )
      {
       if (OrderType()==OP_BUY)
            {
             if ( Bid <= (OrderOpenPrice()+ Point *TrailingStop)  )
               {
                  MoveTrailingStop();
               }
            }
       if (OrderType()==OP_SELL)
            {   
             if ( Ask >= (OrderOpenPrice()- Point *TrailingStop) )
               {
                  MoveTrailingStop();
               }
            }
      }
BTW thanks zzuegg, thats another order management milestone achieved. What can happen with a little help. I am gratefull.
 
MickGlancy :

주에그:

if (구매자 및 손절매 < openrice) : 추적해야 합니다.

손절매는 항상 openprice보다 낮지 않습니까? 그 반대도 마찬가지입니까? 아니요, 손익분기점 전에만

나는 당신의 코드가 작동하지 않는다고 생각합니다. 당신은 그 반대를 시도하는 것 같습니다 ...
 
zzuegg :
나는 당신의 코드가 작동하지 않는다고 생각합니다. 당신은 그 반대를 시도하는 것 같습니다 ...

아니요, 완벽하게 작동합니다. 지금 해당 응답과 동일한지 확인 하겠습니다.

그것은 움직이는 거래 뒤에 있는 손실 격차를 좁히면서도 여전히 숨을 쉴 수 있는 공간을 제공하는 타협에 가깝습니다. 그 전에는 BE가 일어나기 전에 트레이드가 60포인트에 도달해야 했기 때문에 최대 스탑아웃 트레이드가 많았고 이로 인해 내 드로다운이 높았습니다. 바라건대 이것은 그것을 바꿀 것입니다.

 OrderSelect (SELECT_BY_POS,MODE_TRADES);
   if (TrailingStop> 0 )
      {
       if (OrderType()==OP_BUY)
            {
             if ( Bid <= (OrderOpenPrice()+ Point *TrailingStop)  )
               {
                  MoveTrailingStop();
               }
            }
       if (OrderType()==OP_SELL)
            {   
             if ( Ask >= (OrderOpenPrice()- Point *TrailingStop) )
               {
                  MoveTrailingStop();
               }
            }
      }
사유: