주문이 선택되었는지 확인하는 방법 - 페이지 12

 
grell :

그래서 내가 무슨 말을 하는거야. 내 기능에는 보편성이 없으며 각각은 자신의 비즈니스에 엄격하게 점유되어 있습니다. 매매도 따로따로 합니다. Slowzoll은 완전히 실행될 때까지 함수를 종료하지 않습니다. 따라서 주문 번호가 변경되도록 하고 정류장은 서서히 움직이지만 티켓과 마법은 그대로 유지됩니다.

글쎄, 클로징과 함께, 당신은 도취되었습니다 :)
 
tara :

글쎄, 클로징과 함께, 당신은 도취되었습니다 :)

아직 누락이 없습니다. 나는 이런 면에서 폭군이다 :)
 
tara :
아니, 버터에 치즈처럼은 아니지만 정직하게 중령의 계급에 도달했습니다. 기분이 상했다면 죄송합니다 :(
그러나 아니요, 왜 기분이 상했는지, 내가 잘못된 것을 말하면 의무가 아니라 진심으로 말하십시오. :)
 
borilunad :
그러나 아니요, 왜 화를 냈습니까? 내가 잘못된 것을 말하면 의무가 없지만 진심으로. :)
우리는 운전했다.
 
Ant_TL :

당신은 나를 잘못 이해했습니다. 어떤 이유로 사람들의 절반처럼. A() 함수에서 선택한 B() 함수의 순서를 처리할 필요가 없습니다. B() 함수는 A() 함수와 아무 관련 이 없으며 B() 함수에는 자체 논리가 있습니다. 그녀는 주문 수, 총 이익을 계산하고 마법 댓글, TP SL 등을 볼 수 있습니다. 작업은 함수 B()에서 함수 A()로 다시 돌아올 때 함수 B()가 명령으로 수행한 작업에 관계 없이 함수 B()를 호출하는 지점에서 함수 A()의 논리를 보장하는 것입니다. B() 함수를 호출하기 전에 A() 함수에 의해 선택된 순서가 더 이상 선택되지 않고 선택된 순서가 B() 함수가 작업한 또 다른 임의의 임의 순서이기 때문에 위반되지 않습니다. 주기의 주문을 반복합니다.


한 번에 하나의 주문만 선택할 수 있다는 사실을 계속 잊고 있습니다. 출력 = 저축 은행(자신의 배열)에 주문 목록을 저장합니다. 하나의 전역 변수 lastorder로는 충분하지 않습니다. lastords[티켓][기능]과 같은 변형이 더 좋습니다.
 
//+------------------------------------------------------------------+
//| Description included Functions                                   |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                       ORDERS.mq4 |
//|           Copyright © 2012. XrustSolution. mail:xrustx@gmail.com |
//|          https://www.youtube.com/user/opmlv http://forexrust.info |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2012. XrustSolution. mail:xrustx@gmail.com"
#property link      "https://www.youtube.com/user/opmlv http://forexrust.info"
//+------------------------------------------------------------------+
//| Defines and Exports and Includes                                 |
//+------------------------------------------------------------------+
#define  ORDS_TOTAL 100
#define  HIST_TOTAL 100000
//+------------------------------------------------------------------+
//| Orders Property Indexes                                          |
//+------------------------------------------------------------------+
#define  ORD_TICK 0
#define  ORD_LOTS 1
#define  ORD_OPTM 2
#define  ORD_OPPR 3
#define  ORD_STOP 4
#define  ORD_TAKE 5
#define  ORD_CLPR 6
#define  ORD_CLTM 7
#define  ORD_PROF 8
#define  ORD_SWAP 9
#define  ORD_COMM 10
#define  ORD_EXPR 11
#define  ORD_SYMB 12
#define  ORD_COMN 13
//+------------------------------------------------------------------+
//| Extern and Global variables                                      |
//+---externs--------------------------------------------------------+

