LRA: That was quick. How will you search for bars? In a loop or using the time structure?
EUR USD
//+-------------------------------------------------------+//| Проверка дней недели PRVERKA.mq4|//| если первая пятница месяца была бычьей, а |//| 2-й понедельник медвежий - открываем сделку на продажу|//+-------------------------------------------------------+#property strictvoidOnStart()
{
int День=Day(), ДеньН=DayOfWeek();
Alert("----------------------");
int ДеньНачалаМесяца = (ДеньН-День+36) % 7;
// Если день начала месяца = 6, то число первой пятницы равно 7. Иначе 6 - день начала месяцаint ЧислоПервойПятницы = ДеньНачалаМесяца==6?7:6-ДеньНачалаМесяца;
// Если день начала месяца < 2, то число второго понедельника равно 9 - день начала месяца. Иначе 16 - день начала месяцаint ЧислоВторогоПонедл = (ДеньНачалаМесяца<2?9:16)-ДеньНачалаМесяца;
Alert("ЧислоПервойПятницы = ", ЧислоПервойПятницы, " ЧислоВторогоПонедл = ", ЧислоВторогоПонедл);
if(ЧислоВторогоПонедл>=День)
{
Alert("Надо подождать числа ", ЧислоВторогоПонедл+1);
return; // Отключил до числа, следующего за вторым понедельником
}
int Продавать=0;
for(int Бар=0;;Бар++) // Ищем на D1 номера баров для заданных чисел месяца
{
if(TimeDay(iTime(NULL,PERIOD_D1,Бар))==ЧислоВторогоПонедл)
{
if(iClose(NULL,PERIOD_D1,Бар)<iOpen(NULL,PERIOD_D1,Бар)) Продавать++;
break;
}
if(TimeDay(iTime(NULL,PERIOD_D1,Бар))==ЧислоПервойПятницы)
if(iClose(NULL,PERIOD_D1,Бар)>iOpen(NULL,PERIOD_D1,Бар)) Продавать++;
}
if(Продавать==2) bool x=OrderSend(_Symbol, OP_SELL, 0.1, Bid, 7, 0, 0);
}
int 1 = OrdersHistoryTotal(); if (OrderSelect(1,SELECT_BY_POS,MODE_HISTORY)) int tip=OrderType(); Af ternoon. I need help, I need to close sell order and then the next order can only be open buy, I want to use order history to find the last closed order and know its type, but I can not do it (who knows what I'm doing wrong, tell me) if I don't know the answer, which would help me to make the code work, please do not write!
Lowech: int 1 = OrdersHistoryTotal(); if (OrderSelect(1,SELECT_BY_POS,MODE_HISTORY)) int tip=OrderType(); Af ternoon. I need help, I need to close sell order and then the next order can only be open buy, I want to use order history to find the last closed order and know its type, but I can not do it (who knows what I'm doing wrong, tell me) if I don't know the answer, which would help me to make the code work, please do not write!
When we try to translate - displays an error message: '1' - name expected. The variable name is required instead of number 1
Good evening, below is the code, I wrote a ticks counter, my idea is that the ticks are counted on every bar in the loop, on every new bar the counter is reset, when I start the indicator it says in the comments that on the previous bar 1 tick and the current ticks starts counting from
If I try to use a different magic sprite, I don't know why I tried to use it but I don't know why I tried to use it. Maybe I wrote it wrong?
Good evening, below is the code, I wrote a ticks counter, my idea is that the ticks are counted on every bar in the loop, on every new bar the counter is reset, when I start the indicator it says in the comments that on the previous bar 1 tick and the current ticks starts counting from
If I try to use a different magic sprite, I don't know why I tried to use it but I don't know why I tried to use it. Maybe I wrote it wrong?
If I understand the problem and question correctly, the ticks are not saved on the history. Take a look at my indicator.
Good evening, below is the code, I wrote a ticks counter, my idea is that the ticks are counted on every bar in the loop, on every new bar the counter is reset, when I start the indicator it says in the comments that on the previous bar 1 tick and the current ticks starts counting from
If I try to use a different magic sprite, I don't know why I tried to use it but I don't know why I tried to use it. Maybe I wrote it wrong?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
write a script and after each statement display the information + GetLastError() with Alert() - see example script above
How can I do this if I have an error in my code? Alert() won't help me if the script won't work!
throw out everything but the first line of the script and add Alert. Then add it gradually - learn how to program and debug
That was quick. How will you search for bars? In a loop or using the time structure?
drop everything from the script except the first line and add Alert. Then add it gradually - you will learn how to program and debug
if (OrderSelect(1,SELECT_BY_POS,MODE_HISTORY))
int tip=OrderType();
Af ternoon. I need help, I need to close sell order and then the next order can only be open buy, I want to use order history to find the last closed order and know its type, but I can not do it (who knows what I'm doing wrong, tell me) if I don't know the answer, which would help me to make the code work, please do not write!
int 1 = OrdersHistoryTotal();
if (OrderSelect(1,SELECT_BY_POS,MODE_HISTORY))
int tip=OrderType();
Af ternoon. I need help, I need to close sell order and then the next order can only be open buy, I want to use order history to find the last closed order and know its type, but I can not do it (who knows what I'm doing wrong, tell me) if I don't know the answer, which would help me to make the code work, please do not write!
Good evening, below is the code, I wrote a ticks counter, my idea is that the ticks are counted on every bar in the loop, on every new bar the counter is reset, when I start the indicator it says in the comments that on the previous bar 1 tick and the current ticks starts counting from
If I try to use a different magic sprite, I don't know why I tried to use it but I don't know why I tried to use it. Maybe I wrote it wrong?
Good evening, below is the code, I wrote a ticks counter, my idea is that the ticks are counted on every bar in the loop, on every new bar the counter is reset, when I start the indicator it says in the comments that on the previous bar 1 tick and the current ticks starts counting from
If I try to use a different magic sprite, I don't know why I tried to use it but I don't know why I tried to use it. Maybe I wrote it wrong?
If I understand the problem and question correctly, the ticks are not saved on the history. Take a look at my indicator.
If I understood the problem and the question correctly, it doesn't save ticks on history. See my indicator.
The link doesn't work, it says no page
Good evening, below is the code, I wrote a ticks counter, my idea is that the ticks are counted on every bar in the loop, on every new bar the counter is reset, when I start the indicator it says in the comments that on the previous bar 1 tick and the current ticks starts counting from
If I try to use a different magic sprite, I don't know why I tried to use it but I don't know why I tried to use it. Maybe I wrote it wrong?
return rates_total-1 or 0