Margin calculations in Strategy Tester - page 2

 
Vladimir Karputov:

Each feature is unique. There are no two functions with the same name in one code :) Therefore, it is enough to show the function. It's very simple.

It is all the more foolish to focus on the line number - everyone can use different styles of the styler and therefore the line numbers will be different.

Is this about being right or is it about providing support?

As far as I can see, your reply has nothing to do with the original topic and you seem to make a claim on that I am incapable of providing the correct and asked information. - It is absolutley not foolish to show the linenumbers when asked for if a journal log output is correct. Or do you have a method of verifying exactly this inquiry?

BTW, I dont have the muse to discuss this on such an unproductive level. - If you wish, delete the posts as you want and feel free to do your thing.


As addendum:

There is no such thing as a unique guarantee.

If I overload a function, there are very well more than one "copy" of a function. Although the signature might be a different, you will not be able to distinguish this.


The refered line numbers are very well consistent, since they have been printed programmatically. Therefore, if executed on another machine, in a different file, with a different "styler", the line numbers printed will always be valid.

 
Dominik Egert :


Tell me, have you changed the properties of the symbol and the properties of the margin in the tester?

  

 
Vladimir Karputov:

Tell me, have you changed the properties of the symbol and the properties of the margin in the tester?

  

Not that i knew about.



 
Dominik Egert :


Please run this code on your symbol in the strategy tester. Show results from the tabs: "Trade" and "Journal".

//+------------------------------------------------------------------+
//|                                 Open a position on a new bar.mq5 |
//|                              Copyright © 2020, Vladimir Karputov |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2020, Vladimir Karputov"
#property version   "1.000"
/*
   barabashkakvn Trading engine 3.143
*/
#include <Trade\Trade.mqh>
//---
CTrade         m_trade;                      // object of CTrade class
//--- input parameters
input ENUM_POSITION_TYPE   InpPosType  = POSITION_TYPE_BUY; // Position type
input double               InpLot      = 0.05;              // Position volume
//---
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   if(PositionsTotal()>0)
      return;
//---
   if(InpPosType==POSITION_TYPE_BUY)
      m_trade.Buy(InpLot);
   else
      m_trade.Sell(InpLot);
  }
//+------------------------------------------------------------------+
 
Vladimir Karputov:

Please run this code on your symbol in the strategy tester. Show results from the tabs: "Trade" and "Journal".

I have added the logfile (as zip), and here are screenshots:

Trade:


A snippet from journal:


BTW: Thank you for taking my issue serious. I do appreciate your support. I suspect some very strange and hard to find error within the margin-calculations.

I will repeat the same test on a different broker and post almost a duplicate of this post right after this one.

Files:
20210414.zip  2411 kb
 

Different broker. Aha. - The source of this issue seems to be the broker.


Trade:


Journal:

 
Vladimir Karputov:

Please run this code on your symbol in the strategy tester. Show results from the tabs: "Trade" and "Journal".

May I ask do you have an explanation for this??

If I look at the Symbol definitions at the other broker, I can see there is a difference in the Symbols margin rate definition.

Should this be addressed by the broker? - Does it make sense to report this as a malconfiguration to them? 


 
Dominik Egert :

May I ask do you have an explanation for this??

If I look at the Symbol definitions at the other broker, I can see there is a difference in the Symbols margin rate definition.

Should this be addressed by the broker? - Does it make sense to report this as a malconfiguration to them? 


You should check with your broker.