Phantom Trades

 
I turned off algo trading for MT5 last night while logged in to metatrader desktop with the vps connected.  Then this morning I noticed 2 trades were placed but then immediately closed.  So why did they open in the first place? And if there is a setting that I am not aware of and the algo was actually turned on, why did trading not continue as if the algo was on?
Thanks for your assistance,
MetaTrader VPS
MetaTrader VPS
  • www.mql5.com
Reliable trading hosting for uninterrupted robot operations and instant trade copying
 

Look at this thread: https://www.mql5.com/en/forum/366161 

WARNING: After you've synchronized your trading environment with your MQL5 VPS, you DO NOT NEED TO CLICK THE AUTO TRADING BUTTON AGAIN in your local MT5 terminal, because if you do, you will trade with your Expert Advisor twice and that is very dangerous
How to buy, install, test and use a MT5 Expert Advisor
How to buy, install, test and use a MT5 Expert Advisor
  • 2021.03.30
  • www.mql5.com
Here is a step by step guide for buying, installing, testing and using a Metatrader 5 Expert Advisor (Robot, Bot are whatever): 1...
 
Sergey Golubev #:

Look at this thread: https://www.mql5.com/en/forum/366161 

WARNING: After you've synchronized your trading environment with your MQL5 VPS, you DO NOT NEED TO CLICK THE AUTO TRADING BUTTON AGAIN in your local MT5 terminal, because if you do, you will trade with your Expert Advisor twice and that is very dangerous

Thanks for the information.  I followed everything in the setup prior to the phanton trades happening.

Let me explain some more.

On the 14th I had the algo do the trading and then it closed out the day. I double checked to ensure that no pending orders were still waiting and also ensured I was flat.

I then pressed the Algo Trading button such that it turned red to stop any auto trading.

When I opened up Metatrader desktop on the 15th I saw that the algo had already placed 2 trades and then they were immediately closed and no further trades were placed.

So I am very puzzled why this happened.  I see the warning about the algo trading button, is it wrong to press this button to turn off auto trading?  Is there a "proper" way to do it?

However, why would the EA just stop trading if it started for whatever reason.

Is there a bug in the program or do I just not know how to stop the auto trading from happening.

 

I believe you a mixing up a few concepts, so first, lets be clear—are you using the MetaTrader VPS system as provided by MetaQuotes, or are you using a 3rd party VPS?

Assuming you are using the MetaTrader VPS and that you successfully migrated your EA to it, then disabling "Algo-Trading" on your local MetaTrader terminal will have no immediate effect on the EA running on the VPS. It will continue to trade as normal without interruption.

Also, while the EA is running on the VPS, you should also never enable "Algo-Trading" on your local MetaTrader terminal, as that will result in "double" trading (i.e. copy of EA running on the VPS and another copy of EA running locally at the same time).

If you want to halt the execution of the EA on the VPS (i.e. stop trading), then you need to re-migrate the new condition to the VPS (i.e. remove the EA from chart and migrate to VPS).

 
Fernando Carreiro #:

I believe you a mixing up a few concepts, so first, lets be clear—are you using the MetaTrader VPS system as provided by MetaQuotes, or are you using a 3rd party VPS?

Assuming you are using the MetaTrader VPS and that you successfully migrated your EA to it, then disabling "Algo-Trading" on your local MetaTrader terminal will have no immediate effect on the EA running on the VPS. It will continue to trade as normal without interruption.

Also, while the EA is running on the VPS, you should also never enable "Algo-Trading" on your local MetaTrader terminal, as that will result in "double" trading (i.e. copy of EA running on the VPS and another copy of EA running locally at the same time).

If you want to halt the execution of the EA on the VPS (i.e. stop trading), then you need to re-migrate the new condition to the VPS (i.e. remove the EA from chart and migrate to VPS).

Yes, I am using MetaTrader VPS as provided by MetaQuotes.

