- void 交易类:: 历史订单信息(string 币种,long Magic,ulong 起始时间,ENUM_DEAL_ENTRY 进出,ENUM_DEAL_TYPE 方向,int 倒数第几=1,ulong 截止时间=1,bool 是否打印=false)
- {
- long magic=魔术幻数(Magic);
- int 计数=0;
- HistorySelect(起始时间,截止时间);
- for(int i=HistoryDealsTotal()-1; i>=0; i--)
- {
- if(HistoryDealGetTicket(i)>0&&HistoryDealGetString(HistoryDealGetTicket(i),DEAL_SYMBOL)==币种&&HistoryDealGetInteger(HistoryDealGetTicket(i),DEAL_MAGIC)==magic&&HistoryDealGetInteger(HistoryDealGetTicket(i),DEAL_ENTRY)==进出)
- {
- if(HistoryDealGetInteger(HistoryDealGetTicket(i),DEAL_TYPE)==方向)
- {
- string 历史持仓币种=HistoryDealGetString(HistoryDealGetTicket(i),DEAL_SYMBOL);
- double 历史持仓交易量=HistoryDealGetDouble(HistoryDealGetTicket(i),DEAL_VOLUME);
- // double 历史持仓止损=HistoryDealGetDouble(HistoryDealGetTicket(i),DEAL_SL);
- // double 历史持仓止盈=HistoryDealGetDouble(HistoryDealGetTicket(i),DEAL_TP);
- ENUM_DEAL_TYPE 历史持仓类型=(ENUM_DEAL_TYPE)HistoryDealGetInteger(HistoryDealGetTicket(i),DEAL_TYPE); // 持仓类型
- long 历史持仓订单号=HistoryDealGetInteger(HistoryDealGetTicket(i),DEAL_TICKET);
- ulong 历史持仓magic=HistoryDealGetInteger(HistoryDealGetTicket(i),DEAL_MAGIC);
- string 历史持仓注释=HistoryDealGetString(HistoryDealGetTicket(i),DEAL_COMMENT);
- double 历史持仓开盘价=HistoryDealGetDouble(HistoryDealGetTicket(i),DEAL_PRICE);
- long 历史持仓开盘服务器时间=HistoryDealGetInteger(HistoryDealGetTicket(i),DEAL_TIME);
- long 历史持仓开盘电脑时间=HistoryDealGetInteger(HistoryDealGetTicket(i),DEAL_TIME)-TimeCurrent()+TimeLocal();
- ulong 历史ID=HistoryDealGetInteger(HistoryDealGetTicket(i),DEAL_POSITION_ID);
- Comment(
- "历史单信息更新\n"+
- (string)历史持仓币种+ "\n",
- (string)历史持仓交易量+ "\n",
- // (string)历史持仓止损+ "\n",
- // (string)历史持仓止盈+ "\n",
- (string)历史持仓类型 + "\n",// 持仓类型
- (string)历史持仓订单号+ "\n",
- (string)历史持仓magic+ "\n",
- (string)历史持仓注释+ "\n",
- (string)历史持仓开盘价+ "\n",
- (string)历史持仓开盘服务器时间+ "\n",
- (string)历史持仓开盘电脑时间+ "\n",
- (string)历史ID);
- if(是否打印)
- Print(
- "历史单信息更新\n"+
- (string)历史持仓币种+ "\n",
- (string)历史持仓交易量+ "\n",
- // (string)历史持仓止损+ "\n",
- // (string)历史持仓止盈+ "\n",
- (string)历史持仓类型 + "\n",// 持仓类型
- (string)历史持仓订单号+ "\n",
- (string)历史持仓magic+ "\n",
- (string)历史持仓注释+ "\n",
- (string)历史持仓开盘价+ "\n",
- (string)历史持仓开盘服务器时间+ "\n",
- (string)历史持仓开盘电脑时间+ "\n",
- (string)历史ID);
- 计数++;
- if(计数==倒数第几)
- break;
- }
- }
- }
- }
- //+------------------------------------------------------------------+
复制代码
|