Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 270
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
It's enough to know what day of the week the first of the month was. The rest is calculated.
It's like scratching your right ear with your left hand.
I'm sorry, you probably weren't paying attention to the question.
How do you write the condition in the four: if the first Friday of the month was bullish and
the second Monday is bearish then we open a sell trade.
DayOfWeek()==1 Monday is clear, but what Monday of the month?)
Got it! You're talking about your algorithm, which only you know. I have written, determine the day of the week for the first day of the month! And then we use a table or two simple formulas to determine the dates of the days we are interested in.
Check the table on the calendar.
If the first day of the month is 6, then the number of the first Friday is 7. Otherwise, first Friday equals 6 - the day of the beginning of the month.
If day of the month start < 2, second Monday equals 9 - day of the month. Otherwise the second Monday number is 16 - the day of the month.
Using math functions, the remainder of division and the modulus will be much shorter
Got it! You are talking about your algorithm, which only you know. What I'm saying is, determine the day of the week for the first day of the month! And then we use a table or two simple formulas to determine the dates of the days of interest.
Check the table on the calendar.
If the first day of the month is 6, then the number of the first Friday is 7. Otherwise, first Friday equals 6 - the day of the beginning of the month.
If day of the month start < 2, second Monday equals 9 - day of the month. Otherwise the second Monday equals 16 - the day of the month
Thank you. God bless you. I'll keep checking.
Thank you very much for your wish. And still put a space after the dot and a space before the dot. It will help in programming. Good luck and, if you need it, profits!
Thank you very much for your suggestions. And you may want to put a space after a full stop and skip a space before a full stop. It will help in programming. Good luck and, if you need it, good luck!
It comes out very complicated. There must be a simpler option. Can anyone share?
Let's say tomorrow something will change in the updates and we will have to rewrite everything.
It comes out very complicated. There must be a simpler option. Can anyone share?
Let's say tomorrow something changes in the updates and we have to rewrite everything.
It is not so difficult. But for each situation we have to set different values, how many daily bars should be copied and which ones should be imported into the structures.
It's better to take the candlestick parameters into the MqlRates structure
But for each situation you have to set different values, how many daily bars to copy and which ones to put in the structures.
This is what I am talking about and I am only interested in MQL4.
That's what I'm talking about and I'm only interested in MQL4 ...We need to find another solution .
int res;
int nomber = OrdersHistoryTotal();
int tip=OrderType();
if(OrderSelect(nomber,SELECT_BY_POS,MODE_HISTORY))
{
tip=OrderType();
}
ma=iMA(NULL,0,MovingPeriod,120,MODE_SMA,PRICE_CLOSE,1);
if(Bid<ma)
if(tip!=OP_SELL)
{
res=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,3,0,Bid-TP*Point,"",MAGICMA,0,Red);
return;
}
That's what I'm talking about and I'm only interested in MQL4.
I also have this idea.
If you need the first Friday, the number should be less than 8. If the first Friday of the month is Friday, the next Friday will be the eighth. Accordingly we can easily recalculate to any day of the week and any day, second, third...