How to calculate Easter in Metatrader by formula?

 

I'm doing a project for the community to make a perpetual calendar holiday indicator to advise markets are closing early today and

need to convert an Excel formula that should calculate the day of Easter (Sunday) then -2days for today Friday a trading day.

Would just like the formula to work in Metatrader if possible?


   // excel formula for Easter:   =ROUND(("1/4/"&A1)/7+MOD(19*MOD(A1,19)-7,30)*14%,)*7-6 

   // or:   =FLOOR(DATE(YEAR,5,DAY(MINUTE(YEAR/38)/2+56)),7)-34 

   // where A1=the year

   // source https://www.mrexcel.com/board/threads/how-to-calculate-the-date-of-easter.389703/


   So far..

   int A1=Year();  // may be a double?

   int Easter = MathRound(("1/4/"&A1)/7+MathMod(19*MathMod(A1,19)-7,30)*14%,)*7-6;

   Not sure if the &  tries to mask a quarter of the year or what at this point 🤔 

   Credit will be given to person who solves.

   

  Happy Easter! 

How to calculate the date of Easter...
How to calculate the date of Easter...
  • 2009.05.12
  • www.mrexcel.com
Hello, This isn't a question, but a share. This formula I just finished will caluclate the date of (Roman Catholic/Protestant) Easter in the year of a given date and it does it with no VBA. It uses the Meeus/Jones/Butcher Gregorian algorithm. This algorithm for calculating the date of Easter...