Holidays  [SOLVED]

Questions about MultiCharts and user contributed studies.
Lupomanu32
Posts: 12
Joined: Nov 20 2023
Has thanked: 2 times

Jul 25 2024

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?

User avatar
faraz
Posts: 204
Joined: Feb 25 2011
Location: 1stchoicestrategy.com
Has thanked: 26 times
Been thanked: 67 times

Sep 02 2024

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