瀏覽代碼

Ticket: 5360 Client & Master Sync Managment

Huzaifa-MQLDev 1 月之前
父節點
當前提交
96fcf16fbf

二進制
client/localHedgingClientCopierMt5.ex5


+ 7 - 6
client/localHedgingClientCopierMt5.mq5

@@ -212,6 +212,7 @@ void OnTimer()
212
   {
212
   {
213
    gmtDifference = (int)TimeCurrent() - (int)TimeGMT();
213
    gmtDifference = (int)TimeCurrent() - (int)TimeGMT();
214
    read_history_file();
214
    read_history_file();
215
+
215
    readData();
216
    readData();
216
    writeDataClientCof();
217
    writeDataClientCof();
217
   }
218
   }
@@ -769,6 +770,7 @@ void readData()
769
            {
770
            {
770
             for(int i=0; i<ArraySize(order_array); i++)
771
             for(int i=0; i<ArraySize(order_array); i++)
771
               {
772
               {
773
+               //Print(" ------------------------------------------  Ticket: ", order_array[ArraySize(order_array)-1].ticket, " Magic Number: ", order_array[ArraySize(order_array)-1].magicNo, " Array Size: ", ArraySize(order_array), " Index: ", i);
772
                int trade_taken = 2;
774
                int trade_taken = 2;
773
                int partialCloseOrderPosition=-1;
775
                int partialCloseOrderPosition=-1;
774
                for(int j=0; j<orderCount; j++)
776
                for(int j=0; j<orderCount; j++)
@@ -850,7 +852,7 @@ void readData()
850
                                    {
852
                                    {
851
                                     if(addOrderMaster(trade.ResultOrder(),order_array[i].ticket,order_array[i].lots, "Market"))
853
                                     if(addOrderMaster(trade.ResultOrder(),order_array[i].ticket,order_array[i].lots, "Market"))
852
                                       {
854
                                       {
853
-                                       Print("Order Ticket:",trade.ResultOrder()," Stored!!!");
855
+                                       Print(" Buy Order Ticket:",trade.ResultOrder()," Stored!!!");
854
                                       }
856
                                       }
855
                                     else
857
                                     else
856
                                       {
858
                                       {
@@ -877,7 +879,7 @@ void readData()
877
                                    {
879
                                    {
878
                                     if(addOrderMaster(trade.ResultOrder(),order_array[i].ticket,order_array[i].lots, "Market"))
880
                                     if(addOrderMaster(trade.ResultOrder(),order_array[i].ticket,order_array[i].lots, "Market"))
879
                                       {
881
                                       {
880
-                                       Print("Order Ticket:",trade.ResultOrder()," Stored!!!");
882
+                                       Print(" Sell Order Ticket:",trade.ResultOrder()," Stored!!!");
881
                                       }
883
                                       }
882
                                    }
884
                                    }
883
                                  else
885
                                  else
@@ -964,16 +966,15 @@ void readData()
964
                bool trade_close = true;
966
                bool trade_close = true;
965
                if(PositionSelectByTicket(cod[i].ticket))
967
                if(PositionSelectByTicket(cod[i].ticket))
966
                  {
968
                  {
967
-
968
                   for(int j=0; j<ArraySize(order_array); j++)
969
                   for(int j=0; j<ArraySize(order_array); j++)
969
                     {
970
                     {
970
                      if(cod[i].magic == (order_array[j].ticket))
971
                      if(cod[i].magic == (order_array[j].ticket))
971
                        {
972
                        {
972
-
973
+                        int digitss = getDoubleSymbolInfo(PositionGetString(POSITION_SYMBOL), "digits");
973
                         trade_close = false;
974
                         trade_close = false;
974
-                        if(PositionGetDouble(POSITION_TP)!=order_array[j].takeprofit || PositionGetDouble(POSITION_SL)!=order_array[j].stoploss)
975
+                        // if(PositionGetDouble(POSITION_TP)!=order_array[j].takeprofit || PositionGetDouble(POSITION_SL)!=order_array[j].stoploss)
976
+                        if(NormalizeDouble(cod[i].takeprofit, digitss) != order_array[j].takeprofit || NormalizeDouble(cod[i].stoploss, digitss) != order_array[j].stoploss)
975
                           {
977
                           {
976
-
977
                            if(trade.PositionModify(PositionGetInteger(POSITION_TICKET),order_array[j].stoploss,order_array[j].takeprofit))
978
                            if(trade.PositionModify(PositionGetInteger(POSITION_TICKET),order_array[j].stoploss,order_array[j].takeprofit))
978
                              {
979
                              {
979
                               Print("Order modified ticket:",PositionGetInteger(POSITION_TICKET));
980
                               Print("Order modified ticket:",PositionGetInteger(POSITION_TICKET));

二進制
master/localHedgingMasterCopierMt5.ex5


二進制
master/localHedgingMasterCopierMt5.mq5