Voir comment télécharger gratuitement des robots de trading
Retrouvez-nous sur Facebook !
Rejoignez notre page de fans
Un script intéressant ?
Poster un lien vers celui-ci -
laisser les autres l'évaluer
Vous avez aimé le script ? Essayez-le dans le terminal MetaTrader 5
Experts

Detect Friday of The First Week of The Month - To Detect NFP Day - expert pour MetaTrader 4

Vues:
1086
Note:
(1)
Publié:
2024.07.23 10:12
Mise à jour:
2024.07.23 15:51
Besoin d'un robot ou d'un indicateur basé sur ce code ? Commandez-le sur Freelance Aller sur Freelance
//+------------------------------------------------------------------+
//|                                                  FirstFriday.mq4 |
//|                                  Copyright 2023, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2023, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict


datetime lastTime = 0; // Variable to store the time of the last detected candle

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   lastTime = iTime(Symbol(),PERIOD_D1,0);
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   datetime currentTime = iTime(NULL, PERIOD_D1, 0); // Get the time of the current candle
   if(IsFirstFriday() && currentTime != lastTime)
     {
      Print("This is Friday of The First Week of The Month");
      lastTime = currentTime; // Update the lastTime to the current candle time

     }

  }
//+------------------------------------------------------------------+


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool IsFirstFriday()
  {
// Get the current day of the week (0=Sunday, 1=Monday, ..., 5=Friday, 6=Saturday)
   int dayOfWeek = TimeDayOfWeek(TimeCurrent());

// Get the current day of the month
   int dayOfMonth = TimeDay(TimeCurrent());

// Check if today is Friday
   if(dayOfWeek == 5)
     {
      // Check if the day of the month is between 1 and 7
      if(dayOfMonth >= 1 && dayOfMonth <= 7)
        {
         return(true);
        }
     }
   return(false);
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+

DPO - MA modified - MT4 DPO - MA modified - MT4

change of MA curve to horizontal line and DPO curve shall represent the distance from close price to zero level (or MA curve)

Linear Regression Value Linear Regression Value

Linear Regression Value (metatrader 4 version)

stoploss by atr stoploss by atr

input menu art period 14 ------------------------------ buffer setting buffer 0 or "Blue line" for sell stoploss buffer 1 or "Red line " for buy stoploss

MACD Sample MACD Sample

Classical MACD Sample.