//+---globals--------------------------------------------------------+
int    gOrdsTotal[7];                     // number open orders
int    gOrdsTicks[ORDS_TOTAL][6];         // array of open ords tickets
double gOrdsProps[ORDS_TOTAL][6][12];     // array of open ords properties
double gPreOrdsProps[ORDS_TOTAL][6][12];
double gOrdsPrf[6];                       // open ords summary profit for order types
double gOrdsLts[6];                       // open ords summary lots for order types
//+------------------------------------------------------------------+
int    gHistTotal[7];                     // number closed orders
int    gHistTicks[HIST_TOTAL][6];         // array of closed ords tickets
double gHistProps[HIST_TOTAL][6][12];     // array of closed ords properties
double gHistPrf[6];                       // closed ords summary profit for order types
double gHistLts[6];                       // closed ords summary lots for order types
//+------------------------------------------------------------------+
//|   Function  :  double iOrdProps(OrderType,PropIndex,Count)       |
//+------------------------------------------------------------------+
double iOrdProps(int type,int indx,int co){int i;double res=0;
   i = gOrdsTicks[co][type];
   if(OrderSelect(i,SELECT_BY_TICKET)){
      if(OrderCloseTime()==0){
         switch(indx){
            case ORD_TICK : res = OrderTicket(); break;
            case ORD_LOTS : res = OrderLots(); break;
            case ORD_OPTM : res = OrderOpenTime(); break;
            case ORD_OPPR : res = OrderOpenPrice(); break;
            case ORD_STOP : res = OrderStopLoss(); break;
            case ORD_TAKE : res = OrderTakeProfit(); break;
            case ORD_CLPR : res = OrderClosePrice(); break;
            case ORD_CLTM : res = OrderCloseTime(); break;
            case ORD_PROF : res = OrderProfit(); break;
            case ORD_SWAP : res = OrderSwap(); break;
            case ORD_COMM : res = OrderCommission(); break;
            case ORD_EXPR : res = OrderExpiration(); break;
            default: res = 0; break;
         }
      }
   }else{
      return(EMPTY_VALUE);
   }
   return(res);
}
//+------------------------------------------------------------------+
//|   Function  :  double fOrdProps(OrderType,PropIndex,Count)       |
//+------------------------------------------------------------------+
double fOrdProps(int type,int indx,int co){return(gOrdsProps[co][type][indx]);}
//+------------------------------------------------------------------+
//|   Function  :  int fOrdsTicket(OrderType,Count)                  |
//+------------------------------------------------------------------+
int fOrdsTicket(int type, int indx = 0){return(gOrdsTicks[indx][type]);}
//+------------------------------------------------------------------+
//|   Function  :  int fOrdsTotal(OrderType)                         |
//+------------------------------------------------------------------+
int fOrdsTotal(int type = 6){return(gOrdsTotal[type]);}
//+------------------------------------------------------------------+
//|   Function  :  double fHistProps(OrderType,PropIndex,Count)      |
//+------------------------------------------------------------------+
double fHistProps(int type,int indx,int co){return(gOrdsProps[co][type][indx]);}
//+------------------------------------------------------------------+
//|   Function  :  int fHistTicket(OrderType,Count)                  |
//+------------------------------------------------------------------+
int fHistTicket(int type, int indx = 0){return(gHistTicks[indx][type]);}
//+------------------------------------------------------------------+
//|   Function  :  int fHistTotal(OrderType)                         |
//+------------------------------------------------------------------+
int fHistTotal(int type = 6){return(gOrdsTotal[type]);}
//+------------------------------------------------------------------+
//|          Function  : int HistRefresh(Magik,Comment,Symbol)       |
//|          Copyright © 2012, XrustSolution.  mail:xrustx@gmail.com |
//|          https://www.youtube.com/user/opmlv http://forexrust.info |
//+------------------------------------------------------------------+
//|          Description:                                            |
//+------------------------------------------------------------------+
int HistRefresh(int mn=-1,string comm="",string sy=""){int i,ii=0,type;bool iMn=true,iComm=true;
   if(mn<0){iMn=false;}
   ArrayResize(gHistTotal,7);
   ArrayInitialize(gHistTotal,0);
   ArrayResize(gHistProps,ORDS_TOTAL);
   ArrayInitialize(gHistProps,0);
   ArrayResize(gHistPrf,ORDS_TOTAL);
   ArrayInitialize(gHistPrf,0);
   ArrayResize(gHistLts,ORDS_TOTAL);
   ArrayInitialize(gHistLts,0);      
   if(StringLen(comm)<1){iComm=false;}
   for(i = OrdersHistoryTotal()-1; i>=0; i--){
      if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)){
         if(OrderType()>5){continue;}
         if(OrderCloseTime()==0){continue;}
         if(sy!=""){if(OrderSymbol()!=sy){continue;}}
         if(iMn){if(OrderMagicNumber()!=mn){continue;}}
         if(iComm){if(StringFind(OrderComment(),comm)<0){continue;}}
         type = OrderType();
         gHistProps[gHistTotal[type]][type][0] = OrderTicket();
         gHistProps[gHistTotal[type]][type][1] = OrderLots();
         gHistProps[gHistTotal[type]][type][2] = OrderOpenTime();
         gHistProps[gHistTotal[type]][type][3] = OrderOpenPrice();
         gHistProps[gHistTotal[type]][type][4] = OrderStopLoss();
         gHistProps[gHistTotal[type]][type][5] = OrderTakeProfit();
         gHistProps[gHistTotal[type]][type][6] = OrderClosePrice();
         gHistProps[gHistTotal[type]][type][7] = OrderCloseTime();
         gHistProps[gHistTotal[type]][type][8] = OrderProfit();
         gHistProps[gHistTotal[type]][type][9] = OrderSwap();
         gHistProps[gHistTotal[type]][type][10] = OrderCommission();
         gHistProps[gHistTotal[type]][type][11] = OrderExpiration();
         gHistPrf[type] += OrderProfit()+OrderSwap()+OrderCommission();
         gHistLts[type] += OrderLots();
         gHistTotal[type]++;// count for ordertypes
         gHistTotal[6]++;// all orders count
         ii++;
      }
   }   
   return(ii);
}
//+------------------------------------------------------------------+
//|          Function  : int OrdsRefresh(Magik,Comment,Symbol)       |
//|          Copyright © 2012, XrustSolution.  mail:xrustx@gmail.com |
//|          https://www.youtube.com/user/opmlv http://forexrust.info |
//+------------------------------------------------------------------+
//|          Description:                                            |
//+------------------------------------------------------------------+
int OrdsRefresh(int mn=-1,string comm="",string sy=""){int i,ii=0,type;bool iMn=true,iComm=true;
   if(mn<0){iMn=false;}
   if(StringLen(comm)<1){iComm=false;}
   ArrayResize(gOrdsTotal,7);
   ArrayInitialize(gOrdsTotal,0);
   ArrayResize(gOrdsTicks,ORDS_TOTAL);
   ArrayInitialize(gOrdsTicks,0);
   ArrayResize(gOrdsProps,ORDS_TOTAL);
   ArrayInitialize(gOrdsProps,0);
   ArrayResize(gOrdsPrf,ORDS_TOTAL);
   ArrayInitialize(gOrdsPrf,0);
   ArrayResize(gOrdsLts,ORDS_TOTAL);
   ArrayInitialize(gOrdsLts,0);
   for(i = OrdersTotal()-1; i>=0; i--){
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){
         if(OrderType()>5){continue;}
         if(OrderCloseTime()!=0){continue;}
         if(sy!=""){if(OrderSymbol()!=sy){continue;}}
         if(iMn){if(OrderMagicNumber()!=mn){continue;}}
         if(iComm){if(StringFind(OrderComment(),comm)<0){continue;}}
         type = OrderType();
         gOrdsTicks[gOrdsTotal[type]][type] = OrderTicket();        
         gOrdsProps[gOrdsTotal[type]][type][0] = OrderTicket();
         gOrdsProps[gOrdsTotal[type]][type][1] = OrderLots();
         gOrdsProps[gOrdsTotal[type]][type][2] = OrderOpenTime();
         gOrdsProps[gOrdsTotal[type]][type][3] = OrderOpenPrice();
         gOrdsProps[gOrdsTotal[type]][type][4] = OrderStopLoss();
         gOrdsProps[gOrdsTotal[type]][type][5] = OrderTakeProfit();
         gOrdsProps[gOrdsTotal[type]][type][6] = OrderClosePrice();
         gOrdsProps[gOrdsTotal[type]][type][7] = OrderCloseTime();
         gOrdsProps[gOrdsTotal[type]][type][8] = OrderProfit();
         gOrdsProps[gOrdsTotal[type]][type][9] = OrderSwap();
         gOrdsProps[gOrdsTotal[type]][type][10] = OrderCommission();
         gOrdsProps[gOrdsTotal[type]][type][11] = OrderExpiration();
         gOrdsPrf[type] += OrderProfit()+OrderSwap()+OrderCommission();
         gOrdsLts[type] += OrderLots();
         gOrdsTotal[type]++;// count for ordertypes
         gOrdsTotal[6]++;// all orders count
         ii++;
      }
   }   
   return(ii);
}
//+------------------------------------------------------------------+
 
