• 显示历史交易订单的开仓平仓点


    #property link      "http://www.haoib.com"
    
    #property indicator_chart_window
    //+------------------------------------------------------------------+
    //| Custom indicator initialization function                         |
    //+------------------------------------------------------------------+
    int init()
      {
    //---- indicators
    //----
       return(0);
      }
    //+------------------------------------------------------------------+
    //| Custom indicator deinitialization function                       |
    //+------------------------------------------------------------------+
    int deinit()
      {
    //----
       
    //----
       return(0);
      }
    //+------------------------------------------------------------------+
    //| Custom indicator iteration function                              |
    //+------------------------------------------------------------------+
    int start()
      {
       int    counted_bars=IndicatorCounted();
       
       int i,hstTotal=OrdersHistoryTotal(); 
    /*
       for(i=0;i<283;i++)
       {
       ObjectCreate("arrow"+i, OBJ_ARROW,0,Time[i],Low[i]);
       ObjectSet("arrow"+i,OBJPROP_ARROWCODE,i);
       ObjectSet("arrow1",OBJPROP_COLOR,Green);
       
       }
    */
      for(i=0;i<hstTotal;i++)
      {
          OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
          if(Symbol()==OrderSymbol() && OrderType()<=OP_SELL)
          {
             int tk=OrderTicket();
             if(ObjectFind("aopen"+tk)==-1)
             {
                ObjectCreate("aopen"+tk,OBJ_ARROW,0,OrderOpenTime(),OrderOpenPrice());
                ObjectSet("aopen"+tk,OBJPROP_ARROWCODE,1);
                if(OrderType()==OP_BUY) ObjectSet("aopen"+tk,OBJPROP_COLOR,Green);
                if(OrderType()==OP_SELL) ObjectSet("aopen"+tk,OBJPROP_COLOR,Red);
             }
             if(ObjectFind("aclose"+tk)==-1)
             {
                ObjectCreate("aclose"+tk,OBJ_ARROW,0,OrderCloseTime(),OrderClosePrice());
                ObjectSet("aclose"+tk,OBJPROP_ARROWCODE,3);
                ObjectSet("aclose"+tk,OBJPROP_COLOR,Goldenrod);
             }
             if(ObjectFind("#"+tk)==-1)
             {
                if(ObjectFind("##"+tk)!=-1)ObjectDelete( "##"+tk) ;
                ObjectCreate("#"+tk,OBJ_TREND,0,OrderOpenTime(),OrderOpenPrice(),OrderCloseTime(),OrderClosePrice());
                ObjectSet("#"+tk,OBJPROP_STYLE,STYLE_DOT);
                ObjectSet("#"+tk,OBJPROP_RAY,0);
                if(OrderType()==OP_BUY) ObjectSet("#"+tk,OBJPROP_COLOR,Green);
                if(OrderType()==OP_SELL) ObjectSet("#"+tk,OBJPROP_COLOR,Red);
             }
             
          }
          
          if(Symbol()==OrderSymbol() && OrderType()>OP_SELL)
          {
             tk=OrderTicket();
             if(ObjectFind("aopen"+tk)==-1)
             {
                ObjectCreate("aopen"+tk,OBJ_ARROW,0,OrderOpenTime(),OrderOpenPrice());
                
                if(OrderType()<=OP_BUYSTOP) ObjectSet("aopen"+tk,OBJPROP_ARROWCODE,217);
                else                        ObjectSet("aopen"+tk,OBJPROP_ARROWCODE,218);
             }
             if(ObjectFind("aclose"+tk)==-1)
             {
                ObjectCreate("aclose"+tk,OBJ_ARROW,0,OrderCloseTime(),OrderOpenPrice());
                ObjectSet("aclose"+tk,OBJPROP_ARROWCODE,251);
             }
             if(ObjectFind("#"+tk)==-1)
             {
    
                ObjectCreate("#"+tk,OBJ_TREND,0,OrderOpenTime(),OrderOpenPrice(),OrderCloseTime(),OrderOpenPrice());
                ObjectSet("#"+tk,OBJPROP_STYLE,STYLE_DOT);
                ObjectSet("#"+tk,OBJPROP_RAY,0);
                ObjectSet("#"+tk,OBJPROP_COLOR,White);
    
             }
             
          }
    
      }
    
    
       int total=OrdersTotal();
       for(i=0;i<total;i++)
       {
          OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
          if(Symbol()==OrderSymbol() && OrderType()<=OP_SELL)
          {
             tk=OrderTicket();
             if(ObjectFind("aopen"+tk)==-1)
             {
                ObjectCreate("aopen"+tk,OBJ_ARROW,0,OrderOpenTime(),OrderOpenPrice());
                ObjectSet("aopen"+tk,OBJPROP_ARROWCODE,1);
                if(OrderType()==OP_BUY) ObjectSet("aopen"+tk,OBJPROP_COLOR,Green);
                if(OrderType()==OP_SELL) ObjectSet("aopen"+tk,OBJPROP_COLOR,Red);
             }
             if(ObjectFind("##"+tk)==-1)
             {
                ObjectCreate("##"+tk,OBJ_TREND,0,OrderOpenTime(),OrderOpenPrice(),Time[0],Bid);
                ObjectSet("##"+tk,OBJPROP_STYLE,STYLE_DOT);
                ObjectSet("##"+tk,OBJPROP_RAY,0);
             }
             else
             {
                ObjectSet("##"+tk,OBJPROP_TIME2,Time[0]);
                ObjectSet("##"+tk,OBJPROP_PRICE2,Bid);
                if(OrderType()==OP_BUY) 
                {
                   ObjectSet("##"+tk,OBJPROP_COLOR,Green);
                   ObjectSet("##"+tk,OBJPROP_PRICE2,Bid);
                   
                }
                if(OrderType()==OP_SELL) 
                {
                   ObjectSet("##"+tk,OBJPROP_COLOR,Red);
                   ObjectSet("##"+tk,OBJPROP_PRICE2,Ask);
                   
                }
             }
          }
    
          if(Symbol()==OrderSymbol() && OrderType()>OP_SELL)
          {
             tk=OrderTicket();
             if(ObjectFind("aopen"+tk)==-1)
             {
                ObjectCreate("aopen"+tk,OBJ_ARROW,0,OrderOpenTime(),OrderOpenPrice());
                if(OrderType()<=OP_BUYSTOP) ObjectSet("aopen"+tk,OBJPROP_ARROWCODE,217);
                else                        ObjectSet("aopen"+tk,OBJPROP_ARROWCODE,218);
             }
             
          }
       }
       
    
    
    //----
       
    //----
       return(0);
      }
    //+------------------------------------------------------------------+
  • 相关阅读:
    东南大学2021年数学分析考研试卷
    东南大学2021年高等代数考研试卷
    东南大学2021年高等代数考研试卷
    东华大学2021年数学分析考研试卷
    东华大学2021年高等代数考研试卷
    [Oracle 工程师手记]探究 Oracle PDB Application Container (二)
    [Oracle 工程师手记]探究 Oracle PDB Application Container (一)
    Jenkins Extended choice parameter和Active Choices param 之Groovy Script使用
    C#异步调用,成功回调中更新界面(线程间操作无效)
    C#使用非托管 DLL 函数
  • 原文地址:https://www.cnblogs.com/wzlmzy/p/4546044.html
Copyright © 2020-2023  润新知