View Single Post
  #28 (permalink)  
Old 08-02-2005, 09:33 AM
ondigio ondigio is offline
Freshman
 
Join Date: Jun 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
ondigio is on a distinguished road
Default

Quote:
Originally Posted by scorpion
You can get user info (BriefUserInfo) by calling GetOpenTrades(). Example:

Dim info as BriefUserInfo
GetOpenTrades(info)

' Now info contains the user information.
Hi scorpion,
I've been lurking around here for a while, picking up a few tidbits here and there as I develop my own automated trading system. I don't know about you, but I've been extremely frustrated by the lack of documentation available for the MT3 API. I've had to discover most things through trial & error...

Anyway, I've run into a problem I can't figure out. I'm using API version 3.72 (are there any other versions?) I'm accessing the DLL from a wrapper written in Perl (and C) running on cygwin. The problem is this: the BriefUserInfo struct returned by MtGetTradeRecords contains incorrect values for some of the fields, and it does so inconsistently. Some examples:
  • When I initiate pumping, I get correct values for balance, freemargin and leverage, but equity, margin and profit are 0.
  • After opening a trade, freemargin == balance (used margin is not subtracted.)
  • After closing the trade, balance, equity and margin contain the correct new values, but freemargin and profit now contain the values they should have had at the time the trade was closed.
  • Finally, if I call MtGetTrades followed by MtGetTradeRecords directly (instead of using the pumped values), everything except balance goes to 0.

Weird, huh? Besides this little issue, everything else is working just fine so far. Any ideas? Have you encountered similar behavior? Could it have something to do with the server I'm using (currently the StrategyBuilderFX demo server)? As usual, it's probably something stupid that I'm doing...but I've wasted several hours already so it can't hurt to ask.

Thanks for your help, and for this forum!
Reply With Quote

Registered members have access to special online forex currency trading tools, software, mt4 expert advisors and indicators. Register now

Main Menu

Economic Forecast