Help with MT4 EA for hours.
Sorry, I have no idea what you are asking.
But this needs some work
OrderSend(Symbol(),OP_BUY,Volumen,Ask,5,Ask-Stop_loss,Ask+Take_profit);
If Ask is 1.30000
you are setting your stop at 1.30000 minus 50, so your stop will be -48.7 and your TP will be 51.30000
That's not important, I work with indexes. Sorry I did not explain myself better in English.
My EA compares the price at 7:01 with the 8:01, then buy or sell. Then close the position at 9:01. But I want to close the position at 9:01 tomorrow or after tomorrow, not today, and I do not know how. Any suggestions?
My EA compares the price at 7:01 with the 8:01, then buy or sell. Then close the position at 9:01. But I want to close the position at 9:01 tomorrow or after tomorrow, not today, and I do not know how. Any suggestions?
junji: But I want to close the position at 9:01 tomorrow or after tomorrow, not today,
Then make sure the position has been opened for at least 24 hours#define HR2400 86400 // 24 * 3600 int TimeOfDay(datetime when){ return( when % HR2400 ); } datetime DateOfDay(datetime when){ return( when - TimeOfDay(when) ); } //datetime Today(){ return(DateOfDay( TimeCurrent() )); } //datetime Tomorrow(){ return(Today() + HR2400); } //datetime Yesterday(){ return( iTime(NULL, PERIOD_D1, 1) ); } /////// for(...) if(OrderSelect(...) && ...){ // See https://forum.mql4.com/56292#806175 datetime now = TimeCurrent(), then = OrderOpenTime(); if(now - then > HR2400) ...
I need time to study it and try it. Thank you very much.
I have already finished my EA, but I have a problem. When it comes time to open, it opens up many operations. How I can fix it?
This is my first EA, it compares the price to one hour with respect to past and it sell to future hour. I know it's not perfect, but understand that I am not a programmer. My problem is that I need to sell the position at the time indicated on another day, not today, tomorrow or after tomorrow ie. So did the comparison, yesterday or the day before.
I hope I explained well and thanks for the help.
Best regards.