OrderCalcMargin() always returns true and margin 0 - page 2

 
Which server is providing these symbols ?
 
bred_bred1 #: That's a strategy tester. SYMBOL_CURRENCY_MARGIN - depends on Symbol specifications. On SIZ3 - it's RUR. On FUTMNQH24 - it's USD. To be honest i considered this to be an issue, so i tested in advance. Synced the currency of the deposit and future symbols' - no success. Used USD + USD, RUR + RUR - no success. Pips +  USD, Pips + RUR - no success. Kinda running out of ideas. Especially taking into account that i can't see how any of these things are related to a simple 3 variable calculation, which OrderCalcMargin() is.
What values are printed to the log when using a live chart instead of the Strategy Tester?
 
bred_bred1:
Hi,

Stuck into a problem. Using the standard MoneyManagement modules results in OrderCalcMargin always returns true and margin 0.

in AccountInfo it's that call

which with further execution leads to the usage maxvolume of the symbol. 10000000 lots



As OrderCalcMargin is not debugable i really can't figure out what's going wrong.
I typed in some output just to check:

The output makes sense except Margin is 0.0

According to the documentation  SYMBOL_CALC_MODE_FUTURES  requires for calculations


Lots is 1.0, Init Margin is 15000, Margin Rate is 1. How it results in margin 0.0?

Tried on different symbols - current or previous futures - same results. 

@bred_bred1: I am having the same problem. I discovered it last night (Jan 15 2024). It only happens when the order is ORDER_TYPE_SELL. If I use ORDER_TYPE_BUY OrderCalcMargin works fine.    

Additional Information: the problem shows in Demo Version build 4131 (Jan/15), but not in Demo Version Build 4127 (Jan/12).

 
Fernando Carreiro #:
What values are printed to the log when using a live chart instead of the Strategy Tester?

Absolutely same results.

Well, it looks like it's a problem with a terminal distrib provided by Metaquotes to my broker. I'm as a last resort installed default distrib on a virtual machine and OrderCalcMargin works as intended, the broker's one does not. Later found out - at least one colleuge experience the same thing with broker distrib and what's especially interesting the bug is absent in one of the middle builds. So it's a drifting issue. Try to inverstigate further.


I remember reading one of your posts where you write about your setup with a portable build and somehow you add the brokers stuff over it - just to be sure the cases like that do not happen. Any links on the detailed "what-where" explanation? Forum thread/Docs? 


Thank you for your time Fernando! Appreciate it!

 
Alain Verleyen #:
Which server is providing these symbols ?

Looks like a broker distrib drifting issue. Some middle builds are ok, some have issue.

 
better.trader every.day #:

@bred_bred1: I am having the same problem. I discovered it last night (Jan 15 2024). It only happens when the order is ORDER_TYPE_SELL. If I use ORDER_TYPE_BUY OrderCalcMargin works fine.    

Additional Information: the problem shows in Demo Version build 4131 (Jan/15), but not in Demo Version Build 4127 (Jan/12).

Well, in my case the issue is with both Buy and Sell. And in the very latest from January 16th it persists and in 4040 too .
But I was told that in 4073 there're no issues. Btw what country is your broker distrib or it's a default one?

 
bred_bred1 #:

Well, in my case the issue is with both Buy and Sell. And in the very latest from January 16th it persists and in 4040 too .
But I was told that in 4073 there're no issues. Btw what country is your broker distrib or it's a default one?

the default in the demo account of metaquotes gives me the error. The FTMO broker does not.

 
better.trader every.day #:

the default in the demo account of metaquotes gives me the error. The FTMO broker does not.

Update: I just downloaded the version build 4137 (jam 18)... still having the same problem. My SELL orders give me zero margin required when calling OrderCalcMargin. The BUY orders don't have that problem.

 

Can you make short sell orders manually through GUI? I suspect that short-selling may be disabled for that symbol.

Please check the symbol specifications dialog:

 

 
bred_bred1 #:

If you were a little less arrogant little more logically developed you'd understand that all requested variables are outputed for the sake of conviniecy of provided information related to the question and not for my personal testing purposes. But thanks for the tip. Anything useful to say on the actual question?

I apologise, you are right. It is hard to stay humble with all these crap topics (not yours) and people trying to get profitable programs for free yet not being willing to really learn programming and share knowledge. Sorry I probably just overread it.