Entry conditions
Condition 1. Monthly bars are rising both high and low.
Condition 2. Both the weekly highs and lows have fallen.
Condition 3. The weekly high is breaking at the daily closing price.

Exit conditions
Condition 1. When the daily low price of the day before the previous day is divided by the daily low price of the previous day.

No entry is made when I run EA.
Corresponding source code
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#include "LibEA4.mqh"
   // Device signal function --------------------------------------------- ----
   int Sig_Entry () {
      int ret = 0;
  // Four values ​​of the previous day's bar
  double C1 = iClose (NULL, PERIOD_D1,1);
  // Four values ​​of the previous week
  double WH1 = iHigh (NULL, PERIOD_W1,1);
  double WL1 = iLow (NULL, PERIOD_W1,1);
  // Four values ​​of the week before last
  double WH2 = iHigh (NULL, PERIOD_W1,2);
  double WL2 = iLow (NULL, PERIOD_W1,2);
  // Four values ​​of the previous month
  double MNH1 = iHigh (NULL, PERIOD_MN1,1);
  double MNL1 = iLow (NULL, PERIOD_MN1,1);
  // 4 prices of the month before last
  double MNH2 = iHigh (NULL, PERIOD_MN1,2);
  double MNL2 = iLow (NULL, PERIOD_MN1,2);
      // Monthly bar is rounding up both high and low
      if (MNH2<MNH1&&MNL2<MNL1) {
         // Both the weekly highs and lows have fallen
         if (WH2>WH1&&WL2>WL1) {
            // Break the weekly highs at the daily closings
            if (WH1<C1) {
               ret = 1;
               return ret;
            } // Daily if
         } // Weekly if
      } // Monthly if
      return ret;
   };// ------------------------------------------------------------ ---

    // Closing signal function --------------------------------------------- ----
    int Sig_Exit () {
      int ret = 0;
  // The previous day's low
  double L1 = iLow (NULL, PERIOD_D1,1);
  // Low of the day before last
  double L2 = iLow (NULL, PERIOD_D1,2);
      // When the daily low of the day before the previous day is divided by the low of the day before
      if (L2>L1)
      ret = 1;
      return ret;
   };// ------------------------------------------------------------ ---

int OnInit ()
   return (INIT_SUCCEEDED);
void OnDeinit (const int reason)
   // Number of trading lots
   extern double lots = 0.1;
void OnTick ()
   // gimmick signal
   int sig_entry = Sig_Entry ();
   // Closing signal
   int sig_exit = Sig_Exit ();
   // Market trading
   MyOrderSendMarket (sig_entry, sig_exit, lots);
What I tried

Check spelling, etc.

Supplementary information (FW/tool version, etc.)

Please provide more detailed information here.

  • Answer # 1

    // Four values ​​of the latest bar
    double H0 = iHigh (NULL, PERIOD_D1,0);
    double L0 = iLow (NULL, PERIOD_D1,0);
    double C0 = iClose (NULL, PERIOD_D1,0);

    With this, it will be updated only once immediately after the start of the test.
    Please update every time in OnTick.