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?
- Filter for Terminal - Account History
- Account Balance Script
- Oil swap profit added into Equity but cannot be trace
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
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
cubesteak:
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
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.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register