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

input default value set and New bar printing added

WajeehSaqib-MQL пре 9 месеци
родитељ
комит
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
 
 sinput       string                  string_0                   = "<><><><><><> General SETTINGS <><><><><><>";   //__
 input        int                     magic_no                   = 333;             // Magic no
-input        bool                    useTpSlPips                = true;            // Use Relative Tp/Sl in Pips
+input        bool                    useTpSlPips                = false;           // Use Relative Tp/Sl in Pips
 input        double                  stopLoss                   = 100;             // Fixed Stop Loss in Pips
 input        double                  takeProfit                 = 100;             // Fixed Take Profit in Pips
 input        bool                    bothHitsSl                 = false;           // Enable Topped & Tailed Pre-Demand Level
@@ -104,7 +104,7 @@ input        int                     maxSlippage                = 5;
 input        bool                    enableSpreadFilter         = false;           // Enable Spread Filter
 input        double                  maximumSpread              = 10;              // Maximum Spread (Points)
 input        string                  tradeComment               = "Trade Placed";  // Trade Comment Prefix
-input        string                  dataFileName               = "vol_hedge_data.csv"; // Data File Name
+input        string                  dataFileName               = "vol_hedge_data.csv"; // CSV File Name
 
 input        string                  string_1                   = "<><><><><><> Lot Management<><><><><><>";   //__
 input        lotcalculator           lot_calculator             = fix;             // Lot Size Option
@@ -136,14 +136,14 @@ input        int                     High_Stop_Time             = 15;
 input        bool                    show_high_line             = true;                 //Show verticle Line when high news comes
 input        selectLine              Select_News_Line           = 0;                    //News Line
 input        bool                    mobileAlert                = true;                 //Mobile Alert
-input        bool                    Medium_Impact_News         = false;                // Medium Impact News
+input        bool                    Medium_Impact_News         = true;                 // Medium Impact News
 input        int                     Medium_Start_Time          = 60;                   // Stop Trade before medium News (min)
 input        int                     Medium_Stop_Time           = 15;                   // Stop Trade after medium News (min)
-input        bool                    show_medium_line           = false;                // Show vertical Line when medium news comes
-input        bool                    Low_Impact_News            = false;                // Low Impact News
+input        bool                    show_medium_line           = true;                 // Show vertical Line when medium news comes
+input        bool                    Low_Impact_News            = true;                 // Low Impact News
 input        int                     Low_Start_Time             = 60;                   // Stop Trade before low News (min)
 input        int                     Low_Stop_Time              = 15;                   // Stop Trade after low News (min)
-input        bool                    show_low_line              = false;                // Show vertical Line when low news comes
+input        bool                    show_low_line              = true;                 // Show vertical Line when low news comes
 
 // Global Variables
 static double tickCurrentBid = 0;
@@ -421,6 +421,7 @@ void OnTick()
 void mainActivity()
   {
 //---
+   newBar();
    if(indivial_trailing)
      {
       Individual_Trailing();
@@ -455,7 +456,7 @@ void mainActivity()
      }
 
    timeFilter(false);
-// Comment(" Session Start  = ", newYorkStartTrading,  " Asian  Session End = ", newYorkEndTrading);
+//   Comment(" Session Start  = ", newYorkStartTrading,  " Asian  Session End = ", newYorkEndTrading);
    if((enableTimeFilter && TimeCurrent() >= newYorkStartTrading && TimeCurrent() <= newYorkEndTrading) || !enableTimeFilter)
      {
       removeFromStructure();
@@ -467,6 +468,22 @@ void mainActivity()
      }
   }
 //+------------------------------------------------------------------+
+bool newBar()
+  {
+   static datetime lastbar;
+   datetime curbar = iTime(Symbol(), PERIOD_CURRENT, 0);
+   if(lastbar != curbar)
+     {
+      lastbar = curbar;
+      Print(" ---------------------- New Bar :: ---------------------- ",lastbar);
+      return (true);
+     }
+   else
+     {
+      return (false);
+     }
+  }
+
 //+------------------------------------------------------------------+
 //|                                                                  |
 //+------------------------------------------------------------------+