Explorar o código

Ticket: 5360 Client & Master Sync Managment

Huzaifa-MQLDev hai 1 mes
pai
achega
96fcf16fbf

BIN=BIN
client/localHedgingClientCopierMt5.ex5


+ 7 - 6
client/localHedgingClientCopierMt5.mq5

@@ -212,6 +212,7 @@ void OnTimer()
212 212
   {
213 213
    gmtDifference = (int)TimeCurrent() - (int)TimeGMT();
214 214
    read_history_file();
215
+
215 216
    readData();
216 217
    writeDataClientCof();
217 218
   }
@@ -769,6 +770,7 @@ void readData()
769 770
            {
770 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 774
                int trade_taken = 2;
773 775
                int partialCloseOrderPosition=-1;
774 776
                for(int j=0; j<orderCount; j++)
@@ -850,7 +852,7 @@ void readData()
850 852
                                    {
851 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 857
                                     else
856 858
                                       {
@@ -877,7 +879,7 @@ void readData()
877 879
                                    {
878 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 885
                                  else
@@ -964,16 +966,15 @@ void readData()
964 966
                bool trade_close = true;
965 967
                if(PositionSelectByTicket(cod[i].ticket))
966 968
                  {
967
-
968 969
                   for(int j=0; j<ArraySize(order_array); j++)
969 970
                     {
970 971
                      if(cod[i].magic == (order_array[j].ticket))
971 972
                        {
972
-
973
+                        int digitss = getDoubleSymbolInfo(PositionGetString(POSITION_SYMBOL), "digits");
973 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 978
                            if(trade.PositionModify(PositionGetInteger(POSITION_TICKET),order_array[j].stoploss,order_array[j].takeprofit))
978 979
                              {
979 980
                               Print("Order modified ticket:",PositionGetInteger(POSITION_TICKET));

BIN=BIN
master/localHedgingMasterCopierMt5.ex5


BIN=BIN
master/localHedgingMasterCopierMt5.mq5