Trading Time Filter Programming Tutorial for MetaTrader 5 | mql5 Coding Lesson

  Рет қаралды 17,573

René Balke - Fx Bot Trading

René Balke - Fx Bot Trading

Күн бұрын

Пікірлер: 70
@ReneBalke
@ReneBalke 2 жыл бұрын
Source Code: input int TimeStartHour = 7; input int TimeStartMin = 10; input int TimeEndHour = 15; input int TimeEndMin = 10; void OnTick(){ MqlDateTime structTime; TimeCurrent(structTime); structTime.sec = 0; structTime.hour = TimeStartHour; structTime.min = TimeStartMin; datetime timeStart = StructToTime(structTime); structTime.hour = TimeEndHour; structTime.min = TimeEndMin; datetime timeEnd = StructToTime(structTime); bool isTime = TimeCurrent() >= timeStart && TimeCurrent() < timeEnd; Comment(" Server Time: ",TimeCurrent(), " Time Start Dt: ",timeStart, " Time End Dt: ",timeEnd, " Time Filter: ",isTime); }
@ramni89ramni
@ramni89ramni 2 жыл бұрын
Hi please i need your help the robor not work when my pc is offline what can I do...? Or is must be always online ..? Thank you brother
@ReneBalke
@ReneBalke 2 жыл бұрын
@@ramni89ramni Yes. The PC (and the MetaTrader) has to run all the time. A lot of trader use a VPS. Check out my last video where I show how to setup a VPS.
@kajinguludan5886
@kajinguludan5886 2 жыл бұрын
Hi, I wanted to ask, how do i extract the importance using mqlcalendarevent and use it in another if statement? kindly help? i want to filter the importance
@tradelicious8819
@tradelicious8819 2 жыл бұрын
Hey Rene, i'm trying to add time filter to my existing EMA strategy. It gives me "OnTick" -function already defined and has body. When i deletes or moves it it gives so many other errors. Please help
@erickkillian5590
@erickkillian5590 2 жыл бұрын
Thank you very much for this! However, when I add this code to my existing EA, I get an "OnTick" function already exists. How/Where do I add this time filter source so that it will take the entries based on my EA? Thank you.
@YoussufOthman
@YoussufOthman 9 ай бұрын
My Freind Let Me Buy you a coffee for the valuable information, believe me i had zero understanding about EAs before 15 days and now i developed 45% producing per day EA. i know my previous programming knowledge helped but indeed you taught me everything about EAs that i need just watching KZbin Videos in your channel. so know i have an EA that working but indeed you owns it. thank you so much
@fulkrumfx
@fulkrumfx 2 жыл бұрын
Thank you for taking my suggestion!
@philtradinglune5297
@philtradinglune5297 Жыл бұрын
will be thankful for having tutorial about setting news filter to disable the ea for certain news or times before and after
@haydenlyon6056
@haydenlyon6056 2 жыл бұрын
I swear your making videos just after i finish struggling through them! I suppose next youll be writing a news filter! Lol. Love the work! Any new coder that finds your videos probably doesnt know the value of what your sharing!
@shadowwarsshadypeople6299
@shadowwarsshadypeople6299 2 ай бұрын
Thank you, you just helped me tremendously. I had to swtich from Ctrader to MT5 due to the new Ctrader update, and been working on fitting the code to MT5, but time restriction I was using was not working. Thanks again :)
@markonis100
@markonis100 2 жыл бұрын
This content is really helpful. I already implement a time filter in my EA but your method is different. I love how your content is expand the viewer's knowledge.
@erickkillian5590
@erickkillian5590 2 жыл бұрын
Can you share your script for the time filter in your EA, please? I am using this one, and I can't seem to place it in the right location? Maybe just share where in the script you are placing your time filter at? Thank you.
@bitestonk0618
@bitestonk0618 Жыл бұрын
bedanya kalau penyaring waktu dipakai dalam OnTick() dan OnTimer apa ?
@markonis100
@markonis100 Жыл бұрын
@@bitestonk0618 Saya gak pernah pakai OnTimer, Om. Kebetulan saya belajar coding EA baru 6 bulan-an dan belum pernah pakai OnTimer. Kalau di OnTick, time filternya dicek setiap tick baru (setiap ada pergerakan harga sekecil apapun).
@bitestonk0618
@bitestonk0618 Жыл бұрын
@@markonis100 boleh share pakainya dimana?
@philippedecamp7558
@philippedecamp7558 Жыл бұрын
Great !! Thank You René ! So simple when we follow you.
@steveg4051
@steveg4051 2 жыл бұрын
Excellent as all of your tutorials are. I think with this look at accessing time i might be able to get a news filter going. Am looking forward to getting some profit banked to then invest time and money on your course.
@amirhosseinghavi30
@amirhosseinghavi30 5 ай бұрын
Excellent tutorial. learned a lot.🙏🙏
@jovidwaakzaam1865
@jovidwaakzaam1865 2 жыл бұрын
very nice,in my oppinion a daytime filter is handy if you wanna avoid like the nfp or maybe certain high impact news on certain days
@Kariboo925
@Kariboo925 Жыл бұрын
Hi Rene for my part, I prefer to use datetime type input. It is easier for backtest optimizations. You have starttime & stoptime on the same 3D graph Great work anyway.
@kisuulegodwin
@kisuulegodwin Жыл бұрын
Hello Rene I have learnt alot in your teaching, loved it so much . Though am kindly requesting you to do a video on neural network tradebot in mql5
@MrHumbleOne
@MrHumbleOne Жыл бұрын
A great video as usual, I wonder if I should put this in a custom function and store the results as a defined variable rather than have all the code in my on tick function, I have lots of calculations that’s are called and wonder if I should build outside of the OnTick function
@rideyourlife1418
@rideyourlife1418 2 жыл бұрын
Thank you! Your tutorial is really helpful!
@farbeyondtrading
@farbeyondtrading Жыл бұрын
p.s. I love your videos!! Thanks for teaching us, and letting us enjoy your accent :)
@ReneBalke
@ReneBalke Жыл бұрын
:D
@lukageldenhuys
@lukageldenhuys Жыл бұрын
Thanks, René! How would you go about if the start time is "later" than the end time? E.g., start at 02:00 and end at 18:00 the next day. TIA.
@fearwin
@fearwin 6 ай бұрын
Hi , is it this filter and variable set up must be put inside OnTick? which machine would do everytime a tick come and waste lot of CPU resources. Can it be put on say OnInit()? so the machine only declare the variable once and the filter then put in OnTick?
@andrasgosztola9615
@andrasgosztola9615 2 жыл бұрын
Nice tutorial !! Maybe in the can you make a "partial close at a custom distance" tutorial. A tried to create one, but something not working very well Thanks
@erickkillian5590
@erickkillian5590 2 жыл бұрын
He has a "partial close" video.. Here is the link, I hope that it helps kzbin.info/www/bejne/fWHUmWeHrr2Yj5Y
@andrasgosztola9615
@andrasgosztola9615 2 жыл бұрын
@@erickkillian5590 Thank you
@leonardoampuero723
@leonardoampuero723 5 ай бұрын
I am a bit confused with timezone. I want to set trading hours to NY sessions. but it seems that metatrader is using GMT+3, any idea how to set this to make the strategy tester work accordingly?
@andymukotekwa9656
@andymukotekwa9656 9 ай бұрын
Hey rene I've been trying to create a time based execution EA which executes trades based on the input of time of my choice up to the second, has inbuilt SL AND TP and allows me to select whether i want to enter a buy trade or a sell, the code I have has no errors but is not executing trades., can yu help
@Jaypipin
@Jaypipin Жыл бұрын
Hello Rene, nice material! So i have an issue with EA in that one broker starts day 0.00 gmt then another -2.00 gmt so could be sunday 22.00 Now broker B which starts Sunday creates issues. Such as indicator will use sunday data could be 2 hrs for monday support /res lines. This is a mistake. It should use friday data. So if your video about this issue? Also for backtesting, say i want my 4hr indicator using SR lines, to start 22.00 server time not their 0.00 so -2 hrs.
@nesmill99
@nesmill99 2 жыл бұрын
Hey Rene, Love your content you are very clear and straight forward and funny as well xd Could you show please how to create a countdown of the time left for the current candle to close, I have been trying to get that working for a few days and nothing.
@ReneBalke
@ReneBalke 2 жыл бұрын
Thank you :) I think you will find a lot of solutions for this if you google it. this is a really common program for mt5 :)
@Joerg63
@Joerg63 2 жыл бұрын
Hi Rene, thanks for your great explanation and besides you are doing a fantastic job. Now to my question. I`ve tried to implement the Time Filter to the Supertrend Expert you also wrote and explaned. I placed the Time filter right under the "void onTick(){" and it shows the right time statement like true or false when I start the strategy tester, but the advisor didn`t recognize the choosed time filter in the program, means he will open and close the position when a signal appears no matter what time it is. I suppose there is an additional loop in the main Program? please advise and thanks ...dickes Danke aus Bielefeld
@glauberpcp1
@glauberpcp1 3 ай бұрын
how can i set this at the dark point ea?
@TheJoshuamcgowan
@TheJoshuamcgowan Жыл бұрын
You’re awesome ❤
@nabilnakiri-w6d
@nabilnakiri-w6d 9 ай бұрын
hello how I set time Gmt-4
@Fggghijub
@Fggghijub 11 ай бұрын
Excellent🙏
@mwa5330
@mwa5330 Жыл бұрын
Can we add multiple set of trading time?
@christianalegria6132
@christianalegria6132 Жыл бұрын
hello what code do you use to hightlight this filtered time. thank you
@nilsmueller81
@nilsmueller81 2 жыл бұрын
Hi Rene. That was really helpfull for me. Can only use hours and minutes? Or can i take the hole date + Time?
@ReneBalke
@ReneBalke 2 жыл бұрын
Hey, you could also use a specific point in time. The easiest way would be using a datetime input straight away I think.
@mwa5330
@mwa5330 Жыл бұрын
Time filter not work, I pasted this my heiken ashi but not working
@supermarketfx
@supermarketfx 10 ай бұрын
Is there a way to change this to prevent any trades open during news events? I want to be able to prevent any EA on MT5 from trading during an upcoming news event.
@ReneBalke
@ReneBalke 10 ай бұрын
Yes you could use the mt5 calendar api for example
@acky88888888
@acky88888888 2 жыл бұрын
Can we have the input like "input datetime TimeStart = 15:00;" but without the date?
@ReneBalke
@ReneBalke 2 жыл бұрын
No in this case you have to use a string input.
@relaxingmood3210
@relaxingmood3210 2 жыл бұрын
Can you create EA that trade only divergence on anytime frame like 30 mins, 1hrs...
@pbayat6667
@pbayat6667 Жыл бұрын
Thanks 🙏
@JasonHothamMBA
@JasonHothamMBA 2 жыл бұрын
This is great thanks! I know I should probably look around but the time shown doesn't show my machine time (actually time). I'm in the UK and the time shown in MT5 is 1 hour behind, and the server time is 2 hours ahead. What code could I add to show my machine time please?
@ReneBalke
@ReneBalke 2 жыл бұрын
You can use TimeLocal()
@JasonHothamMBA
@JasonHothamMBA 2 жыл бұрын
@@ReneBalke great thanks!
@juniorivvypr7932
@juniorivvypr7932 2 жыл бұрын
rene please where should i put this code.. it seems if i put on "OnTick" function it doesnt filter when i run the tester
@ReneBalke
@ReneBalke 2 жыл бұрын
Hey, yes. You can check the time filter before you open a position.
@yagneshacharya2461
@yagneshacharya2461 2 жыл бұрын
i want that my pending order will expire after 1 minute , pleasse help me out
@rickscreations3159
@rickscreations3159 Жыл бұрын
There is an error in your code : if the user sets StartTimeHour = 21 StartTimeMin = 0 EndTimeHour = 9 EndTimemin = 0. because the user wants to trade after NYC is finished and trade the AUD and ASIA Market time. your Time filter will not run. it will think that it is going from. 21pm -9am. ON the same day. your Code has no consideration for Midnight. you should update this.
@kroedis
@kroedis Жыл бұрын
How would you fix that
@cwleo1
@cwleo1 Жыл бұрын
Great tutorial. But I guess this algorithm doesn't cater for trading period that span across midnight of the broker's timezone. e.g. TimeStartHour = 21 (9pm today) and TimeEndHour = 4 (4am tomorrow). For such scenarios, this equation will never return true. bool isTime = TimeCurrent() >= timeStart && TimeCurrent() < timeEnd;
@kroedis
@kroedis Жыл бұрын
How do we fix that
@alexanderwening8959
@alexanderwening8959 2 жыл бұрын
thx :-*
@growmybusinessonline5711
@growmybusinessonline5711 11 ай бұрын
Hi Rene excellent thank you very useful video ! May I please ask - building on this time filter how can you draw a colored box around that filtered time period. All prior day boxes remain and do not get deleted so you can see that time filter each day eg DAX 8am to 10am box or rectangle
@ReneBalke
@ReneBalke 11 ай бұрын
You can learn it in my course: en.bmtrading.de/mt5-masterclass/
Create a Button in MT5 to Close All Open Positions | Easy mql5 EA Programming Tutorial
43:08
MQL5 for Beginners - Learn MetaTrader 5 Programming in 2.5 Hours
2:29:43
René Balke - Fx Bot Trading
Рет қаралды 21 М.
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
Coding a Profitable Stochastic Moving Average EA for MT5 (mql5 Tutorial)
37:36
René Balke - Fx Bot Trading
Рет қаралды 25 М.
Easy Tripple Moving Average Trading Strategy | Simple mql5 Expert Advisor Coding Lesson
54:46
Master MQL5 Programming (Complete All In One Guide)
2:38:10
René Balke - Fx Bot Trading
Рет қаралды 104 М.
Metatrader 5 optimization tutorial
17:38
trustfultrading
Рет қаралды 16 М.
Code complete EA for MetaTrader 5 in 20 Minutes!
20:54
trustfultrading
Рет қаралды 40 М.
Complete MetaTrader 5 Tutorial [For Beginners] - 2024 Edition
27:49
Disciplined Trader
Рет қаралды 1,3 МЛН
Amazing RSI trading bot in mql5! | MT5 programming
22:50
trustfultrading
Рет қаралды 96 М.
Ultimate SMART MONEY CONCEPT Indicator Programming - Find Highs and Lows
25:46
René Balke - Fx Bot Trading
Рет қаралды 11 М.
Calculate Lotsize (Percent of Account) In MT5 Programming | Easy Function Explained
28:37
René Balke - Fx Bot Trading
Рет қаралды 17 М.