Browse Source

Ticket: 5163 TP/SL and CSV updated

Huzaifa-MQLDev 4 months ago
parent
commit
33cc5d33d3
3 changed files with 169 additions and 54 deletions
  1. 3 2
      data/vol_hedge_data.csv
  2. BIN
      vol_hedge_strategy_mt5.ex5
  3. 166 52
      vol_hedge_strategy_mt5.mq5

+ 3 - 2
data/vol_hedge_data.csv

@@ -1,2 +1,3 @@
1
-EURUSDm,1.08384,1000,1000,2023.03.22 02:05:25,2023.03.24 02:05:25
2
-EURUSDm,1.08734,400,400,2023.03.30 00:00:00,2023.04.04 02:05:25
1
+Symbol,Price,Buy StopLoss,Buy TakeProfit,Sell StopLoss,Sell TakeProfit,StartTime,EndTime
2
+EURUSDm,1.08384,1.07384,1.09384,1.09384,1.07384,2023.03.22 02:05:25,2024.03.24 02:05:25
3
+EURUSDm,1.08734,1.07734,1.09734,1.09734,1.07734,2023.03.30 00:00:00,2024.04.04 02:05:25

BIN
vol_hedge_strategy_mt5.ex5


+ 166 - 52
vol_hedge_strategy_mt5.mq5

@@ -5,7 +5,7 @@
5 5
 //+------------------------------------------------------------------+
6 6
 #property copyright "Copyright 2025, MQL Development"
7 7
 #property link      "https://www.mqldevelopment.com/"
8
-#property version   "1.00"
8
+#property version   "1.10"
9 9
 #define MaxOrders 100
10 10
 #include <Trade\Trade.mqh>
11 11
 CTrade  trade;
@@ -61,8 +61,10 @@ struct new_trade_store
61 61
    ulong             sell_ticket;           // Sell Ticket
62 62
    string            symbol;                // Symbol
63 63
    double            price;                 // Price
64
-   double            stop_loss;             // StopLoss
65
-   double            take_profit;           // TakeProfit
64
+   double            stop_loss_buy;         // StopLoss Buy
65
+   double            take_profit_buy;       // TakeProfit Buy
66
+   double            stop_loss_sell;        // StopLoss Sell
67
+   double            take_profit_sell;      // TakeProfit Sell
66 68
    datetime          start_time;            // Start time
67 69
    datetime          end_time;              // End Time
68 70
    bool              buy_hit_virtual_sl;    // Buy Hit Virtual StopLoss
@@ -89,8 +91,10 @@ enum lotcalculator
89 91
 
90 92
 sinput       string                  string_0                   = "<><><><><><> General SETTINGS <><><><><><>";   //__
91 93
 input        int                     magic_no                   = 333;             // Magic no
94
+input        bool                    useTpSlPips                = true;            // Use Tp/Sl in Pips
95
+input        double                  stopLoss                   = 100;             // Fixed Stop Loss in Pips
96
+input        double                  takeProfit                 = 100;             // Fixed Take Profit in Pips
92 97
 input        bool                    bothHitsSl                 = false;           // Open after Both Hits StopLoss
93
-input        int                     maxTrades                  = 2;               // Max Concurrent Trades
94 98
 input        int                     maxSlippage                = 5;               // Max Slippage
95 99
 input        bool                    enableSpreadFilter         = false;           // Enable Spread Filter
96 100
 input        double                  maximumSpread              = 10;              // Maximum Spread
@@ -140,6 +144,7 @@ double tickPreviousBid = 0;
140 144
 static double tickCurrentAsk = 0;
141 145
 double tickPreviousAsk = 0;
142 146
 datetime startSessionTime, endSessionTime;
147
+int maxTrades = 2; // Max Concurrent Trades
143 148
 int GMT_Broker_Time = +2; // GMT_Broker_Time Time of your Broker
144 149
 int                     gmt                        = 0;                   // GMT_Broker_Time Time of your Broker
145 150
 string Lname="newsLabel3";
@@ -179,7 +184,7 @@ int OnInit()
179 184
             Print(" Order Data: ", orderData[i], " i: ", i);
180 185
            }
181 186
 
