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?
Holidays [SOLVED]
- faraz
- Posts: 216
- Joined: Feb 25 2011
- Location: 1stchoicestrategy.com
- Has thanked: 26 times
- Been thanked: 70 times
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