Преглед изворни кода

Ticket: 4468 Abs Touch Updation, Indicator & Fvg

Huzaifa-MQLDev пре 9 месеци
родитељ
комит
16b85b0a43
2 измењених фајлова са 23 додато и 6 уклоњено
  1. BIN
      valFvgMt5.ex5
  2. 23 6
      valFvgMt5.mq5

+ 23 - 6
valFvgMt5.mq5

@@ -5,7 +5,7 @@
5
 //+------------------------------------------------------------------+
5
 //+------------------------------------------------------------------+
6
 #property copyright "Copyright 2025, MQL Development"
6
 #property copyright "Copyright 2025, MQL Development"
7
 #property link      "https://www.mqldevelopment.com/"
7
 #property link      "https://www.mqldevelopment.com/"
8
-#property version   "1.00"
8
+#property version   "1.1"
9
 #include <Trade\Trade.mqh>
9
 #include <Trade\Trade.mqh>
10
 CTrade  trade;
10
 CTrade  trade;
11
 #resource "\\Indicators\\SequentialVolumeProfileWithFVG.ex5"
11
 #resource "\\Indicators\\SequentialVolumeProfileWithFVG.ex5"
@@ -38,6 +38,13 @@ enum max_trades_option
38
    one_buy_sell,   // One Buy One Sell
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
 sinput       string                  string_0                   = "<><><><><><> General SETTINGS <><><><><><>";   //__
48
 sinput       string                  string_0                   = "<><><><><><> General SETTINGS <><><><><><>";   //__
42
 input        int                     magic_no                   = 333;             // Magic no
49
 input        int                     magic_no                   = 333;             // Magic no
43
 input        tp_options              select_tp                  = zone_based;      // Select Tp
50
 input        tp_options              select_tp                  = zone_based;      // Select Tp
@@ -45,6 +52,7 @@ input        sl_options              select_sl                  = zone_based_sl;
45
 input        double                  stoploss                   = 4;               // FVG Third High/Low Stop Loss in Buffer
52
 input        double                  stoploss                   = 4;               // FVG Third High/Low Stop Loss in Buffer
46
 input        double                  tpMultiplier               = 2;               // Take Profit Multiplier Risk to Reward
53
 input        double                  tpMultiplier               = 2;               // Take Profit Multiplier Risk to Reward
47
 input        max_trades_option       selectTradeCountOption     = one_trade;       // Select Max Trades at a Time
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
 input        string                  string_0_3                 = "<><><><><><> Lot Management<><><><><><>";   //__
57
 input        string                  string_0_3                 = "<><><><><><> Lot Management<><><><><><>";   //__
50
 input        double                  lot_size                   = 0.1;             // Lot Size
58
 input        double                  lot_size                   = 0.1;             // Lot Size
@@ -84,6 +92,11 @@ input        color                   BearishFVGColor            = clrDeepPink;
84
 input        double                  MinFVGSize                 = 0.0;              // Minimum FVG size in points (0 = any size)
92
 input        double                  MinFVGSize                 = 0.0;              // Minimum FVG size in points (0 = any size)
85
 input        int                     MaxBarsBack                = 300;              // How many bars to look back for FVG
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
 // Global Variables
102
 // Global Variables
@@ -125,7 +138,11 @@ int OnInit()
125
                                 BullishFVGColor,
138
                                 BullishFVGColor,
126
                                 BearishFVGColor,
139
                                 BearishFVGColor,
127
                                 MinFVGSize,
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
                if(((upper_price > absLow) && (lower_price > absLow)))
193
                if(((upper_price > absLow) && (lower_price > absLow)))
177
                   if(((upper_price > val) && (lower_price < val)) || ((upper_price < val) && (lower_price < val)))
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
                         Print("Buy Trade. Val: ", val, "  Vah: ", vah, "  AbsHigh: ", absHigh, "  AbsLow: ", absLow);
198
                         Print("Buy Trade. Val: ", val, "  Vah: ", vah, "  AbsHigh: ", absHigh, "  AbsLow: ", absLow);
182
                         placeBuyTrade();
199
                         placeBuyTrade();
@@ -195,7 +212,7 @@ void OnTick()
195
                if(((upper_price < absHigh) && (lower_price < absHigh)))
212
                if(((upper_price < absHigh) && (lower_price < absHigh)))
196
                   if(((upper_price > vah) && (lower_price < vah)) || ((upper_price > vah) && (lower_price > vah)))
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
                         Print("Sell Trade. Val: ", val, "  Vah: ", vah, "  AbsHigh: ", absHigh, "  AbsLow: ", absLow);
217
                         Print("Sell Trade. Val: ", val, "  Vah: ", vah, "  AbsHigh: ", absHigh, "  AbsLow: ", absLow);
201
                         placeSellTrade();
218
                         placeSellTrade();
@@ -511,7 +528,7 @@ string check_bearish_bullish()
511
 string fvg_gap()
528
 string fvg_gap()
512
   {
529
   {
513
 //Print("Imbalance: ");
530
 //Print("Imbalance: ");
514
-   if(check_bearish_bullish() == previousBullish)
531
+ //  if(check_bearish_bullish() == previousBullish)
515
      {
532
      {
516
       if(iLow(Symbol(), PERIOD_CURRENT, 1) > iHigh(Symbol(), PERIOD_CURRENT, 3))
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
       if(iLow(Symbol(), PERIOD_CURRENT, 3) > iHigh(Symbol(), PERIOD_CURRENT, 1))
558
       if(iLow(Symbol(), PERIOD_CURRENT, 3) > iHigh(Symbol(), PERIOD_CURRENT, 1))
542
         {
559
         {