182
-         if(ArraySize(orderData) >= 6)
187
+         if(ArraySize(orderData) >= 8)
183 188
            {
184 189
             if(orderData[0] == Symbol())
185 190
               {
@@ -188,11 +193,13 @@ int OnInit()
188 193
                ulong  sell_ticket_local = (ulong)-1;
189 194
                string symbol_local      = orderData[0];
190 195
                double price_local       = StringToDouble(orderData[1]);
191
-               double sl_local          = StringToDouble(orderData[2]);
192
-               double tp_local          = StringToDouble(orderData[3]);
196
+               double sl_buy_local      = StringToDouble(orderData[2]);
197
+               double tp_buy_local      = StringToDouble(orderData[3]);
198
+               double sl_sell_local     = StringToDouble(orderData[4]);
199
+               double tp_sell_local     = StringToDouble(orderData[5]);
193 200
                // if your CSV has extra fields (tp2,tp3, etc.) parse here as needed
194
-               datetime start_local     = StringToTime(orderData[4]);
195
-               datetime end_local       = StringToTime(orderData[5]);
201
+               datetime start_local     = StringToTime(orderData[6]);
202
+               datetime end_local       = StringToTime(orderData[7]);
196 203
 
197 204
                ArrayResize(levelsAre,ArraySize(levelsAre)+1);
198 205
                levelsAre[ArraySize(levelsAre) - 1] = price_local;
@@ -212,7 +219,8 @@ int OnInit()
212 219
                  {
213 220
                   addToNewTradeStore(buy_ticket_local, sell_ticket_local,
214 221
                                      symbol_local, price_local,
215
-                                     sl_local, tp_local,
222
+                                     sl_buy_local, tp_buy_local,
223
+                                     sl_sell_local, tp_sell_local,
216 224
                                      start_local, end_local,
217 225
                                      buy_virtual_tp_hit, sell_virtual_tp_hit);
218 226
                  }
@@ -566,14 +574,16 @@ void struct_level_check()
566 574
                buy_virtual_tp_hit = false;
567 575
                sell_virtual_tp_hit = false;
568 576
               }
569
-            newTradeStore[i].buy_hit_virtual_sl = buy_virtual_tp_hit;
577
+            newTradeStore[i].buy_hit_virtual_sl  = buy_virtual_tp_hit;
570 578
             newTradeStore[i].sell_hit_virtual_sl = sell_virtual_tp_hit;
571
-            newTradeStore[i].symbol      = "";
572
-            newTradeStore[i].price       = 0.0;
573
-            newTradeStore[i].stop_loss   = 0.0;
574
-            newTradeStore[i].take_profit = 0.0;
575
-            newTradeStore[i].start_time  = 0;
576
-            newTradeStore[i].end_time    = 0;
579
+            newTradeStore[i].symbol           = "";
580
+            newTradeStore[i].price            = 0.0;
581
+            newTradeStore[i].stop_loss_buy    = 0.0;
582
+            newTradeStore[i].take_profit_buy  = 0.0;
583
+            newTradeStore[i].stop_loss_sell   = 0.0;
584
+            newTradeStore[i].take_profit_sell = 0.0;
585
+            newTradeStore[i].start_time       = 0;
586
+            newTradeStore[i].end_time         = 0;
577 587
             return;
578 588
            }
579 589
         }
@@ -587,7 +597,8 @@ void struct_level_check()
587 597
 //+------------------------------------------------------------------+
588 598
 void addToNewTradeStore(ulong r_buy_ticket, ulong r_sell_ticket,
589 599
                         string r_symbol, double r_price,
590
-                        double r_stop_loss, double r_take_profit,
600
+                        double r_stop_loss_buy, double r_take_profit_buy,
601
+                        double r_stop_loss_sell, double r_take_profit_sell,
591 602
                         datetime r_start_time, datetime r_end_time, bool r_buy_hit_sl, bool r_sell_hit_sl)
