MetaTrader 5 trading platform is now available for AMP Futures clients wanting to trade futures - page 3

Jim Hunt
607
Jim Hunt  
Keith Watford:

I don't think that there is any ETF flavour.

Hi Keith,

Thanks very much for getting back to me, but I fear you may have misunderstood my loosely phrased questions.

I'm not interested in trading anything apart from CME futures. However a futures exchange is a rather different venue than a "bucket shop" FX broker's '"B book"!

The first thing I'm trying to establish is whether this is the correct venue for asking my in all likelihood increasingly technical questions.

Alain Verleyen
42232
Alain Verleyen  
Jim Hunt:

Hi Keith,

Thanks very much for getting back to me, but I fear you may have misunderstood my loosely phrased questions.

I'm not interested in trading anything apart from CME futures. However a futures exchange is a rather different venue than a "bucket shop" FX broker's '"B book"!

The first thing I'm trying to establish is whether this is the correct venue for asking my in all likelihood increasingly technical questions.

You can ask all questions you want but most likely you will not get answer from Metaquotes.
Jim Hunt
607
Jim Hunt  
Alain Verleyen:
You can ask all questions you want but most likely you will not get answer from Metaquotes.

Thanks for that Alain. I couldn't get an answer from AMP either! There is no known way of getting MetaQuotes to respond to technical queries that a futures broker cannot answer themselves?

Let's try this one out for size then:

Given that at AMP MT5 is communicating with (in my case) the external CME rather than the aforementioned internal "B book", what precisely does the number returned by the MQL5 FreeMarginCheck() function represent?

Enrique Dangeroux
794
Enrique Dangeroux  
Jim Hunt:

Thanks for that Alain. I couldn't get an answer from AMP either! There is no known way of getting MetaQuotes to respond to technical queries that a futures broker cannot answer themselves?

Let's try this one out for size then:

Given that at AMP MT5 is communicating with (in my case) the external CME rather than the aforementioned internal "B book", what precisely does the number returned by the MQL5 FreeMarginCheck() function represent?

Read the documentation https://www.mql5.com/en/docs/standardlibrary/tradeclasses/caccountinfo/caccountinfofreemargincheck

Jim Hunt
607
Jim Hunt  

Thanks for your suggestion Enrique, but strangely enough I first did that a very long time ago. See for example:

https://www.mql5.com/en/code/159

Ray the Random Robot didn't include some of the subtleties of real life trading, but I did RTM from cover to cover at the time.

Would you mind taking a look here for me?

https://www.mql5.com/en/docs/constants/environment_state/accountinformation

Where does it explain how to differentiate between "day trading" and "overnight" margin for example?

A Really Random Robot
A Really Random Robot
  • www.mql5.com
This Expert Advisor is best used on the one minute timeframe. Try it on any and all currency pairs. It uses a random number generator to simulate simply tossing a coin to decide on the direction of each trade. It stays in the market 100% of the time. It provides an example of a minimal Expert Advisor programmed in an object-oriented style...
Jim Hunt
607
Jim Hunt  

All this talk of Ray the Random Robot suddenly reminded me that what with one thing and another I had somehow neglected to ever upload his offspring to this forum.

I've now put that right with this blast from the dim and distant past:

https://www.mql5.com/en/code/27799

Enjoy!

Free download of the 'Ray Robot Jr.' expert by 'soulsurfer' for MetaTrader 5 in the MQL5 Code Base
Free download of the 'Ray Robot Jr.' expert by 'soulsurfer' for MetaTrader 5 in the MQL5 Code Base
  • www.mql5.com
Trade Copier - Open Source - Multiplatform - Transmitter Side Trade Transmitter will Transmit Trades from MT5 Demo or Real accounts using CSV Files. Each trade request created manually or by other EAs on MT5 terminal will be automatically transmitted. Positions and...
Jim Hunt
607
Jim Hunt  
Jim Hunt:

All this talk of Ray the Random Robot suddenly reminded me that what with one thing and another I had somehow neglected to ever upload his offspring to this forum.

I've now put that right with this blast from the dim and distant past:

https://www.mql5.com/en/code/27799

Enjoy!

"Validation completed with errors"!

They didn't have that back in the day!!!

[Invalid price]

I'll leave sorting that out as an exercise for the interested reader.

Jim Hunt
607
Jim Hunt  

Just in case this proves to be of interest to anyone else, testing on a live MT5/CQG account reveals that SymbolInfoDouble(xxx, SYMBOL_MARGIN_INITIAL) and  SymbolInfoDouble(xxx, SYMBOL_MARGIN_MAINTENANCE) both return the same number during RTH. 

400.0 in the case of ES, which is the "day trading" margin.

How is one supposed to determine programmatically what the "overnight" margin is prior to opening a position?

 

Alain Verleyen
42232
Alain Verleyen  
Jim Hunt:

Just in case this proves to be of interest to anyone else, testing on a live MT5/CQG account reveals that SymbolInfoDouble(xxx, SYMBOL_MARGIN_INITIAL) and  SymbolInfoDouble(xxx, SYMBOL_MARGIN_MAINTENANCE) both return the same number during RTH. 

400.0 in the case of ES, which is the "day trading" margin.

How is one supposed to determine programmatically what the "overnight" margin is prior to opening a position?

 

That's an old broker issue, they don't provide the right margin maintenance.

You can try to ask them to fix it. Good luck with that.

The only way to deal with it is to use an parameter in your code and to provide the value yourself.

Jim Hunt
607
Jim Hunt  
Alain Verleyen:

That's an old broker issue, they don't provide the right margin maintenance.

You can try to ask them to fix it. Good luck with that.

The only way to deal with it is to use an parameter in your code and to provide the value yourself.

Thanks Alain, but my question was intended to be rhetorical. Thanks also for your good wishes. I feel sure I will need all the luck I can muster!

The trouble is the multiplier differs from one instrument to another. Hard coding the numbers will prove to be a right pain in the proverbial posterior :(

Adding an appropriate "input setting" is probably the least of several evils.