xmas holiday - no trade filter - custom code
-
Hi guys, does any of you with a bit of mql5 coding experience have an idea how to make a custom mql5 code block to disable trading if month = 12 and day = 20/21/22/23 etc
Would like to add filter that makes the EA not open new positions if its december 20th to january 6th every year..
The code should be for mt5.
Cheers!
-
@piptheripper You could do it like this, you would have to set the date/time in inputs and put flag in tree.

-
you could also save the hours of time and troubleshooting and just say to your phone, "hey Google / Siri, remind me to turn off my EA's for 2 weeks starting on this date."
-
@jstap Shouldn't right operands be of a 'text' type instead of numeric? You are using string variables for them.
-
@l-andorrà Yes it should be text, I believe.
-
@jstap That's what I guessed, thanks.
-
@l-andorrà Your welcome
-
@l-andorrà @PipTheRipper Not sure what I was thinking with the above picture, to get the current date into a variable it needs added to modify variables like this:

-
Thank you guys! Appreciate it. Will see if I can make it work. I would like to leave the year out, so on backtest over many years, no trades are taken within that time period. If I figure it out I will upload it here so others might benefit. Thanks again!
-
@jstap This makes more sense to me, but I didn't dare to say anything befoe because I never use flags.
Thank you for sharing. -
@l-andorrà I use modify variables unless I don't need to see the result in a comment.
-
Can someone help me with the (xmas holiday - no trade filter)?
How can i make it on Fxdreema?
Can someone post the Projekt that works?
It would be great. -
As these days are always set, you can use green filter blocks, to switch a flag on and off.
-
You can do it like this: https://fxdreema.com/shared/5m5IRV06c dates were used for testing, set whatever dates are relevent to you. Check the bool condition, above your buy and sell tree.
-
For Meta Trader 5 this doesen't work.

Whoud this work like this?

-
It does mate, mt5 is the same, but needs the full word
TimeToString(datetime value,// number int mode=TIME_DATE|TIME_MINUTES//output format);
put a shard link, ill check what's there, and tell you why something doesn't work
-
-
What are you trying to set under the TF block? flags once set work on all TF's. Spread and time filter need to go above everything.
-
My goal was to get rid of the error message that I get when backtesting when I have different TFs under different conditions. If spread and time filter are above all else, how do I get the open price mode when testing?
I'm not familiar with it at all.Could you arrange all the blocks the way you think is correct?
When testing in the backtester, I would like to have the option to not only select tick mode but also 1 minute OHLC and open price mode.
And all these error messages that keep coming up when testing in the journal that they're all gone? -
I would only set TF when I am happy everything else is working, and I think you want a check flag, if true activate blocks you want, if false activate different blocks.
