The Day-Off Safety Detector

 

Thanks to the help from many people who have viewed the ask thread, i have created a Succesfull Safety feature for when interbankfx stops working, (which i learned about on July 4'rth)

I made it to be the next best thing to finding a new broker.

Here are the codes for the setup guide, a simple ea i made looong ago, and the ea with the newly developed code!

Another round of thanks to all who have helped!

P.S. If anyone has suggestions to further help this project, i'm all ears, all the time.

 

I dont quite follow what the EA does. Would you mind a little more explanation? tia.

 
forexplayer:
I dont quite follow what the EA does. Would you mind a little more explanation? tia.

of course.

the day off safety detector is run mainly by 2 variables, DayOff, and DayOff Close, it's not an entire ea, it's more like guidlines to add to your own ea

DayOff

the variable tests that take up most of the space say, if the date is anywhere from two days before the holiday, to the holiday itself, DayOff is true, when day off is true, two things can happen for each kind of trade, long or short.

if the trade is profitable, it takes the trades profit and shuts down during the holiday.

Theese next two local variables come in to play if your current trade isn't profitable.

the CurrentClose, which is the close of the last peroid

and the TrendClose, which is the close of three periods ago

if the CurrentClose-the TrendClose is greater than 0, we are in an uptrend.

if we are in a loosing-long position in an uptrend, 2 days before the holiday, it allows a trailing stop, to possibly come out less negative, or even positive!

if we are in a down trend in a loosing-long position, however, it closes the order so the loss isn't worse before the holiday begins.

and vice versa is true for short positions.

DayOffClose

below the variables that test if DayOff is true are not are Variables that work based on if it's 21 hours into the day before the holiday. (9:00 P.M.)

it's a last resort for the non-profitable trades, if they haven't reached a point of profit by 9:00, they are closed! so they don't put your account at risk during the holidays.

Good Friday

one of the holidays taken off is good friday, which i learned (thanks to wikepedia) is the friday before easter, which is the first monday after april first, after the full moon.

i couldn't find any way to automate good friday more than i was patient to put in one variable for every year, which i wasn't patient for exactly, if you want, you could personally automate good friday by taking the original formula and adding Year() =

however, i used external integers, to input the month, (either 4, april, or 5, may) and day. you will have to edit this every year though

in the program where it tests good friday, i have

if (Month() == GoodFridaysMonth && (Day() = GoodFridaysDay - 2))

"- 2" means two days before, so you need to put the exact date good friday is, or messes everything up unless re-written.

and that's the way the ea crumbles!

 

just out of curiousity, does anyone still have anything to add to this project, any questions,

many may have noticed that interbank fx turned off again on labor day. the turn-off is what i made this addition for. since almost every strategy i've ever heard of has losses, and operate reducing thoose losses with a stop loss or a trailing, what i noticed as a BIG downfall to my own strategies, was that they didn't exit the orders during the holiday.

does anyone have better feedback to this project? if you've looked at my results you'll notice i don't have very good modeling quality, which doesn't make sense to me after all the importing of history i've done.

 

if you think you have learned all you can learn from this project move on to learn another aspect of trading. For now just accept that the strategy tester has serious limitations as an actual testing tool. It's irregularities render it quite unstable.

 

I don't have any suggestions to make, but if it works as promised then it sounds like a good thing to me!!

Okay, maybe one though...a piece of code to turn off EAs during announcements...it may have already been done

alright, one more suggestion...is there a way to make this code into a library or dll or something so that I can just include it in my path and then call a function or set of functions? Much of the code I see posted here, like this, would be more useful this way...helps keep the strategy code cleaner. I'm kind of new to MQL, so I've never done that myself, but I'm fairly sure it can be done.

 

to answer your first question, i have a question of my own, what do you mean by "announcements" could you please describe in greater detail?

as for your second questions, now as to putting a set of codes into a library is something i've never heard of, but i can imagine making an indicator out of it, i'll just need a little feedback on how to input a custom indicator into an ea, i've seen it all over the place on this forem if i can remember where. Thanks for the idea, i'll be looking for an answer to that question.

 

By announcements I mean economic announcements like NFP, interest-rate decisions, release of GDP figures, etc...

By library I don't mean an indicator. What I mean is something like a set of functions that we reference, probably through a "#include" line in our code. Now we would have access to those functions in our own code. I will do a little more research to see how this is done in MQL. Maybe one of our resident gurus can help out as I'm sure they know what I'm talking about.

The code is a good thing to have "as is" btw.

 

i've never heard of such announcements, do they take place on the web, if so, where's the link

 

EagleHawk,

Most brokers provide you with some sort of economic calendar as to when these announcements are being made. InterbankFx posts them here

http://www.interbankfx.com/economic_calendar.php

for example. Some of these announcements are more market moving than others.

BW

 
bwilhite:
EagleHawk,

Most brokers provide you with some sort of economic calendar as to when these announcements are being made. InterbankFx posts them here

http://www.interbankfx.com/economic_calendar.php

for example. Some of these announcements are more market moving than others.

BW

bwilhite,

from what i see here, all this is, is what everyone i know calls "fundamental analysis", such studying, i understand, is crucial in stocks, but most of the information from the world news is rarely not covered in "technical analysis" which involves cci, stolcastics, candelstick patterns, rsi, etc. if you have a good strategy, it should cover a good percentage of the information you can get from theese bits of information. the only real big world news that has dramatically affected the market is war, as far as i know. in which case it may be best to trade a pair where neither country is affected by the war wherever it is.

if you still want to automate theese fundamentals, i'm sorry to say i have no knowledge of how to do so. the only way i can imagine would be to trade "discresionarily" meaning manually. which takes great insight on how the market moves, and not working from an emotional standpoint, both of which requirments are difficult for many.

sorry i can't be of assistance on the matter.

Reason: