Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1413

 
gyperion #:

Hello. Please help me with a problem in mt5.

The history of currency pairs quotes beyond 2016 is not loading. Broker - Gerchik.

Tried:

1 - download history through the strategy tester.

2 - through the tools terminal. it stupidly shows the history only up to 2016.

3 - copy the history from a normal loaded pair of the mt5 server. no use, it just deletes these files after restarting the programme and again the history is only up to 2016.

4 - the broker's technical support said to run pairs without the letter Z at the end, but they have all currency pairs ending with Z - EURUSDz, AUDCADz.

I guess that the problem is in the broker and their server, but why it even deletes the copied history? Can anyone tell me how to upload the history normally?

So maybe they have no history, as they themselves are not a very old kitchen?

 
Aleksey Vyazmikin #:

So maybe they don't have a history, since they're not a very old kitchen themselves?

And what are some non kitchens to work from Russia? It doesn't matter really. The question is how to upload the history, even if they don't have it?
 
gyperion #:
And what is there not to work from Russia? It doesn't really matter. The question is, how do you download the story, even if they don't have it?

Can you lend me money even if you don't have any?

 
gyperion #:
And what is there not to work from Russia? It doesn't really matter. The question is how to upload history, even if they don't have it?

Through custom characters make your history.

Importing High Quality Tick Data to MetaTrader 5
Importing High Quality Tick Data to MetaTrader 5
  • 2021.11.28
  • www.mql5.com
In order to vet a potential trading strategy, it is imperative to ensure that the results obtained f r om optimizations and strategy tests are a true reflection of the performance of your EA
 
Nauris Zukas #:

Through custom characters make your story.

Hmm. It partially worked, but the important thing is that it worked. I'll keep digging. Thanks for your help, sir, I've already tried everything.
 

Hello everyone, I want to write my first trading robot (Expert Advisor). It works perfectly in the backtest and the test results are also respectable. But there are various things to consider: account types, symbol properties, interference with other EAs, etc.

I have four variables for this:

bool isHedging; bool isFIFO; ulong positionTicket; double positionVolume;

The first two variables are set in the init method:

if ((bool)AccountInfoInteger(ACCOUNT_HEDGE_ALLOWED)) isHedging = true;
else isHedging = false;
if ((bool)AccountInfoInteger(ACCOUNT_FIFO_CLOSE)) isFIFO = true;
else isFIFO = false;

If I want to open a position, I first check whether this could cause problems with FIFO (i.e. if I want to open a long position, I check whether there is already a long position with the same volume or a short position for the respective symbol, as otherwise StopLoss and TakeProfit may not work properly, as I have heard). And finally, I use the OrderSend method and set if it was successful:

positionVolume = tradeResult.volume;
positionTicket = tradeResult.deal;

With an executed StopLoss or TakeProfit, I recognise through the OnTradeTransaction method whether my (internal) EA position has been closed by checking whether the positionTicket variable matches transaction.position.

If I want to close a netting account position, I simply close a long position with a short trade with the same volume.

If I want to close a hedging account position, I close the position with trade.PositionClose(positionTicket, slippage);

If I want to close a FIFO hedging account position, I close the oldest position of the respective symbol that matches the position direction (long/short) and volume, which should be my own due to my entry conditions for FIFO accounts described above.

Now I am sure that I have overlooked something fundamental. How do I ensure that StopLoss and TakeProfit on a netting account are also closed when I close the (internal) EA position as described above? Are there more elegant and efficient ways to make the EA FIFO-compliant? With a non-FIFO hedging account, if I only open a position in the EA with a MarketOrder, do not edit it and then want to close it, is the tradeResule.deal value always the same, so that I can also close this position without worrying with trade.PositionClose(positionTicket, slippage), where positionTicket is the saved tradeResult.deal value?

I have been looking for answers for several days, but have not yet found any that could resolve all my concerns. I hope someone here can help me.

 
Benjamin Fotteler #:

Now I am sure that I have overlooked something fundamental. How do I ensure that StopLoss and TakeProfit on a netting account are also closed when I close the (internal) EA position as described above? Are there more elegant and efficient ways to make the EA FIFO compliant? With a non-FIFO hedging account, if I only open a position in the EA with a MarketOrder, do not edit it and then want to close it, is the tradeResule.deal value always the same, so that I can also close this position with trade.PositionClose(positionTicket, slippage) without any worries, whereby positionTicket is the saved tradeResult.deal value?

I have been looking for answers for several days, but have not yet found any that could resolve all my concerns. I hope someone here can help me.

There is only one position per symbol on a netting account. If the EA only trades one symbol, this can be read in PositionTotal() - or even simpler PositionSelect() is either wrong (=none) or thus also selected for further trading.

Documentation on MQL5: Trade Functions / PositionSelect
Documentation on MQL5: Trade Functions / PositionSelect
  • www.mql5.com
PositionSelect - Trade Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

That is correct. Thanks for the tip. But what do I do, for example, if another EA runs on the same symbol, opens a position of 0.5 lots and a stop loss of 100 points, my EA opens an "EA internal position" of 0.5 and a stop loss of 150 points, i.e. increases the existing position to 1 lot, and I then close the "EA internal position", i.e. reduce the existing position to 0.5 lots. What stop loss do the remaining 0.5 lots then have? 100 points or 150 points? Or is it not possible in netting mode to set an independent stop loss for "my" 0.5 lots via SendRequest in such a case?

I mean, I don't want to simply change well thought-out stop losses from other EAs, but I don't want to simply give up my own. Is there an efficient solution to my "problem" other than opening an "EA internal position" in netting mode only when there is no open position for the symbol?

 
Benjamin Fotteler symbol, opens a position of 0.5 lots and a stop loss of 100 points, my EA opens an "EA internal position" of 0.5 and a stop loss of 150 points, i.e. increases the existing position to 1 lot, and I then close the "EA internal position", i.e. reduce the existing position to 0.5 lots. What stop loss do the remaining 0.5 lots then have? 100 points or 150 points? Or is it not possible in netting mode to set an independent stop loss for "my" 0.5 lots via SendRequest in such a case?

I mean, I don't want to simply change well thought-out stop losses from other EAs, but I don't want to simply give up my own. Is there an efficient solution to my "problem" other than opening an "EA internal position" in netting mode only when there is no open position for the symbol?

If on a netted account(!) the first EA for e.g. EURUSD buys 0.01 lot (buy) and a second EA sells 0.05 lot (sell) there is again only one position on the account with now 0.04 sell. Ticket numbers are completely irrelevant here for the time being. And if the second order for the only position in EURUSD sets new (its= SL and TP, those of the first order are overwritten.

There is only one position with one SL and one TP, if specified.

 
I can understand that, thank you. But I still don't understand which stop loss applies if the first EA buys 0.01 lots and the second buys 0.05 lots. Then a position of 0.06 lots is open, right? And which stop loss applies to this position? The first, the second or an aggregated one?