Yes, I migrated everything and the software said it was successful, then I traded with that EA for 1 day and all positions and orders were closed and cancelled by the EA and verified by myself.

Then in the evening I pressed the Algo Trading button such that it was red "stopped".

To my surprise when I opened my laptop in the morning 2 trades had been placed even though the button was red.  So if the EA was actually "on" then why didn't the EA continue to trade and why didn't I get any order rejection messages if there was an error in my EA?

How are buttons and charts differentiated between client side and server side with the VPS running?  How is the VPS controlled to stop it manually if needed if the Algo Trading button should not be pressed?

Thanks for any help that can be provided.

 
trcfp #:

Yes, I migrated everything and the software said it was successful, then I traded with that EA for 1 day and all positions and orders were closed and cancelled by the EA and verified by myself.

Then in the evening I pressed the Algo Trading button such that it was red "stopped".

MQL5 VPS is your other Metatrader but in cloud (and you can not see this "Metatrader in cloud" because no any Remote Desktop Connection for kind of VPS). And Algo Trading button is always ON for this "Metatrader in cloud".
So, your EA should trade in/for/inside this "Metatrader in cloud", and you can check it in MQL5 VPS journals (there are two journals which are not related to your home Metatrader). You can not stop Algo Trading buttom for this MQL5 VPS because there is no any button ...

Of course, you can check it/trades in your trading account with your home Metatrader but with Algo Trading button to be OFF.

-------------------

So, as I understand - you pressed the Algo Trading button such that it was red "stopped" on your home Metatrader (which has nothing to do with any trading with MQL5 VPS at all - in case you migrated/synchronize everything in correct way).

I mean: no any button is affected on this "Metatrader in cloud" (on MQL5 VPS) ... because Algo Trading is always ON for this MQL5 VPS, and this MQL5 VPS is not connected with your home Metatrader at all.

-------------------

You can check everything in MQL5 VPS journals.

-------------------

Besides, if you are trading by using your home Metatrader on the same trading account with MQL5 VPS so you may have such as "phantom trades' for example.

 
trcfp #Then in the evening I pressed the Algo Trading button such that it was red "stopped".

You keep ignoring what both I and Sergey have explained to you!

Disabling the "Algo Trading" button has no effect on the VPS. It will not stop the EA on the VPS from trading.

⚠️The only way to stop the EA on the VPS, is to re-migrate a new condition with no EAs present.

I repeat ...

If you want to halt the execution of the EA on the VPS (i.e. stop trading), then you need to re-migrate the new condition to the VPS (i.e. remove the EA from chart and migrate to VPS).

Also, the "Algo Trading" should not have been enabled on the local terminal in the first place, if the EA was already migrated and running on the VPS.

I repeat ...

Also, while the EA is running on the VPS, you should also never enable "Algo-Trading" on your local MetaTrader terminal, as that will result in "double" trading (i.e. copy of EA running on the VPS and another copy of EA running locally at the same time).
 

Thank you for the help and clarifications.

To summarize, the trades were not phantom trades because the vps was actually still running when I thought it wasnt't.

So in my previous post my follow on question was: "...why didn't the EA continue to trade and why didn't I get any order rejection messages if there was an error in my EA?"

I have done copious checks and research to figure out how to get my EA working with the VPS to no avail.  Bottom line is that my EA will start, however, it will only place the intial trades.  The follow on trades do not happen.

My EA works great when running them from the client side on the demo account with the vps "truly" disabled (now that I understand how to turn the vps off and on).

The EA does not work for live trading mode with the vps although it worked fine when used with the demo account. I verified with my broker that my account is enabled for algo trading.

(BTW, I do not use anything DLL)

Tomorrow I am going to run my EA from the client with VPS disabled and if everything works fine I plan to get a non-metaquotes vps and run with remote desktop.

Nothing with the metaquotes vps is very intuitive I can't figure out why it just doesn't work for my EA.