| / | Forum |
|
barry
2006.08.20 05:32
Free margin is shown in real time in the Terminal/Trade tab. I want to see
the lowest value of Free Margin during a week. Is there a way to see the history
of Free Margin, eg, for the last week?
|
|
Modelling Requotes in Tester and Expert Advisor Stability Analysis Requote is a scourge for many Expert Advisors, especially for those that have rather sensitive conditions of entering/exiting a trade. In the article, a way to check up the EA for the requotes stability is offered. |
|
cubesteak
2006.08.20 10:24
I don't think that is kept anywhere, as if you look at the account history, amount
of free margin isn't listed.
If you wanted to do it manually, I would keep a simple file that holds the lowest free margin that you've encountered. So, the flow (in sloppy pseudo-code): if (indicators say trade) { maketrade(); double FreeMargin = AccountFreeMargin(); int handle = FileOpen("mymarginfile.dat",FILE_BIN|FILE_READ); double LowestMarginSoFar = FileReadDouble(handle, DOUBLE_VALUE); FileClose(handle); if (FreeMargin < LowestMarginSoFar) { handle = FileOpen("mymarginfile",FILE_BIN|FILE_WRITE); FileWriteDouble(handle, FreeMargin, DOUBLE_VALUE); FileClose(handle); } } This way, your file will always hold the lowest value of your margin. You can then reset it weekly manually, or add code to the EA or use a script to reset it "automatically". Anyway, don't know if that is the smartest way to do it, but it should work. :) Cheers, -cubesteak |
|
barry
2006.08.22 04:14
cubesteak wrote: I don't think that is kept anywhere, as if you look at the account history, amount of free margin isn't listed. If you wanted to do it manually, I would keep a simple file that holds the lowest free margin that you've encountered. So, the flow (in sloppy pseudo-code): if (indicators say trade) { maketrade(); double FreeMargin = AccountFreeMargin(); int handle = FileOpen("mymarginfile.dat",FILE_BIN|FILE_READ); double LowestMarginSoFar = FileReadDouble(handle, DOUBLE_VALUE); FileClose(handle); if (FreeMargin < LowestMarginSoFar) { handle = FileOpen("mymarginfile",FILE_BIN|FILE_WRITE); FileWriteDouble(handle, FreeMargin, DOUBLE_VALUE); FileClose(handle); } } This way, your file will always hold the lowest value of your margin. You can then reset it weekly manually, or add code to the EA or use a script to reset it "automatically". Anyway, don't know if that is the smartest way to do it, but it should work. :) Cheers, -cubesteak Thanks cubesteak, I was hoping for a built-in function that doesn't require coding, since my coding ability is limited. If this is the only way to do it though, and I'm using 2 EA's on the one account, do I insert that code in one of the EA's, and then where do I locate the mymarginfile.dat file? Thanks for your help. |