Explorar o código

Ticket: 4468 Abs Touch Updation, Indicator & Fvg

Huzaifa-MQLDev hai 9 meses
pai
achega
16b85b0a43
Modificáronse 2 ficheiros con 23 adicións e 6 borrados
  1. BIN=BIN
      valFvgMt5.ex5
  2. 23 6
      valFvgMt5.mq5

BIN=BIN
valFvgMt5.ex5


+ 23 - 6
valFvgMt5.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.1"
9 9
 #include <Trade\Trade.mqh>
10 10
 CTrade  trade;
11 11
 #resource "\\Indicators\\SequentialVolumeProfileWithFVG.ex5"
@@ -38,6 +38,13 @@ enum max_trades_option
38 38
    one_buy_sell,   // One Buy One Sell
39 39
   };
40 40
 
41
+enum abs_high_low_touch
42
+  {
43
+   disable_abs,       // Trade Normally
44
+   single_touch_abs,  // Disable Same Side Trading
45
+   both_touch_abs,    // Disable Both Side Trading
46
+  };
47
+
41 48
 sinput       string                  string_0                   = "<><><><><><> General SETTINGS <><><><><><>";   //__
42 49
 input        int                     magic_no                   = 333;             // Magic no
43 50
 input        tp_options              select_tp                  = zone_based;      // Select Tp
@@ -45,6 +52,7 @@ input        sl_options              select_sl                  = zone_based_sl;
45 52
 input        double                  stoploss                   = 4;               // FVG Third High/Low Stop Loss in Buffer
46 53
 input        double                  tpMultiplier               = 2;               // Take Profit Multiplier Risk to Reward
47 54
 input        max_trades_option       selectTradeCountOption     = one_trade;       // Select Max Trades at a Time
55
+input        abs_high_low_touch      selectAbsTouch             = single_touch_abs;// Action on Absolute Touch
48 56
 
49 57
 input        string                  string_0_3                 = "<><><><><><> Lot Management<><><><><><>";   //__
50 58
 input        double                  lot_size                   = 0.1;             // Lot Size
@@ -84,6 +92,11 @@ input        color                   BearishFVGColor            = clrDeepPink;
84 92
 input        double                  MinFVGSize                 = 0.0;              // Minimum FVG size in points (0 = any size)
85 93
 input        int                     MaxBarsBack                = 300;              // How many bars to look back for FVG
86 94
 
95
+input        string                  startHour                  = "23";             // Start Hour
96
+input        string                  startMin                   = "59";             // Start Minutes
97
+input        string                  endHour                    = "00";             // End Hour
98
+input        string                  endMin                     = "05";             // End Minutes
99
+
87 100
 
88 101
 
89 102
 // Global Variables
@@ -125,7 +138,11 @@ int OnInit()
125 138
                                 BullishFVGColor,
126 139
                                 BearishFVGColor,
127 140
                                 MinFVGSize,
128
-                                MaxBarsBack);
141
+                                MaxBarsBack,
142
+                                startHour,
143
+                                startMin,
144
+                                endHour,
145
+                                endMin);
129 146
 
130 147
 
131 148
 //---
@@ -176,7 +193,7 @@ void OnTick()
176 193
                if(((upper_price > absLow) && (lower_price > absLow)))
177 194
                   if(((upper_price > val) && (lower_price < val)) || ((upper_price < val) && (lower_price < val)))
178 195
                     {
179
-                     if(candleNotTouchingHigh(absLow, buy))
196
+                     if((selectAbsTouch == single_touch_abs && candleNotTouchingHigh(absLow, buy)) || (selectAbsTouch == both_touch_abs && candleNotTouchingHigh(absLow, buy) && candleNotTouchingHigh(absHigh, sell)) || (selectAbsTouch == disable_abs))
180 197
                        {
181 198
                         Print("Buy Trade. Val: ", val, "  Vah: ", vah, "  AbsHigh: ", absHigh, "  AbsLow: ", absLow);
182 199
                         placeBuyTrade();
@@ -195,7 +212,7 @@ void OnTick()
195 212
                if(((upper_price < absHigh) && (lower_price < absHigh)))
196 213
                   if(((upper_price > vah) && (lower_price < vah)) || ((upper_price > vah) && (lower_price > vah)))
197 214
                     {
198
-                     if(candleNotTouchingHigh(absHigh, sell))
215
+                     if((selectAbsTouch == single_touch_abs && candleNotTouchingHigh(absHigh, sell)) || (selectAbsTouch == both_touch_abs && candleNotTouchingHigh(absLow, buy) && candleNotTouchingHigh(absHigh, sell)) || (selectAbsTouch == disable_abs))
199 216
                        {
200 217
                         Print("Sell Trade. Val: ", val, "  Vah: ", vah, "  AbsHigh: ", absHigh, "  AbsLow: ", absLow);
201 218
                         placeSellTrade();
@@ -511,7 +528,7 @@ string check_bearish_bullish()
511 528
 string fvg_gap()
512 529
   {
513 530
 //Print("Imbalance: ");
514
-   if(check_bearish_bullish() == previousBullish)
531
+ //  if(check_bearish_bullish() == previousBullish)
515 532
      {
516 533
       if(iLow(Symbol(), PERIOD_CURRENT, 1) > iHigh(Symbol(), PERIOD_CURRENT, 3))
517 534
         {
@@ -536,7 +553,7 @@ string fvg_gap()
536 553
            }
537 554
         }
538 555
      }
539
-   if(check_bearish_bullish() == previousBearish)
556
+  // if(check_bearish_bullish() == previousBearish)
540 557
      {
541 558
       if(iLow(Symbol(), PERIOD_CURRENT, 3) > iHigh(Symbol(), PERIOD_CURRENT, 1))
542 559
         {