Questions from Beginners MQL5 MT5 MetaTrader 5 - page 746

 
Alexey Viktorov:

Where do you find such programmers from?

All of this is absolute nonsense. Where to send such a programmer, I hope you understand.

Well, just in case, so you don't miss it, here's a pointer


A few people - and everyone starts to find out whether I have a hedge or netting account. I tell them I need a universal advisor and they all say:

"The task is to place several orders on one symbol. On some accounts, they will be added together, on others not. Everything will fit into one position and the future outcome is unknown (if Expert Advisors are not designed for it, of course). If I close or open in pieces, the profit will be quite different from what it would be individually.

I said, I don't care how it will be implemented, as long as the algorithm is as described in the task. We argued for several hours in a heated exchange, but finally we agreed that I was a lousy customer and did not know what I wanted.

When I went to the other progessors, I again received the same questions: hedging and netting. I said 'Universal' and the answer was: 'Go to hell if you don't know what you want'.

 
Artyom Kuraev:

A few people - and everyone starts to ask whether I have a hedge or a netting account. I say I need a universal EA and I get the answer:

"The task is to place several orders on the same symbol. On some accounts, they will be added together, on others not. Everything will fit into one position and the future outcome is unknown (if Expert Advisors are not designed for it, of course). If I close or open in pieces, the profit will be quite different from what it would be individually.

I said, I don't care how it will be implemented, as long as the algorithm is as described in the task. We argued for several hours in a heated exchange, but finally we agreed that I was a lousy customer and did not know what I wanted...

When I went to the other progessors, I again received the same questions: hedging and netting. I say "universal" and the answer is: "go to hell if you don't know what you want".

Perhaps that wasn't the right word. Indeed in netting accounts open positions are summed up. But if one is interested only in such an accounting of positions as in MT4, then one must have a netting account.

Everything else, magik, enumeration of positions and orders, determining whether an EA is open or manually opened by another EA, all is solved at once.

 
Alexey Viktorov:

Probably not quite the right thing to say. It is true that in netting accounts open positions are summed up. But if you are only interested in position accounting like in MT4, then a hadge account is a prerequisite.

All other things, magik, enumeration of positions and orders, detection of open positions by an EA or by another EA, all this is solved at once.

Yes, they add up. But that does not mean that it is impossible to obtain information about the required order and implement correct accounting and closing of the required order at a given moment, does it?
 
Artyom Kuraev:

... - The answer is "go fuck yourself if you don't know what you need".


Absolutely adequate and correct answer. And that is until you understand the difference between a netting account and a hedge.

I give you 99% that you are too lazy to read(MetaTrader 5 has added a hedge accounting system for positions), so just try to rewrite your assignment with that in mind:

ActionNetting resultResult Hedge
1.Buy EURUSD 0.01One position Buy EURUSD 0.01 lotOne position Buy EURUSD 0.01 lot
2.Buy EURUSD 0.01One position Buy EURUSD 0.02 lotTwo positions:
Buy EURUSD 0.01 lot position

One position Buy EURUSD 0.01 lot

3 Sell EURUSD 0.01One position Buy EURUSD 0.01 lotThree positions:

One position Buy EURUSD 0.01 lot

One position Buy EURUSD 0.01 lot

one Sell EURUSD 0.01 lot position

 
Vladimir Karputov:


Absolutely adequate and correct answer. That is until you understand the difference between a netting account and a hedge.

I give you 99% that you are too lazy to read(MetaTrader 5 added hedge accounting), so just try to rewrite your assignment with that in mind:

ActionNetting resultResult Hedge
1.Buy EURUSD 0.01One position Buy EURUSD 0.01 lotOne position Buy EURUSD 0.01 lot
2.Buy EURUSD 0.01One position Buy EURUSD 0.02 lotTwo positions:
Buy EURUSD 0.01 lot position

One position Buy EURUSD 0.01 lot

3 Sell EURUSD 0.01One position Buy EURUSD 0.01 lotThree positions:

One position Buy EURUSD 0.01 lot

One position Buy EURUSD 0.01 lot

one Sell EURUSD 0.01 lot position

I understand it logically, but in netting, is all information about open/closed trades deleted from everywhere, that it cannot be obtained from anywhere and only that part of a total position belongs to this EA? Also, I understand that it collapses several positions into one, but then what happens to the opening price when a position is added?
 
Artyom Kuraev:
Logically, I understand it, but is all information about open/closed trades deleted from everywhere, so it is impossible to obtain it from anywhere and close only that part of the total position, which belongs to this EA?


Of course, you can get trades from the trading history and analyze them. The question is whether this is necessary.

Artyom Kuraev:
... Also, I understand that it collapses several positions into one, but what happens to the opening price at the moment of adding a position?

The netting gives the final average price, which depends on the price and volume of the position and the volume you add. In that case, your best bet is to trade netting manually. Or better: if you are used to working with an order system in your old terminal, then in your MetaTrader 5 requirements you should explicitly state that you want a robot for a hedging system.

 

Help with history loading, please.

There is an array of open chart symbols, there can be up to 30 pieces. The problem is that when you switch timeframes synchronously, there is no history, and while it is loaded, the indicator "drops"

This design does not work

  ArraySetAsSeries(_open,true);
  for(int i=0; i<ArraySize(mass_id); i++) {
   MassSY=ChartSymbol(mass_id[i]);
    for(int e=0; e<5; e++) {
      if(CopyOpen(MassSY,Period(),0,(int)ChartGetInteger(0,CHART_WIDTH_IN_BARS,0)+1,_open)>=ChartGetInteger(0,CHART_WIDTH_IN_BARS,0)) continue;
    }
  }

I attach video for clarity


Thank you!

 
Vitaly Muzichenko:

Help with history loading, please.

There is an array of open chart symbols, there can be up to 30 pieces. The problem is that when you switch timeframes synchronously, there is no history, and while it is loaded, the indicator "drops"

This design does not work

I attach video for clarity


Thank you!


Vitaly, look at https://www.mql5.com/ru/docs/series/timeseries_access#synchronized, there is a sample script for loading the history, maybe it will help
Документация по MQL5: Доступ к таймсериям и индикаторам / Организация доступа к данным
Документация по MQL5: Доступ к таймсериям и индикаторам / Организация доступа к данным
  • www.mql5.com
Доступ к таймсериям и индикаторам / Организация доступа к данным - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Sergey Gritsay:

Vitaly, check out https://www.mql5.com/ru/docs/series/timeseries_access#synchronized, there's an example of a script for loading history, it might help.
I struggled with this script... Doesn't help. Although, maybe I did something wrong or there were some bugs in the build, after my tortures, there were many complaints (not mine) to this build.
 
Vitaly Muzichenko:

Help with history loading, please.

There is an array of open chart symbols, there can be up to 30 pieces. The problem is that when you switch timeframes synchronously, there is no history, and while it is loaded, the indicator "drops"

This design does not work

I attach video for clarity


Thank you!

Try to cycle all needed symbols/timeframes through the minute timer (Bars( symbol, timeframe );)