ソースを参照

input default value set and New bar printing added

WajeehSaqib-MQL 4 ヶ月 前
コミット
819baddc7e
共有2 個のファイルを変更した24 個の追加7 個の削除を含む
  1. BIN
      vol_hedge_strategy_mt5.ex5
  2. 24 7
      vol_hedge_strategy_mt5.mq5

BIN
vol_hedge_strategy_mt5.ex5


+ 24 - 7
vol_hedge_strategy_mt5.mq5

@@ -96,7 +96,7 @@ enum lotcalculator
96 96
 
97 97
 sinput       string                  string_0                   = "<><><><><><> General SETTINGS <><><><><><>";   //__
98 98
 input        int                     magic_no                   = 333;             // Magic no
99
-input        bool                    useTpSlPips                = true;            // Use Relative Tp/Sl in Pips
99
+input        bool                    useTpSlPips                = false;           // Use Relative Tp/Sl in Pips
100 100
 input        double                  stopLoss                   = 100;             // Fixed Stop Loss in Pips
101 101
 input        double                  takeProfit                 = 100;             // Fixed Take Profit in Pips
102 102
 input        bool                    bothHitsSl                 = false;           // Enable Topped & Tailed Pre-Demand Level
@@ -104,7 +104,7 @@ input        int                     maxSlippage                = 5;
104 104
 input        bool                    enableSpreadFilter         = false;           // Enable Spread Filter
105 105
 input        double                  maximumSpread              = 10;              // Maximum Spread (Points)
106 106
 input        string                  tradeComment               = "Trade Placed";  // Trade Comment Prefix
107
-input        string                  dataFileName               = "vol_hedge_data.csv"; // Data File Name
107
+input        string                  dataFileName               = "vol_hedge_data.csv"; // CSV File Name
108 108
 
109 109
 input        string                  string_1                   = "<><><><><><> Lot Management<><><><><><>";   //__
110 110
 input        lotcalculator           lot_calculator             = fix;             // Lot Size Option
@@ -136,14 +136,14 @@ input        int                     High_Stop_Time             = 15;
136 136
 input        bool                    show_high_line             = true;                 //Show verticle Line when high news comes
137 137
 input        selectLine              Select_News_Line           = 0;                    //News Line
138 138
 input        bool                    mobileAlert                = true;                 //Mobile Alert
139
-input        bool                    Medium_Impact_News         = false;                // Medium Impact News
139
+input        bool                    Medium_Impact_News         = true;                 // Medium Impact News
140 140
 input        int                     Medium_Start_Time          = 60;                   // Stop Trade before medium News (min)
141 141
 input        int                     Medium_Stop_Time           = 15;                   // Stop Trade after medium News (min)
142
-input        bool                    show_medium_line           = false;                // Show vertical Line when medium news comes
143
-input        bool                    Low_Impact_News            = false;                // Low Impact News
142
+input        bool                    show_medium_line           = true;                 // Show vertical Line when medium news comes
143
+input        bool                    Low_Impact_News            = true;                 // Low Impact News
144 144
 input        int                     Low_Start_Time             = 60;                   // Stop Trade before low News (min)
145 145
 input        int                     Low_Stop_Time              = 15;                   // Stop Trade after low News (min)
146
-input        bool                    show_low_line              = false;                // Show vertical Line when low news comes
146
+input        bool                    show_low_line              = true;                 // Show vertical Line when low news comes
147 147
 
148 148
 // Global Variables
149 149
 static double tickCurrentBid = 0;
@@ -421,6 +421,7 @@ void OnTick()
421 421
 void mainActivity()
422 422
   {
423 423
 //---
424
+   newBar();
424 425
    if(indivial_trailing)
425 426
      {
426 427
       Individual_Trailing();
@@ -455,7 +456,7 @@ void mainActivity()
455 456
      }
456 457
 
457 458
    timeFilter(false);
458
-// Comment(" Session Start  = ", newYorkStartTrading,  " Asian  Session End = ", newYorkEndTrading);
459
+//   Comment(" Session Start  = ", newYorkStartTrading,  " Asian  Session End = ", newYorkEndTrading);
459 460
    if((enableTimeFilter && TimeCurrent() >= newYorkStartTrading && TimeCurrent() <= newYorkEndTrading) || !enableTimeFilter)
460 461
      {
461 462
       removeFromStructure();
@@ -467,6 +468,22 @@ void mainActivity()
467 468
      }
468 469
   }
469 470
 //+------------------------------------------------------------------+
471
+bool newBar()
472
+  {
473
+   static datetime lastbar;
474
+   datetime curbar = iTime(Symbol(), PERIOD_CURRENT, 0);
475
+   if(lastbar != curbar)
476
+     {
477
+      lastbar = curbar;
478
+      Print(" ---------------------- New Bar :: ---------------------- ",lastbar);
479
+      return (true);
480
+     }
481
+   else
482
+     {
483
+      return (false);
484
+     }
485
+  }
486
+
470 487
 //+------------------------------------------------------------------+
471 488
 //|                                                                  |
472 489
 //+------------------------------------------------------------------+