I'd like some help with the following signal:
Code: Select all
// set the begin of a new month with a true/false condition
if month(date) <> month(date)[1] then
condition1 = true
else
condition1 = false;
// set te limit for the week with a true/false condition
If DayOfWeek(Date) >= Monday and DayOfWeek(Date) <= Friday then
condition2 = true
else
condition2 = false;
// set a long position at the open of the nex bar if the previous 2 conditions are true
if condition1 = true and condition2 = true then
buy next bar at open;
// close the long position opened previously at the session open
setexitonclose;
Now, my question is, what about the second or the third day of the month?
How can I specified a specific day of the month, taking in consideration that condition2 is true? How can I say that I want to buy at the 11th day of the month, in this case, the 11th trading day of the month and not the 11th calendar day of the month?
Best regards,
Fernando