Yeah, I can see that. And I see the answer to the question in the post belowhttps://www.mql5.com/ru/forum/160587/page115#comment_6521492. In other words, the problem is that the functionality is not divided into logical subtasks. You have lumped together: parsing orders, deciding on a trade action and executing a trade.
Such a task can be solved exactly in three stages:
Gathering information about orders to be monitored by the program. This is just the loop of order evaluation, which you already have. The result of this cycle must be the array of orders.
Calculation of trading signals. The calculation result is a command to open and/or close orders. It depends on the trading strategy. Previously, when there was no enumeration, I used codes: 0 - no signal, 1 - open Buy, -1 - open Sell, 2 - close Buy, -2 - close Sell.
Execution of one trade operation. If there is a trade signal and one of the orders (point 1) is suitable for it, one trade operation is performed. After that, the entire algorithm is restarted starting from point 1. In some cases, we even exit OnTick in order to continue with the next tick.
Well, thank you. At least it's clear what to do. I'll try to figure out "how" to do it myself. Although I'm not familiar with arrays yet. Thanks again anyway.
Mickey Moose:Wrote it to a file, everything is fine, but now how do I spar the data e.g. "eurusd" "1.2242" temporary data etc?
string s=FileReadString(F1); // Read the next line of the text file StringSplit(s, "," , a); // Split comma-separated elements into array datetime T1=StrToTime(a[4]); // Further, transformation proceeds ... int ord=StrToInteger(a[8]); double Price=StrToDouble(a[12]);
Well, thank you. At least it's clearer what to do. I'll try to figure out the "how" myself. I'm not familiar with arrays yet, though. Anyway, thanks again.
Write at least one block and show me. They'll tell you further in this case.
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.
Yeah, I can see that. And I see the answer to the question in the post belowhttps://www.mql5.com/ru/forum/160587/page115#comment_6521492. In other words, the problem is that the functionality is not divided into logical subtasks. You have lumped together: parsing orders, deciding on a trade action and executing a trade.
Such a task can be solved exactly in three stages:
Well, thank you. At least it's clear what to do. I'll try to figure out "how" to do it myself. Although I'm not familiar with arrays yet. Thanks again anyway.
Tell me how to get out of this !!!
for(int i=OrdersTotal()-1; i>=0; i--)
{
OrderSelect(i,SELECT_BY_POS);
if(OrderMagicNumber()==Magic && OrderType()==OP_SELL)
break;
The warning is: the return value of 'OrderSelect' must be checked
Howelse shouldthis'OrderSelect'valuebe checked?
if I do this: j=OrderSelect(); Is this correct?
Tell me how to get out of this !!!
for(int i=OrdersTotal()-1; i>=0; i--)
{
OrderSelect(i,SELECT_BY_POS);
if(OrderMagicNumber()==Magic && OrderType()==OP_SELL)
break;
The warning is: the return value of 'OrderSelect' must be checked
Howelse shouldthis'OrderSelect'valuebe checked?
if I do this: j=OrderSelect(); Is this correct?
It didn't work!(
string s=FileReadString(F1); // Read the next line of the text file
StringSplit(s, "," , a); // Split comma-separated elements into array
datetime T1=StrToTime(a[4]); // Further, transformation proceeds ...
int ord=StrToInteger(a[8]);
double Price=StrToDouble(a[12]);
Well, thank you. At least it's clearer what to do. I'll try to figure out the "how" myself. I'm not familiar with arrays yet, though. Anyway, thanks again.
Write at least one block and show me. They'll tell you further in this case.
Didn't work!(
Read it carefully, again.
All code will look like this
It didn't work!(
So you haven't done anything. You wrote it above:
And you have it written without checking. Although it would look more readable that way:
@Ihor Herasko @Alekseu Fedotov
THANK YOU!!! IT WORKED THAT WAY!