Quellcode durchsuchen

input default value set and New bar printing added

WajeehSaqib-MQL vor 4 Monaten
Ursprung
Commit
819baddc7e
2 geänderte Dateien mit 24 neuen und 7 gelöschten Zeilen
  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
 sinput       string                  string_0                   = "<><><><><><> General SETTINGS <><><><><><>";   //__
97
 sinput       string                  string_0                   = "<><><><><><> General SETTINGS <><><><><><>";   //__
98
 input        int                     magic_no                   = 333;             // Magic no
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
 input        double                  stopLoss                   = 100;             // Fixed Stop Loss in Pips
100
 input        double                  stopLoss                   = 100;             // Fixed Stop Loss in Pips
101
 input        double                  takeProfit                 = 100;             // Fixed Take Profit in Pips
101
 input        double                  takeProfit                 = 100;             // Fixed Take Profit in Pips
102
 input        bool                    bothHitsSl                 = false;           // Enable Topped & Tailed Pre-Demand Level
102
 input        bool                    bothHitsSl                 = false;           // Enable Topped & Tailed Pre-Demand Level
@@ -104,7 +104,7 @@ input        int                     maxSlippage                = 5;
104
 input        bool                    enableSpreadFilter         = false;           // Enable Spread Filter
104
 input        bool                    enableSpreadFilter         = false;           // Enable Spread Filter
105
 input        double                  maximumSpread              = 10;              // Maximum Spread (Points)
105
 input        double                  maximumSpread              = 10;              // Maximum Spread (Points)
106
 input        string                  tradeComment               = "Trade Placed";  // Trade Comment Prefix
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
 input        string                  string_1                   = "<><><><><><> Lot Management<><><><><><>";   //__
109
 input        string                  string_1                   = "<><><><><><> Lot Management<><><><><><>";   //__
110
 input        lotcalculator           lot_calculator             = fix;             // Lot Size Option
110
 input        lotcalculator           lot_calculator             = fix;             // Lot Size Option
@@ -136,14 +136,14 @@ input        int                     High_Stop_Time             = 15;
136
 input        bool                    show_high_line             = true;                 //Show verticle Line when high news comes
136
 input        bool                    show_high_line             = true;                 //Show verticle Line when high news comes
137
 input        selectLine              Select_News_Line           = 0;                    //News Line
137
 input        selectLine              Select_News_Line           = 0;                    //News Line
138
 input        bool                    mobileAlert                = true;                 //Mobile Alert
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
 input        int                     Medium_Start_Time          = 60;                   // Stop Trade before medium News (min)
140
 input        int                     Medium_Start_Time          = 60;                   // Stop Trade before medium News (min)
141
 input        int                     Medium_Stop_Time           = 15;                   // Stop Trade after medium News (min)
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
 input        int                     Low_Start_Time             = 60;                   // Stop Trade before low News (min)
144
 input        int                     Low_Start_Time             = 60;                   // Stop Trade before low News (min)
145
 input        int                     Low_Stop_Time              = 15;                   // Stop Trade after low News (min)
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
 // Global Variables
148
 // Global Variables
149
 static double tickCurrentBid = 0;
149
 static double tickCurrentBid = 0;
@@ -421,6 +421,7 @@ void OnTick()
421
 void mainActivity()
421
 void mainActivity()
422
   {
422
   {
423
 //---
423
 //---
424
+   newBar();
424
    if(indivial_trailing)
425
    if(indivial_trailing)
425
      {
426
      {
426
       Individual_Trailing();
427
       Individual_Trailing();
@@ -455,7 +456,7 @@ void mainActivity()
455
      }
456
      }
456
 
457
 
457
    timeFilter(false);
458
    timeFilter(false);
458
-// Comment(" Session Start  = ", newYorkStartTrading,  " Asian  Session End = ", newYorkEndTrading);
459
+//   Comment(" Session Start  = ", newYorkStartTrading,  " Asian  Session End = ", newYorkEndTrading);
459
    if((enableTimeFilter && TimeCurrent() >= newYorkStartTrading && TimeCurrent() <= newYorkEndTrading) || !enableTimeFilter)
460
    if((enableTimeFilter && TimeCurrent() >= newYorkStartTrading && TimeCurrent() <= newYorkEndTrading) || !enableTimeFilter)
460
      {
461
      {
461
       removeFromStructure();
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
 //+------------------------------------------------------------------+