You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Yep, it's fundamentals, but nope we don't need to do any analysis.
I just thought it might be useful to incorporate a piece of code, like yours, that shuts off or changes the implementation of EAs based upon when these events occur. I know that there is some code floating around out there that helps to mark the occurrence of economic realeses and I thought it might be good to have the two programs incorporated.
I'm not saying that we incorporate the results of the releases, but only that we incorporate the fact that there IS a release. If you'll watch EUR/USD, for example, on the day of an interest rate decision, then you'll be likely to see a jump in EUR/USD of 100+ pips. Some strategies might need to be altered or shut off at these times.
Does that make sense?
ok, the poll is now copmlete
thanks for the 6 people who answered the question i had asked.
for thoose of you who didn't understand what i meant by "an addition to you'r own ea" hopefully, you won't have to worry about it anymore. i meant it to be like an include file, although i never learned what that was untill bwilhite brought up reason to investigate (I would post the "Include" file on this post, but i can't figure out for it to let me). THANKS BWILHITE. Now the question i have is how to get it to compile correctly, and learn how to use it, personally.
for thoose of you who didn't understand the include's puropse, this is an include designed for thoose who's broker is interbankfx. interbank takes "holidays off", where the market will be running, and a stop loss may be triggered, but there's no one there to take the stop loss. so if you're in a trade, it will not exit untill the next day. I created this include to safely close all trades before the holiday, so such losses weren't a big issue.
however there are a few drags. different strategies take longer than others to close. i figured the average strategies that me and most of my friends have made take about 2-3 days to close, i built the settings so that it has three days to close. If you are loosing as of three days before the holiday, it initiates a trailing stop. At 9:00 P.M., on the night before the holiday, it closes ALL TRADES, no matter if their winning or loosing. If the are winning, three days in advance, they are closed.
finally, don't forget to add,
to all your open logics, this makes it so it doesn't open a trade just before the holiday.
ANY INPUT ON HOW TO GET THAT INCLUDE TO WORK WILL BE GREATLY APPRECIATED!
here's the include file, since this forem won't let me post the file type, mqh
//| Day Off.mq4.mq4 |
//| Eaglehawk |
//| https://www.forex-tsd.com/suggestions-trading-systems/3191-day-off-safety-detector.html |
//+------------------------------------------------------------------------------------------+
#property copyright "Eaglehawk"
#property link "https://www.forex-tsd.com/suggestions-trading-systems/3191-day-off-safety-detector.html"
//Global Variables
//I used variables to manually put in when Good Friday occurs, (I dont think it's possible to automate cycles of the moon, if you think so, go for it. I am, after all, a newcomer to coding )
extern int GoodFridaysMonth = 4; //Used to see what month Good Friday is in. (either 4 or 5)
extern int GoodFridaysDay = 12; //says the day of the month good friday is on.
bool DayOff = False; // the days interbankfx takes off
bool DayOffClose = False; //operates the last minute close if none of the minimization techniques are met by the deadline
//local variables (both used to determine what trend we are in)
double CurrentClose = iClose(NULL, 0, 1); //looks at the close of the most recent period
double TrendClose = iClose(NULL, 0, 3); //looks at the close of three periods
/*Counts the DayOff Function as true about two days before the time interbankfx is not running, (you can edit this to how fast you think your individual strategy will take to close)
In case this code is tampered with, the dates interbankfx takes off are here
New Years Day January 1
Martin Luther King Jr. Day January 20
Washington's Birthday February 17
Good Friday Friday before Easter
Memorial Day May 26
Independence Day July 4
Labor Day September 1
Thanksgiving Day Fourth Thurday of November
Christmas December 25*/
//DayOff variable tests
if ( Month() == 12 && Day() >= 30 || Month() == 1 && Day() <= 1 ) //New Years Day
{
DayOff = True;
}
if (Month() == 1 && (Day() >= 18 && Day() <= 20)) //Martin Luther King Jr. Day
{
DayOff = True;
}
if (Month() == 2 && (Day() >= 15 && Day() <= 17)) //Washington's Birthday
{
DayOff = True;
}
if (Month() == GoodFridaysMonth && (Day() = GoodFridaysDay - 2)) //Good Friday
{
DayOff = True;
}
if (Month() == 5 && (Day() >= 24 && Day() <= 26)) //Memorial Day
{
DayOff = True;
}
if (Month() == 7 && (Day() >= 2 && Day() <= 4)) //Independece Day
{
DayOff = True;
}
if ( Month() == 8 && Day() >= 30 || Month() == 9 && Day()== 1 ) //Labor Day
{
DayOff = True;
}
if (Month() == 11 && (DayOfWeek() >= 3 && DayOfWeek() =21) //Thanksgiving Day
{
DayOff = True;
}
if (Month() == 12 && (Day() >= 23 && Day() <= 25)) //Christmas Day
{
DayOff = True;
}
//DayOffClose variable tests, currently set to 9:00 P.M.
if (Month() == 12 && Day() == 31 && Hour() == 21) //New Years Day
{
DayOffClose = True;
}
if (Month() == 1 && (Day() == 19 && Hour() <= 21)) //Martin Luther King Jr. Day
{
DayOffClose = True;
}
if (Month() == 2 && Day() == 16 && Hour() == 21) //Washington's Birthday
{
DayOffClose = True;
}
if ( Month() == GoodFridaysMonth && Day() == GoodFridaysDay - 1 && Hour() == 21) //Good Friday
{
DayOffClose = True;
}
if (Month() == 5 && Day() == 25 && Hour() == 21) //Memorial Day
{
DayOffClose = True;
}
if (Month() == 7 && Day() == 3 && Hour() == 21) //Independece Day
{
DayOffClose = True;
}
if (Month() == 8 && Day()== 31 && Hour() == 21) //Labor Day
{
DayOffClose = True;
}
if (Month() == 11 && Day() >=21 && DayOfWeek() <=6) //Thanksgiving Day
{
DayOffClose = True;
}
if (Month() == 12 && Day() == 24 && Hour() == 21) //Christmas Day
{
DayOffClose = True;
}
//these next two functions will minimize loss on long, non-profitable trades before the close of interbankfx
if (DayOff == True && Ask-OrderOpenPrice() 0)
{
TrailingStopMode = True;
}
if (DayOff == True && Ask-OrderOpenPrice() < 0 && CurrentClose - TrendClose < 0)
{
Order = SIGNAL_CLOSEBUY;
}
//these next two functions will minimize loss on short, non-profitable trades before the close of interbankfx
if (DayOff == True && OrderOpenPrice()-Bid <0 && CurrentClose - TrendClose < 0)
{
TrailingStopMode = True;
}
if (DayOff == True && OrderOpenPrice()-Bid 0)
{
Order = SIGNAL_CLOSESELL;
}
//this next function will end all trades if not closed by 9:00 P.M. the day before the close of interbankfx
if (DayOffClose == True)
{
Order = SIGNAL_CLOSESELL;
}
if (DayOffClose == True)
{
Order = SIGNAL_CLOSEBUY;
}
//post this at the end of all your open Logics
if (/*your open logics*/ && DayOff == False) //order open
//post this as one of your exit short logics, closes trades when they are profitable
if (DayOff == True && OrderOpenPrice()-Bid >0)
{
Order = SIGNAL_CLOSESELL;
}
//post this as one of your exit long logics, also closes profitable trades.
if (DayOff == True && Ask-OrderOpenPrice() >0)
{
Order = SIGNAL_CLOSEBUY;
}
//+------------------------------------------------------------------+
EagleHawk,
Thank you for your work. Do you know how to use the include? I'm guessing that I put it into my experts->include path and then compile. Then I put a line in my EA that says "#include Day_Off" I'll give this a try when I can get to it. Thank you again.
BW
p.s.You're welcome!
unfortunately, such knowledge is fairly new to me, i've decided to start looking in codersguru's lessons to see if there's anything there.
as far as i know, you got the file path, and the include function set correctly, but that is all the knowledge i have been able to fish out so far.
again, thanks for the idea, as soon as i can get it to work, i bet it'll be perfect for use.
The Results of Before and after
here are the results run through the tester!
Yep, it's fundamentals, but nope we don't need to do any analysis.
I just thought it might be useful to incorporate a piece of code, like yours, that shuts off or changes the implementation of EAs based upon when these events occur. I know that there is some code floating around out there that helps to mark the occurrence of economic realeses and I thought it might be good to have the two programs incorporated.
I'm not saying that we incorporate the results of the releases, but only that we incorporate the fact that there IS a release. If you'll watch EUR/USD, for example, on the day of an interest rate decision, then you'll be likely to see a jump in EUR/USD of 100+ pips. Some strategies might need to be altered or shut off at these times.
Does that make sense?it makes sense to me, yes.
but on the movement of a hundred pips or more, such a movement i've always seen foretold by candlestick patterns, or macd. rarely have i seen an out of the blue movement as you are describing.
that was the point i was trying to come across with.
if you wish, i have an ea here i've been working on based on candlestick formations, i'm not yet finished, and it does the day of saftey detector incorperated into it, but candlestick patterns are excellent foreseers of major market movements.
if you want i can give you what i have to help be ware of theese movements you describe, but that is all i can do.
.