Page 1 of 1

Holidays

Posted: Jul 25 2024
by Lupomanu32
Hi, I would like help to write a function that have holidays that I set.
If tomorrow is holiday I would like close all trade at 10 exchange time.

Can someone help me?

Re: Holidays  [SOLVED]

Posted: Sep 02 2024
by faraz

Code: Select all

// Define your list of holidays inputs: Holiday1(20240903), // Example: September 3, 2024 Holiday2(20241225); // Example: December 25, 2024 var:oTomorrow(D+1), IsHoliday(False); // Check if tomorrow is a holiday if oTomorrow = Holiday1 or oTomorrow = Holiday2 then IsHoliday = True; // Close all trades at 10:00 AM exchange time if tomorrow is a holiday if IsHoliday and Time = 1000 then begin Sell All Contracts Next Bar Market; BuyToCover All Contracts Next Bar Market; end else begin // Put any trading code below //////////////////////////////////// // Put any trading code above //////////////////////////////////// end;

Trading Excellence ! ! !
1stChoiceStrategy.com