[ARCHIVE] 포럼을 어지럽히 지 않도록 초보자 질문. 프로, 놓치지 마세요. 너 없이는 아무데도 - 5. - 페이지 46

 

SL에 의한 CLOSED 포지션 손실의 총 잔액과 OPEN 수익성 있는 거래의 총 잔액을 계산하는 기능을 알고 계시다면 작성해 주십시오.

손실 잔액의 계산은 예치금의 마지막 최대값부터 시작해야 합니다.

 

안녕하세요!!! 내 기능은 40개의 저주 단어로 맹세합니다 - 나는 분명히 잘 몰랐지만 작성 방법을 잊어 버렸습니다.

 void   SELL { double Price1_SELL= (Bid-Dist* Point ) ; double TP1_SELL=Price1_SELL-TP* Point ; double SL1_SELL=Price1_SELL+SL* Point ;
   
   double   Price2_SELL= (Price1_SELL -Dist* Point ) ; double    TP2_SELL=Price2_SELL-TP* Point ; double    SL2_SELL=Price2_SELL+SL* Point ;
   
   double   Price3_SELL=(Price2_SELL -Dist* Point ) ; double   TP3_SELL=Price3_SELL-TP* Point ; double   SL3_SELL=Price3_SELL+SL* Point ;
   
   double   Price4_SELL= (Price3_SELL -Dist* Point ) ; double   TP4_SELL=Price4_SELL-TP* Point ; double   SL4_SELL=Price4_SELL+SL* Point ;
   
   double   Price5_SELL= (Price4_SELL -Dist* Point ) ; double    TP5_SELL=Price5_SELL-TP* Point ; double   SL5_SELL=Price5_SELL+SL* Point ;}
 
Dimka-novitsek :

안녕하세요!!! 내 기능은 40개의 저주 단어로 맹세합니다 - 나는 분명히 잘 몰랐지만 작성 방법도 잊어 버렸습니다.


디만! 잘 자! 기능이 아니라 내가 쓴 쓰레기들이니까 쉬어야지...

 
그래서 기억이 안난다고 합니다. 추가하겠습니다. 명령. 컴파일러가 좋아하지 않는 것은 무엇입니까?
 
Dimka-novitsek :
그래서 기억이 안난다고 합니다. 추가하겠습니다. 명령. 컴파일러가 좋아하지 않는 것은 무엇입니까?

따라서 f-ii 는 작성되지 않습니다. 교과서를 읽으십시오.

 
감사해요!! 내가 읽고 있어요.
 
A. 그녀는 괄호가 충분하지 않았습니다!
 

안녕하세요! EA는 보류 중인 정류장을 지정합니다. 테스터를 체크인 할 때 BUY_STOP 대신 SELL_STOP만 작동합니다. Order Send error/Error Opening Buy order:130 오류가 나타납니다.

 extern int TrailingStop= 30 ;
//-----------------------------------------------------------------------------------------------+
for (cnt= 0 ;cnt<total;cnt++)
     {
       OrderSelect (cnt, SELECT_BY_POS, MODE_TRADES);
       if (OrderType()<=OP_SELLSTOP &&   // check for opened position 
         OrderSymbol()== Symbol ())   // check for symbol
        {
         if (OrderType()==OP_BUY)   // long position is opened
           {
             // check for trailing stop
             if (TrailingStop> 0 )  
              {                 
               if (Bid-OrderOpenPrice()> Point *TrailingStop)
                  {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Bid- Point *TrailingStop,OrderTakeProfit(), 0 ,Green);
                     return ( 0 );
                    }
              }
           }
         else // go to short position
           {
             // check for trailing stop
             if (TrailingStop> 0 )  
              {                 
               if ((OrderOpenPrice()-Ask)>( Point *TrailingStop))
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Ask+ Point *TrailingStop,OrderTakeProfit(), 0 ,Red);
                     return ( 0 );
                    }
              }
           }
        }
     }

   
   return ( 0 );

원인을 찾도록 도와주세요!

 

이유는 논리가 부족하기 때문입니다!

 for (cnt= 0 ;cnt<total;cnt++)
     {
       OrderSelect (cnt, SELECT_BY_POS, MODE_TRADES);
       if (OrderType()<=OP_SELLSTOP &&   // check for opened position 
         OrderSymbol()== Symbol ())   // check for symbol
        {
         if (OrderType()==OP_BUY)   // long position is opened
           {
이해하는 방법? SELLSTOP이면 BUY와 어떤 관련이 있습니까?
 
Twilight :

그리고 마지막 1-2-3 주문이 수익성이 없었는지 어떻게 알 수 있습니까?

그리고 일반적으로 마지막 주문이 무엇인지 찾는 방법은 무엇입니까?


나는 최근에 마지막 주문 실패의 경우 이 주문의 유형을 반환하는 함수를 작성했습니다. 저것들. fHistory() == 0이면 마지막으로 잃는 주문은 매수, fHistory() == 1이면 마지막으로 잃는 주문은 매도입니다. 수익성 있는 항목을 추적해야 하는 경우 다음과 같이 줄의 기호를 변경하십시오. if (OrderProfit() > 0 ).

 //+----------------------------------------------------------------------------+
// Прибыльно или убыточно закрылся последний ордер, и возврат типа такого ордера
int fHistory(){
   for ( int i=OrdersHistoryTotal(); i >= 0 ; i--){               // Выборка в истории
     if ( OrderSelect (i,SELECT_BY_POS,MODE_HISTORY)== true ){   // Если есть следующий в истории
         if (OrderMagicNumber()!=magN) continue ;               // Ордера не нашего эксперта
         if (OrderProfit() < 0 ) return (OrderType());         // Если убыток по посл.ордеру вернем тип ордера
     }
  }
   return (- 1 );
}

Variable magN - 글로벌 수준에서 선언된 매직 오더.