
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
Hello OpenGates,
I suppose you know how to code but you are asking for the way of implementing the solution you are after; because as has been said, I doubt anyone will offer you a solution for free. Regarding you question, I am supposing that you have to figure out a way of counting; yep, you have to count (or to be precise, your EA) every now and then in order to be able to deactivate your expert. Hopefully, MQL has a very easy to use built in timer which is OnTimer(). OnTimer can work along with OnTick, so ou can have OnTick perform your market algorithm and put a counter (like count++) inside OnTimer (in case you are using OnTick of course - or else, you can put all your code inside OnTimer). Supposedely, OnTimer will be stable, so 100 increments of "count" on a 10 seconds OnTimer will result at about 1000 seconds. Since I will not ...count on it, I propose to implement a time check from time to time , in conjuction with OnTimer and make necessary adjustements.
best reagrds
I understood you completely. You have not posted any code since my previous post. You just rejected my post and asked for simple codes again. Since you haven't learned the mql4 language, we have nothing to communicate with.
WHRoeder,
Sorry if I also misunderstood you. I said the codes you posted was beyond my scope and understanding, I already posted a code at the beginning of my post, the codes do closed all positions but it fails to stop the expert from opening another positions until the specified time and day, this is exactly where I became helpless. I only want somebody to help add or correct my codes to be able to stop trading until the specified time I AM NOT LOOKING FOR NEW CODES. So sorry if I slighted you in anyway neither do I rejected your post, in fact I have to admit that I respect you in terms of unparalleled coding and intelligence. I HONESTLY DON'T KNOW HOW TO RECONCILE MY SIMPLE CODING WITH YOUR OWN TO MAKE IT WORK FOR ME. THAT IS ALL I AM SAYING. Below is the code again: Thank you
Give variables names that make them easy to identify. If you ask for help it makes it so much easier for potential helpers to follow your code. Not only that, you will forget if you come back to code after not working on it for a while.
You have used code that I posted earlier.
today_midnight and tomorrow_midnight are self explanatory
tdaymdngt is a jumble of letters
tmoro is obviously meant to refer to tomorrow, but it is an undeclared variable ( according to the code that we can see) but it calculates a time for today, not tomorrow
Ppt, Dtot,fmd, No idea what they are referring to
The idea behind the ea is to start trading by 9am and stop by 20 (8pm) but then there is added idea that if UseDailyTarget is set to true and the amount (in dollar) in the input parameter, when that amount (profit only) has been reached i.e if equity is greater than our balance by that amount (Ppt), irrespective of the time, it should close all the orders and stop trading for the rest of the day and to resume the normal time (9am) on the second day. But it was just opening more orders after closing the existing ones without stopping. Dtot is the addition of Target amount+Account balance
Thank you for your advices and helps so far. Have learnt a lot from all your tutorials. But please help me to review the codes in line with my explanations and what I want it to do.
Hello,
This is the new code I was able to write but still not yet working. Pls help take a look at it and let me know what to do next.
Thanks
You are calculating profits for all closed trades, not only those opened today
A simpler way would be
WHRoeder, GumRai and others,
Thanks for replying me in spite of my inadequacies. I am very grateful. I have written out a certain code culled out of those given to me here and still testing it, if by tomorrow it has not yet worked as I expected, I will post it here for a review from you people to help look and to see where I have missed it.
Thank you so much.
WHRoeder, GumRai and others,
Thanks for your assistance so far, I am yet to get over it, however, below is the codes I used as culled from the ones given above. It is closing the orders as supposed but after that, it continues to open another orders instead of stopping trading and resuming at the time specified. Please help analyze what I did wrong or if I missed it somewhere. Thanks in advance