592 603
   {
593 604
    Print(" Tier 1. ");
@@ -602,8 +613,10 @@ void addToNewTradeStore(ulong r_buy_ticket, ulong r_sell_ticket,
602 613
             newTradeStore[i].sell_ticket = r_sell_ticket;
603 614
             newTradeStore[i].symbol      = r_symbol;
604 615
             newTradeStore[i].price       = r_price;
605
-            newTradeStore[i].stop_loss   = r_stop_loss;
606
-            newTradeStore[i].take_profit = r_take_profit;
616
+            newTradeStore[i].stop_loss_buy   = r_stop_loss_buy;
617
+            newTradeStore[i].take_profit_buy = r_take_profit_buy;
618
+            newTradeStore[i].stop_loss_sell   = r_stop_loss_sell;
619
+            newTradeStore[i].take_profit_sell = r_take_profit_sell;
607 620
             newTradeStore[i].start_time  = r_start_time;
608 621
             newTradeStore[i].end_time    = r_end_time;
609 622
             newTradeStore[i].buy_hit_virtual_sl = r_buy_hit_sl;
@@ -612,8 +625,10 @@ void addToNewTradeStore(ulong r_buy_ticket, ulong r_sell_ticket,
612 625
             Print("Stored -> idx: ", i,
613 626
                   " | Symbol: ", newTradeStore[i].symbol,
614 627
                   " | price: ", DoubleToString(newTradeStore[i].price, Digits()),
615
-                  " | sl: ", DoubleToString(newTradeStore[i].stop_loss, Digits()),
616
-                  " | tp: ", DoubleToString(newTradeStore[i].take_profit, Digits()),
628
+                  " | Sl Buy: ", DoubleToString(newTradeStore[i].stop_loss_buy, Digits()),
629
+                  " | Tp Buy: ", DoubleToString(newTradeStore[i].take_profit_buy, Digits()),
630
+                  "\n | Sl Sell: ", DoubleToString(newTradeStore[i].stop_loss_sell, Digits()),
631
+                  " | Tp Sell: ", DoubleToString(newTradeStore[i].take_profit_sell, Digits()),
617 632
                   " | start: ", TimeToString(newTradeStore[i].start_time, TIME_DATE|TIME_SECONDS),
618 633
                   " | end: ", TimeToString(newTradeStore[i].end_time, TIME_DATE|TIME_SECONDS),
619 634
                   " | Buy Virtal Sl Hit: ", newTradeStore[i].buy_hit_virtual_sl,
@@ -642,12 +657,12 @@ void tradePlacingCheck()
642 657
                   if((tickPreviousBid > levelPriceIs && tickCurrentBid < levelPriceIs) ||
643 658
                      (tickPreviousBid < levelPriceIs && tickCurrentBid > levelPriceIs))
644 659
                     {
645
-                     if(countLiveTrades() < maxTrades)
660
+                     if(countLiveTrades() == 0)
646 661
                        {
647 662
                         if((enableSpreadFilter && spreadFilter()) || !enableSpreadFilter)
648 663
                           {
649
-                           ulong buyTicket = placeBuyTrade(newTradeStore[i].stop_loss, newTradeStore[i].take_profit);
650
-                           ulong sellTicket = placeSellTrade(newTradeStore[i].stop_loss, newTradeStore[i].take_profit);
664
+                           ulong buyTicket = placeBuyTrade(newTradeStore[i].stop_loss_buy, newTradeStore[i].take_profit_buy);
665
+                           ulong sellTicket = placeSellTrade(newTradeStore[i].stop_loss_sell, newTradeStore[i].take_profit_sell);
651 666
 
652 667
                            newTradeStore[i].buy_ticket = buyTicket;
653 668
                            newTradeStore[i].sell_ticket = sellTicket;
@@ -671,13 +686,27 @@ ulong placeBuyTrade(double stoploss, double takeprofit)
671 686
    double Ask = SymbolInfoDouble(Symbol(),SYMBOL_ASK);
672 687
    double Bid = SymbolInfoDouble(Symbol(),SYMBOL_BID);
673 688
 
674
-   if(stoploss != 0)
689
+   if(useTpSlPips)
675 690
      {
676
-      buySL = Ask - (stoploss * Point());
691
+      if(stoploss != 0)
692
+        {
693
+         buySL = Ask - (stopLoss * 10 * Point());
694
+        }
695
+      if(takeprofit != 0)
696
+        {
697
+         buyTp = Ask + (takeProfit * 10 * Point());
698
+        }
677 699
      }
678
-   if(takeprofit != 0)
700
+   else
679 701
      {
680
-      buyTp = Ask + (takeprofit * Point());
702
+      if(stoploss > 0)
703
+        {
704
+         buySL = stoploss;
705
+        }
706
+      if(takeprofit > 0)
707
+        {
708
+         buyTp = takeprofit;
709
+        }
681 710
      }
682 711
 
683 712
    double distance = MathAbs((Ask - buySL) / Point());
@@ -703,13 +732,27 @@ ulong placeSellTrade(double stoploss, double takeprofit)
703 732
    double Ask = SymbolInfoDouble(Symbol(),SYMBOL_ASK);
704 733
    double Bid = SymbolInfoDouble(Symbol(),SYMBOL_BID);
705 734
 
706
-   if(stoploss != 0)
735
+   if(useTpSlPips)
707 736
      {
708
-      sellSL = Bid + (stoploss * Point());
737
+      if(stoploss != 0)
738
+        {
739
+         sellSL = Bid + (stopLoss * 10 * Point());
740
+        }
741
+      if(takeprofit != 0)
742
+        {
743
+         sellTp = Bid - (takeProfit * 10 * Point());
744
+        }
709 745
      }
710
-   if(takeprofit != 0)
746
+   else
711 747
      {
712
-      sellTp = Bid - (takeprofit * Point());
748
+      if(stoploss > 0)
749
+        {
750
+         sellSL = stoploss;
751
+        }
752
+      if(takeprofit > 0)
753
+        {
754
+         sellTp = takeprofit;
755
+        }
713 756
      }
714 757
    double distance = MathAbs((Bid - sellSL) / Point());
715 758
    if(trade.PositionOpen(Symbol(),ORDER_TYPE_SELL,getLot(distance),Bid,sellSL,sellTp,"Sell Trade Placed"))
@@ -941,8 +984,17 @@ void virtualSLHitCheck()
941 984
         {
942 985
          if(TimeCurrent() > newTradeStore[i].start_time && TimeCurrent() < newTradeStore[i].end_time)
943 986
            {
944
-            double buy_sl = newTradeStore[i].price - (newTradeStore[i].stop_loss * Point());
945
-            double sell_sl = newTradeStore[i].price + (newTradeStore[i].stop_loss * Point());
987
+            double buy_sl = 0, sell_sl = 0;
988
+            if(!useTpSlPips)
989
+              {
990
+               buy_sl = newTradeStore[i].stop_loss_buy;
991
+               sell_sl = newTradeStore[i].stop_loss_sell;
992
+              }
993
+            else
994
+              {
995
+               buy_sl = newTradeStore[i].price - (stopLoss * 10 * Point());
996
+               sell_sl = newTradeStore[i].price + (stopLoss * 10 * Point());
997
+              }
946 998
             if(newTradeStore[i].buy_hit_virtual_sl == false)
947 999
               {
948 1000
                if((tickPreviousBid < buy_sl && tickCurrentBid > buy_sl))
@@ -1017,6 +1069,11 @@ void breakEven()
1017 1069
         {
1018 1070
          if(PositionGetString(POSITION_SYMBOL)==Symbol()  && PositionGetInteger(POSITION_MAGIC) == magic_no)
1019 1071
            {
1072
+            if(isCounterpartOpen(ticket))
1073
+              {
1074
+               // counterpart still open -> skip trailing for this position
1075
+               continue;
1076
+              }
1020 1077
             //========================================================Buy Condition=========================================================================
1021 1078
             if(PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY)
1022 1079
               {
@@ -1061,6 +1118,48 @@ void breakEven()
1061 1118
 //+------------------------------------------------------------------+
1062 1119
 //|                                                                  |
1063 1120
 //+------------------------------------------------------------------+
1121
+bool isCounterpartOpen(ulong ticket)
1122
+  {
1123
+// scan stored pairs
1124
+   for(int k=0; k<MaxOrders; k++)
1125
+     {
1126
+      // check if this ticket is the buy side in the pair
1127
+      if(newTradeStore[k].buy_ticket == ticket)
1128
+        {
1129
+         ulong other = newTradeStore[k].sell_ticket;
1130
+         if(other <= 0)
1131
+            return false; // no counterpart recorded -> treat as closed
1132
+         // check if counterpart ticket exists in current positions
1133
+         for(int p = PositionsTotal()-1; p >= 0; p--)
1134
+           {
1135
+            ulong t = PositionGetTicket(p);
1136
+            if(t == other)
1137
+               return true; // counterpart still open
1138
+           }
1139
+         return false; // counterpart not found -> closed
1140
+        }
1141
+
1142
+      // check if this ticket is the sell side in the pair
1143
+      if(newTradeStore[k].sell_ticket == ticket)
1144
+        {
1145
+         ulong other = newTradeStore[k].buy_ticket;
1146
+         if(other <= 0)
1147
+            return false; // no counterpart recorded -> treat as closed
1148
+         for(int p = PositionsTotal()-1; p >= 0; p--)
1149
+           {
1150
+            ulong t = PositionGetTicket(p);
1151
+            if(t == other)
1152
+               return true; // counterpart still open
1153
+           }
1154
+         return false; // counterpart not found -> closed
1155
+        }
1156
+     }
1157
+// ticket not found in the stored pairs -> treat as no counterpart open
1158
+   return false;
1159
+  }
1160
+//+------------------------------------------------------------------+
1161
+//|                                                                  |
1162
+//+------------------------------------------------------------------+
1064 1163
 void Individual_Trailing()
1065 1164
   {
1066 1165
    int openedpositions;
@@ -1075,13 +1174,19 @@ void Individual_Trailing()
1075 1174
          ulong ticket = PositionGetTicket(i);
1076 1175
          if(PositionSelectByTicket(ticket))
1077 1176
            {
1078
-            if(PositionGetString(POSITION_SYMBOL)==Symbol()  && PositionGetInteger(POSITION_MAGIC) ==magic_no) // only look if mygrid and symbol. ..
1177
+            if(PositionGetString(POSITION_SYMBOL)==Symbol()  && PositionGetInteger(POSITION_MAGIC) == magic_no) // only look if mygrid and symbol. ..
1079 1178
               {
1179
+               if(isCounterpartOpen(ticket))
1180
+                 {
1181
+                  // counterpart still open -> skip trailing for this position
1182
+                  continue;
1183
+                 }
1080 1184
 
1081 1185
                double SymbolAsk           = SymbolInfoDouble(PositionGetString(POSITION_SYMBOL), SYMBOL_ASK);
1082 1186
                double SymbolBid           = SymbolInfoDouble(PositionGetString(POSITION_SYMBOL), SYMBOL_BID);
1083 1187
                int SymbolDigits           = (int)SymbolInfoInteger(PositionGetString(POSITION_SYMBOL), SYMBOL_DIGITS);
1084 1188
                double SymbolTickSize      = SymbolInfoDouble(PositionGetString(POSITION_SYMBOL), SYMBOL_TRADE_TICK_SIZE);
1189
+
1085 1190
                int type= (int)PositionGetInteger(POSITION_TYPE);
1086 1191
 
1087 1192
                if(type==POSITION_TYPE_BUY) // its a long position
@@ -1154,9 +1259,11 @@ void saveNewTradeStoreFile()
1154 1259
       // convert values to strings
1155 1260
       string buyTicketStr  = IntegerToString((long)newTradeStore[i].buy_ticket);
1156 1261
       string sellTicketStr = IntegerToString((long)newTradeStore[i].sell_ticket);
1157
-      string priceStr      = DoubleToString(newTradeStore[i].price, _Digits);
1158
-      string slStr         = DoubleToString(newTradeStore[i].stop_loss, _Digits);
1159
-      string tpStr         = DoubleToString(newTradeStore[i].take_profit, _Digits);
1262
+      string priceStr      = DoubleToString(newTradeStore[i].price, Digits());
1263
+      string slBuyStr      = DoubleToString(newTradeStore[i].stop_loss_buy, Digits());
1264
+      string tpBuyStr      = DoubleToString(newTradeStore[i].take_profit_buy, Digits());
1265
+      string slSellStr      = DoubleToString(newTradeStore[i].stop_loss_sell, Digits());
1266
+      string tpSellStr      = DoubleToString(newTradeStore[i].take_profit_sell, Digits());
1160 1267
 
1161 1268
       string startTimeStr  = (newTradeStore[i].start_time != 0) ? TimeToString(newTradeStore[i].start_time, TIME_DATE|TIME_SECONDS) : "";
1162 1269
       string endTimeStr    = (newTradeStore[i].end_time   != 0) ? TimeToString(newTradeStore[i].end_time, TIME_DATE|TIME_SECONDS)   : "";
@@ -1185,7 +1292,8 @@ void saveNewTradeStoreFile()
1185 1292
       // build CSV line and write
1186 1293
       string line = buyTicketStr + "," + sellTicketStr + "," +
1187 1294
                     newTradeStore[i].symbol + "," +
1188
-                    priceStr + "," + slStr + "," + tpStr + "," +
1295
+                    priceStr + "," + slBuyStr + "," + tpBuyStr + "," +
1296
+                    slSellStr + "," + tpSellStr + "," +
1189 1297
                     startTimeStr + "," + endTimeStr + "," +
1190 1298
                     buyHitStr + "," + sellHitStr + "\r\n";
1191 1299
 
@@ -1220,8 +1328,10 @@ void loadNewTradeStoreFile()
1220 1328
       newTradeStore[j].sell_ticket          = (ulong)-1;
1221 1329
       newTradeStore[j].symbol               = "";
1222 1330
       newTradeStore[j].price                = 0.0;
1223
-      newTradeStore[j].stop_loss            = 0.0;
1224
-      newTradeStore[j].take_profit          = 0.0;
1331
+      newTradeStore[j].stop_loss_buy        = 0.0;
1332
+      newTradeStore[j].take_profit_buy      = 0.0;
1333
+      newTradeStore[j].stop_loss_sell       = 0.0;
1334
+      newTradeStore[j].take_profit_sell     = 0.0;
1225 1335
       newTradeStore[j].start_time           = 0;
1226 1336
       newTradeStore[j].end_time             = 0;
1227 1337
       newTradeStore[j].buy_hit_virtual_sl   = false;
@@ -1238,24 +1348,26 @@ void loadNewTradeStoreFile()
1238 1348
       string tokens[];
1239 1349
       int total = StringSplit(line, ',', tokens);
1240 1350
 
1241
-      if(total >= 10)
1351
+      if(total >= 12)
1242 1352
         {
1243 1353
          newTradeStore[idx].buy_ticket  = (ulong)tokens[0];
1244 1354
          newTradeStore[idx].sell_ticket = (ulong)tokens[1];
1245 1355
          newTradeStore[idx].symbol      = tokens[2];
1246 1356
          newTradeStore[idx].price       = StringToDouble(tokens[3]);
1247
-         newTradeStore[idx].stop_loss   = StringToDouble(tokens[4]);
1248
-         newTradeStore[idx].take_profit = StringToDouble(tokens[5]);
1357
+         newTradeStore[idx].stop_loss_buy   = StringToDouble(tokens[4]);
1358
+         newTradeStore[idx].take_profit_buy = StringToDouble(tokens[5]);
1359
+         newTradeStore[idx].stop_loss_sell  = StringToDouble(tokens[6]);
1360
+         newTradeStore[idx].take_profit_sell = StringToDouble(tokens[7]);
1249 1361
 
1250
-         string sStart = tokens[6];
1251
-         string sEnd   = tokens[7];
1362
+         string sStart = tokens[8];
1363
+         string sEnd   = tokens[9];
1252 1364
          newTradeStore[idx].start_time = (StringLen(sStart) > 0) ? StringToTime(sStart) : 0;
1253 1365
          newTradeStore[idx].end_time   = (StringLen(sEnd)   > 0) ? StringToTime(sEnd)   : 0;
1254 1366
 
1255 1367
          bool bHit = false;
1256 1368
          bool sHit = false;
1257 1369
 
1258
-         if(tokens[8] == "true")
1370
+         if(tokens[10] == "true")
1259 1371
            {
1260 1372
             bHit = true;
1261 1373
            }
@@ -1264,7 +1376,7 @@ void loadNewTradeStoreFile()
1264 1376
             bHit = false;
1265 1377
            }
1266 1378
 
1267
-         if(tokens[9] == "true")
1379
+         if(tokens[11] == "true")
1268 1380
            {
1269 1381
             sHit = true;
1270 1382
            }
@@ -1282,9 +1394,11 @@ void loadNewTradeStoreFile()
1282 1394
             " buy_ticket=", newTradeStore[idx].buy_ticket,
1283 1395
             " sell_ticket=", newTradeStore[idx].sell_ticket,
1284 1396
             " symbol=", newTradeStore[idx].symbol,
1285
-            " price=", DoubleToString(newTradeStore[idx].price, _Digits),
1286
-            " \n sl=", DoubleToString(newTradeStore[idx].stop_loss, _Digits),
1287
-            " tp=", DoubleToString(newTradeStore[idx].take_profit, _Digits),
1397
+            " price=", DoubleToString(newTradeStore[idx].price, Digits()),
1398
+            " \n sl buy=", DoubleToString(newTradeStore[idx].stop_loss_buy, Digits()),
1399
+            " tp buy=", DoubleToString(newTradeStore[idx].take_profit_buy, Digits()),
1400
+            " sl sell=", DoubleToString(newTradeStore[idx].stop_loss_sell, Digits()),
1401
+            " tp sell=", DoubleToString(newTradeStore[idx].take_profit_sell, Digits()),
1288 1402
             " start=", (newTradeStore[idx].start_time != 0 ? TimeToString(newTradeStore[idx].start_time, TIME_DATE|TIME_SECONDS) : ""),
1289 1403
             " end=", (newTradeStore[idx].end_time   != 0 ? TimeToString(newTradeStore[idx].end_time,   TIME_DATE|TIME_SECONDS) : ""),
1290 1404
             " buyHit=", newTradeStore[idx].buy_hit_virtual_sl,