루스탐님, 감사합니다. 즐거운 휴일 보내세요.
 
네, 여러분도 즐거운 명절 보내세요! 백 "커미사르"그램에 대한 모든 사람 :)
 
TarasBY :

이 함수는 AFTER OrderSelect()라고 하기 때문에 내 코드에는 이 오류가 없습니다. 그리고 어드바이저의 모든 실행 가능한 기능의 공통된 구조 없이 코드가 작성되었던 때부터 코드의 체크가 남아있다.

또한 제 기능은 대부분 오류 처리 기능이 있어서 아주 조심스럽게 제거합니다. 또한 찾고 있는 답변과 같이 오류를 생성하는 여러 함수가 있습니다. "주문이 더 일찍 선택되었나요, 아니면 ?!"

PS 그건 그렇고, 컴파일된 라이브러리에서 OrderSelect() 함수로 작업하는 한 가지 기능(누군가에게 유용할 수 있음)을 기억했습니다. . 컴파일된 라이브러리에 있는 함수에서 이 선택된 순서의 속성을 얻으려면 아무 것도 작동하지 않습니다. 이 주문을 다시(다시) 선택해야 합니다.

사실, 주문 처리 주기 내부와 외부에서 모두 사용할 수 있는 범용 함수 중 하나에 의해 오류가 생성된 상황이 발생했습니다. 주문이 선택되기 전에 오류가 발생했습니다. 모든 주문이 선택된 후와 그 이전에 모두 사용할 수 있는 주문과 함께 작동하는 범용 서비스 기능을 만들려면 미결 주문이 있을 때와 없을 때 모두 다음과 같은 메커니즘을 사용해야 합니다. 이 실수에 대해 자신을 보장하기 위해 나를 배치했습니다.

주문 선택 이 라이브러리 모듈로 전송되지 않고 다시 되돌아온다는 사실에 대해서는 이 스레드의 앞부분에서 이미 썼습니다.

 
Ant_TL :

사실, 주문 처리 주기 내부와 외부에서 모두 사용할 수 있는 범용 함수 중 하나에 의해 오류가 생성된 상황이 발생했습니다. 주문이 선택되기 전에 오류가 발생했습니다. 모든 주문이 선택된 후와 그 이전에 모두 사용할 수 있는 주문과 함께 작동하는 범용 서비스 기능을 만들려면 미결 주문이 있을 때와 없을 때 모두 다음과 같은 메커니즘을 사용해야 합니다. 이 실수에 대해 자신을 보장하기 위해 마지막 페이지에 나를 배치했습니다.

주문 선택이 라이브러리 모듈로 전송되지 않고 다시 되돌아온다는 사실에 대해서는 이 스레드의 앞부분에서 이미 썼습니다.


거래 작업 에 대해 선택 주문이 있고 문제가 없다는 사실에 익숙해지십시오. 그리고 네, 그들은 당신을 올바르게 썼습니다. 당신은 하나의 주문만 선택할 수 있습니다. 다른 모든 것은 배열로 해결됩니다.
사유: