Feature Request for Futures Trading - page 2

 
Ryan L Johnson #:
You're welcome.
.
 
Ryan L Johnson #:

In contrast to you, I actually trade CME Futures... and I have an ABA accredited law degree.

Neither is relevant.

Can you run multiple strategies on a single netting account? Yes. Even on the same symbol? Yes. And what about hedging strategies? Yes. 


Code Base

Virtual

fxsaber, 2018.12.18 19:12

Virtual trading environment

Scenarios for using a virtual trading environment

  1. Real time tester. This means, you can observe what would be if the EA traded on the most recent prices in the tester in real time. This allows you to identify the causes of discrepancies between the real market and the Tester. There is no need to wait for a new day (MT5 tester limitation) or create special tools for the Tester, so that it can pick up recent data. Accordingly, it is not necessary to run the Tester repeatedly to get updates. In fact, the virtual trading environment is a real-time Tester.
  2. Auto optimization. The virtual trading environment assumes that you define what data it should work with. Therefore, an array of historical data allows you to run any TS on them inside a virtual trading environment. Thus, you can implement auto optimization into programs - a program regularly optimizes itself, just like the conventional Tester.
  3. Turning real trading into virtual one (and vice versa). For example, temporarily disabling a TS in case of losses. The time to re-enable the TS can be analyzed via the Tester or by trading a minimum lot. In turn, the virtual environment allows users to stop trading in real time, while continuing trading in the virtual trading environment. This provides much convenience when analyzing if it is time to re-enable the TS and the ability to easily re-enable real trading.
  4. Simplifying a trading logic on a working account. The market creates situations not present in the Tester. These include rejects and partial execution. The greatest issue is making real trading as similar to the one performed by the TS in the Tester as possible. Generally, TS developers spend considerable efforts to overcome market nuances that are extremely difficult to foresee. In fact, they learn from their own mistakes and pay real money for that, since demo accounts are unable to emulate many things of the real market. The virtual environment, in turn, allows us to see the perfect execution picture. Thus, in order to bypass the pitfalls of the real market, we need access to this perfect picture and a high-quality synchronizer (copying service) from the virtual environment to the real one. Therefore, virtual trading environments are of great help when dealing with difficult situations on real market.
  5. Tester acceleration. The built-in Tester is a universal tool. This means that it has to emulate the trading environment as fully as possible. This entails high costs in the form of operation speed limitations. When developing and analyzing a TS, such high accuracy is exhaustive. There are various ways to accelerate the Tester, including custom symbols (up to hundreds of percent) and virtual trading environments (tens and hundreds of percent), which can afford to not take something into account for the sake of speed. The Tester acceleration is an essential advantage of virtual trading environments, since it saves computing resources and, most importantly, time.
  6. TS reversal. A virtual trading environment allows reversing any TS easily.
  7. Using multiple TS on a netting account. A virtual trading environment considerably simplifies launching any number of TS on a netting account. TS do not interfere with each other.
  8. Unidirectional positions on a netting account. You can open several positions in one direction. Each of them will have its own Magic, OpenTime, OpenPrice, Comment, etc. This, for example, allows creating grid TS on a netting account, where each TP of a unidirectional position is different.
  9. Hiding Limit/Stop/SL/TP levels. If there is a task to hide significant trading levels, it can be quickly solved using a virtual trading environment.
  10. Launching Hedge TS on a netting account. All TS are launched in a hedge virtual environment. Netting real environment synchronizes with a virtual one.
  11. Resuming the TS operation after (abnormal) stop. The logic of many TS depends on what it did before. This is why even if you disable a TS and restart it immediately, you may not obtain the result that would have been received if the TS had worked without a shutdown. A virtual trading environment allows you to solve this task. When launching, the TS temporarily runs in virtual environment on a price history up to the current moment. Then it is moved to the real trading environment permanently. For example, that may solve many abnormal situations involving TS shutdowns and restarts.



Before MT5 included support for heding accounts, you could use the HedgeTerminal https://www.mql5.com/en/articles/1297 to trade everything you could on MT4 on a MT5 netting account. I doubt the library is still availlable but still an honorable mention. 

The Virtual library above allows the exact same. 

So, Hamilton is right, it is about the implementation. 

 
Enrique Dangeroux #:
Before MT5 included support for hed[g]ing accounts, you could use the HedgeTerminal https://www.mql5.com/en/articles/1297 to trade everything you could on MT4 on a MT5 netting account. I doubt the library is still availlable but still an honorable mention.

That Article was posted in 2015 by an Author in Russia. The U.S. NFA made changes to its enforcement of Rule 2-43(b) in 2019 that specifically apply to SL's, TP's, and TS's:

FIFO changes came into effect on August 16, 2019... After [broker-dealer redacted by me] FIFO changes come into effect, any new trades entered on our [broker-dealer redacted by me] platforms which do not comply with the FIFO requirement will be prompted with a warning prior to execution that the SL, TP or TS may cause a FIFO violation ([broker-dealer citation redacted by me]).

To be clear, it is ultimately the specific broker-dealer that determines the operation of order executions. Even if the aforementioned Author had experience with U.S. markets prior to 2015, the Article is irrelevant to the present U.S. regulatory environment.

Enrique Dangeroux #:
The Virtual library above allows the exact same.

Similarly, that library was posted in 2018 by another Author in Russia. Even if the aforementioned 2nd Author had experience with U.S. markets prior to 2018, the Article is irrelevant to the present U.S. regulatory environment.

In any event, I've already recommended a hidden exits workaround:

"As yet another workaround, the OP could probably code an EA to send a market order, opposing the entry direction and set at half of the aggregate position size, when price reaches the desired exit distance. In this way, the automatic offsetting of a Netting account will simply close half of the aggregate position. Of course, this would be a client-side implementation─not server-side." (Post #3).

You can do whatever you want in terms of hidden/virtual exits, but no U.S. broker-dealer is going to allow you to hold a buy position and a short position in the same contract and same account simultaneously.

I see that you're in Saint Pierre and Miquelon. Have you actually proven that any of these utilities actually override present day U.S. regulations and U.S. broker-dealer enforcement thereof in 2026─while trading CME Futures?

 
Ryan L Johnson #:

That Article was posted in 2015 by an Author in Russia. The U.S. NFA made changes to its enforcement of Rule 2-43(b) in 2019 that specifically apply to SL's, TP's, and TS's:

FIFO changes came into effect on August 16, 2019... After [broker-dealer redacted by me] FIFO changes come into effect, any new trades entered on our [broker-dealer redacted by me] platforms which do not comply with the FIFO requirement will be prompted with a warning prior to execution that the SL, TP or TS may cause a FIFO violation ([broker-dealer citation redacted by me]).

To be clear, it is ultimately the specific broker-dealer that determines the operation of order executions. Even if the aforementioned Author had experience with U.S. markets prior to 2015, the Article is irrelevant to the present U.S. regulatory environment.

Similarly, that library was posted in 2018 by another Author in Russia. Even if the aforementioned 2nd Author had experience with U.S. markets prior to 2018, the Article is irrelevant to the present U.S. regulatory environment.

In any event, I've already recommended a hidden exits workaround:

"As yet another workaround, the OP could probably code an EA to send a market order, opposing the entry direction and set at half of the aggregate position size, when price reaches the desired exit distance. In this way, the automatic offsetting of a Netting account will simply close half of the aggregate position. Of course, this would be a client-side implementation─not server-side." (Post #3).

You can do whatever you want in terms of hidden/virtual exits, but no U.S. broker-dealer is going to allow you to hold a buy position and a short position in the same contract and same account simultaneously.

I see that you're in Saint Pierre and Miquelon. Have you actually proven that any of these utilities actually override present day U.S. regulations and U.S. broker-dealer enforcement thereof in 2026─while trading CME Futures?

What part of netting account do you not understand? Netting account 1 position in one direction on same symbol at a time. You can run 2 virtual hedging ccounts where one is lot 10 long and one lot 5 short on same symbol, nette this is 5 lots long this is what your FIFO brokers sees. Your rules does not matter AT ALL!

What does nationality have to do with a netting account? Anyone trading CME on MT5 is on a netting account.

 
Enrique Dangeroux #:

What part of netting account do you not understand? Netting account 1 position in one direction on same symbol at a time. You can run 2 virtual hedging ccounts where one is lot 10 long and one lot 5 short on same symbol, nette this is 5 lots long this is what your FIFO brokers sees. Your rules does not matter AT ALL!

What does nationality have to do with a netting account? Anyone trading CME on MT5 is on a netting account.

Finally a bit of intelligence steps in the forum , But alas Enrique,You are dealing with a guy with more degrees than a thermometer "  Allegedly"  . But yes you are correct 💯. 
 
Enrique Dangeroux #:
Netting account 1 position in one direction on same symbol at a time. You can run 2 virtual hedging [a]ccounts where one is lot 10 long and one lot 5 short on same symbol, nette this is 5 lots long this is what your FIFO brokers sees. Your rules does not matter AT ALL

FIFO literally means first-in, first-out. There is no way whatsoever to close the 2nd trade first on the centralized CME exchange─no matter whatever self-recognized and hidden/virtual logic that you use. Otherwise, my previously proposed hidden exit plan herein has the same effect.

Enrique Dangeroux #:
What does nationality have to do with a netting account? Anyone trading CME on MT5 is on a netting account.

You are the first person to mention that in this thread.

In contrast thereto, I merely mention location because that is the relevant factor regarding localized market regulations. Presumably, most traders are trading within their respective local market regulations. In fact, my U.S. CME Futures broker-dealer blocks traders in certain locations from trading CME Futures:

blocked
 
Ryan L Johnson #:

To get further down into the weeds regarding FIFO, it is legal to have independent stops if the underlying positions are of difference contract sizes. Unfortunately, Metaquotes developers can't figure out how to implement multiple positions in a Netting account in MT5 in a way that is compliant with the CFTC and NFA rules (and likely a myriad of other unique regulations in other jurisdictions─all in one type of account, Netting). Therefore, you can never really get to the point of different contract sizes. There is however, one FX broker-dealer in the U.S. that offers that feature in MT4 only. Of course, that is of no help for CME Futures trading.

"As yet another workaround, the OP could probably code an EA to send a market order, opposing the entry direction and set at half of the aggregate position size, when price reaches the desired exit distance. In this way, the automatic offsetting of a Netting account will simply close half of the aggregate position. Of course, this would be a client-side implementation─not server-side." (Post #4).

You're welcome.

Thank you for taking the time to help me on this.

Where is the rule that says the sizing needs to be different for exits?

If I have an open position of 2 contracts bought at different price levels, I can set independent exits manually of 1 lot each.  

Is there a thread already on this with the metaquotes developers? 

 
Enrique Dangeroux #:

What part of netting account do you not understand? Netting account 1 position in one direction on same symbol at a time. You can run 2 virtual hedging ccounts where one is lot 10 long and one lot 5 short on same symbol, nette this is 5 lots long this is what your FIFO brokers sees. Your rules does not matter AT ALL!

What does nationality have to do with a netting account? Anyone trading CME on MT5 is on a netting account.

Thank you for being here. I appreciate your creative spirit to solve the problem!

It appears the next logical step is to create a single merged EA with two strategy modules and one shared execution manager

 
ZS444 #:
I suppose the next step is to work with the code to see if I can merge my EAs together and have them keep track of their positions independently? 

Exactly. Use this link https://www.mql5.com/ru/code/22577 from the Russian section, there is the latest version, not in the english section.

Check the examples, it works very simple and flexible, you just create virtual accounts as many as you need, select the account, do your trade operations on the selected virtual account, move to the next if you have a signal and so on. After all trade operations you synchronize the net exposure with the real account.

And you can do ANYTHING you want, unlike what Ryan claims, you can not close the 3rd or whatever, anything you can dream of, you can do.

 
ZS444 #:
Thank you for taking the time to help me on this.

You're welcome.

ZS444 #:
Where is the rule that says the sizing needs to be different for exits?
Forex Dealer Members may not carry offsetting positions in a customer account but must offset them on a first-in, first-out basis. At the customer's request, an FDM may offset same-size transactions even if there are older transactions of a different size but must offset the transaction against the oldest transaction of that size (https://www.nfa.futures.org/rulebooksql/rules.aspx?RuleID=RULE+2-43&Section=4).

Note that the word, "may," is not mandatory language. Therefore, a broker-dealer is not obligated to honor a trader's request to have different size positions excepted from FIFO enforcement. As a result, the overwhelming majority of U.S. derivatives broker-dealers refuse to honor such requests. That is the reason for me having found only one antiquated MT4 FX broker-dealer that actually uses the exception as its standard rule.

ZS444 #:

If I have an open position of 2 contracts bought at different price levels, I can set independent exits manually of 1 lot each.  

Is there a thread already on this with the metaquotes developers?

Have a look at the following utility. Just know that CME Futures can have rather unique tick sizes on a per symbol basis, so it may need some editing depending on the specific instrument that you're trading.

Code Base

Stealth Trade Manager (Hidden SL/TP and Spread Protector)

Amanda Vitoria De Paula Pereira, 2026.03.23 04:46

A professional trade management utility that completely hides your Stop Loss and Take Profit levels from brokers. It features a Spread Protector to prevent virtual stop-outs during news events or daily rollovers.