[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 545

 
artmedia70 wrote(a) >>
Respected gurus! >> Please advise stuck in the wilderness dummies how to organize tracking of orders and events on multiple currency pairs and multiple timeframes simultaneously in one EA. Order bookkeeping in a large program and the event tracking function do not give me any clear answers to my questions. I have not found any answers in the humongous expanses of this wonderful resource. I have never thought that a simple task (simple in my heart) may bring a kettle to a deadlock for so long and irreversibly, and nail it into the wall, that it will not come out... :)
I understand that I should organize review of orders in a loop, but I cannot figure out how to keep track of opened positions and set orders simultaneously for different currency pairs and different timeframes. Damn, I have been stuck in this situation for a month. I made a textbook Expert Advisor, which trades only on one pair and one timeframe, but it, of course, does not fit my TS and does not meet my requirements for trading system implementation.
Already a cry for help... Help me to understand it. If only hint, where I can read about it (only please do not send me back to the tutorial), and preferably with examples (what a beginner can do without examples - to feel is always better than to see...).

I would be grateful to anyone who responds in any way to a plea for help.

Think of a code for yourself,

which would encode all differences between orders as an int variable and assign it to a magician,

If you poll one magician you'll know exactly what order you're holding.

 
Tell me, should the EA draw the graphical objects in the tester in a separate window, not in the price window? For some reason it doesn't work when replacing zero by one when creating an object.
 
GVA63 >>:

Можeт вопрос покажeтся странным, но отвeт найти нe могу:

почeму при работe в "автматe", при одном и том-жe SL, ТP рeзультат сдeлок разный ? (разница до 3х пунктов). Буду благодарeн, eсли хотябы ссылку дадитe на соотв.

Slippage, perhaps?

What do you mean by "automatic" operation? What do you mean by "automatic"?

 
Necron >>:
Добрый день. Подскажите пожалуйста как сделать панель на графике, на которую можно было бы поместить несколько графических объектов. Притом координаты объектов должны изменяться при перемещении панели в соответствии с координатами панели. Где-то видел в кодебазе пример такой, но не могу найти. Благодарен за помощь
That's it, problem solved. Example here -> https://www.mql5.com/ru/code/9403
 

The 'Checkpoints' method takes the quotes of the nearest smaller timeframe into account.

If we are optimizing on 1-hour and history is downloaded only for H1 and M5 -> will M5 be used or ignored?

 
Thanks to all of you, who answered my previous question.
Now a question like this:
can I use the following construction when calling MarketInfo:

______________________________________________________________________

for (int ln=1; ln<=Instr_Count; ln++) // Search through the array of shaft instruments
{
for (int mode=1; mode<=9; mode++) // Cycle through modes MarketInfo of shaft instruments,
{ // equal to the current value ln
Level_old=Mas_Ord_Old[0][ln][mode]; // Take value from array Mas_Ord_Old [0][instrument symbol].][MODE=mode]
Level_new=MarketInfo(Instrument[ln] ,mode+10); // Take the same value from the DC
// Here Instrument[ln] according to the array of instrument names.
// return the name by the value of ln, then
// add 10 to the value of mode and wash MODE_XXX)

if (Level_old!=Level_new) // If data of the brokerage company has changed
{
Level_old=Level_new; // store new value of Level_new in Level_old,
Mas_Ord_New[0][ln][mode]=Level_new; // store it in Mas_Ord_New array
Inform(10,Level_new); // Report changes to broker
// This function should also be improved for more informative messages...
}
} // If the DC data on this mode hasn't changed, repeat
// the loop on the next mode. Up to mode=9

} // We have checked all the MODE for the given currency pair, proceed to the next one

..................

Instrument[ln] is an array of string type with the names of currency pairs:

Instrument[1] = "EURUSD";
Instrument[2] = "USDCHF";
Instrument[3] = "GBPUSD";
Instrument[4] = "USDJPY";
Instrument[5] = "AUDUSD";
Instrument[6] = "USDCAD";
Instrument[7] = "EURCHF";
Instrument[8] = "EURGBP";
Instrument[9] = "EURJPY";
Instrument[10]= "EURCAD";
Instrument[11]= "EURAUD";
Instrument[12]= "GBPCHF";
Instrument[13]= "GBPJPY";
Instrument[14]= "CHFJPY";
Instrument[15]= "AUDCAD";

__________________________________________________________________________

?????????????????????????????????????????????
Thank you in advance... :)

 

I didn't get into the logic of your cycle. But a quick glance at what I have underlined to you with a red line caught my eye. If the DC data has not changed, then repeat. But what if they have? What should the Expert Advisor do if it has not changed? Where is the command?

When the programmer goes to bed, he puts two glasses by the bed. One - with water - in case the programmer gets thirsty. The other is empty - in case the programmer doesn't want to drink.

Just kidding, but in programming one often has to handle both branches of the dichotomous division tree.

P.S.

By the way, artmedia70, notice how brackets and indents are arranged in your code in my screenshot. The code is much more readable in this way. It is just for your information.

 

A construction like:

if(A>B)
{
  // какие-то действия
}

is correct, but less convenient than the type construct:

if(A>B){
  // какие-то действия
}

The opening curly brace in the first case adds an extra line to the code, while in the second case an extra line is excluded. A closing curly brace in the second case indicates which command it refers to because it is located directly under the first character of this command. Thus, it is as easy to find the opening parenthesis in the second case as it is in the first one. But what is the advantage of the second way? Excluding unnecessary lines means that more code can be seen on the screen and the eye covers more information. As a result, it is easier to navigate through the code, which means more comfort in programming.

 
I have another question. There is an indicator (attached) that shows the opening price and it is possible to set an offset relative to the opening time in hours and added more in minutes. Can you please tell me how to make the level is drawn only to the time of closure of the daily bar? I'm so confused :(
Files:
 
drknn >>:

Конструкция типа:

является правильной, но менее удобна чем конструкция типа:

Type design.

if(A>B)
{
  // какие-то действия
}

It is correct. But a construct like

if(A>B){
  // какие-то действия
}

is obsolete. The line in example (1) is not superfluous and is used to unambiguously mark the beginning of a logical block of code. This is the 21st century -- space saving is ridiculous.

If it suits you, go ahead, but don't make others write it wrong.

BUT! What is the advantage of second way of writing? Avoiding unnecessary lines means that more code fits more lines and more information is visible to eye. As a result, it is easier to navigate the code and therefore more comfortable to program.

Nonsense.