I assume you have insurance for you house, car, and health? Why not insurance to protect you from your government?
Category Archives: Uncategorized
Memory handler errors in MT4 while importing history files or csv files
I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links related to Metatrader. I would recommend learning Python and custom developing your algorithms. It will be much more rewarding.
If you have issues with Memory handler errors in MT4 it is because you’re trying to convert too many symbols at the same time. Close all of your charts and only leave open the pair you’re working with. When you’re done close it and go on to the next. This will get rid of the memory errors that MT4 complains about once terminal.exe starts to use more than 1GB of memory.
Attached are zip files I had or that I was working on for Metatrader. I don’t know if they’re up to date, if they work, or support them in any form.
Monitor Account Balance and Send Email Alerts in Metatrader When Account Drops Below Threshold
I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links related to Metatrader. I would recommend learning Python and custom developing your algorithms. It will be much more rewarding.
I had a strategy that I programmed awhile ago that completely drained my account. The strategy itself was fine. In fact it was doing so good I decided to apply it from some of my currency pairs to XAU/USD. After applying I caught a flight to LAX to pick up a Porsche I had found online. I had never traded gold before but judging from the backtest it should have performed relatively well. The problem was I did not anticipate the large spread on gold. The spread was enough to send my strategy constantly opening and closing positions. The buy rules and sell rules were being met because of the huge spread. Once I landed I had picked up the Porsche and headed to my hotel, not realizing at the time I had left my briefcase and laptop in the back of the taxi that I caught at LAX. When I arrived at my hotel I checked my phone only to realize one of my accounts was down around 70%, only 30% of my capital remaining. I immediately freaked out and started my investigation. It was then I realized the large spread in gold was constantly opening and closing positions. Costing me the spread every 5 minutes or so. I called Oanda as I then realized I lost my laptop I could not shut off the robot. Closing the trades manually from my phone only made the account drain faster.
Now you see my reason for writing this code. The purpose of it is to grab your account balance at a specific time and then if it drops below a threshold to send an email notification. This code is in mqh format. Which is an include file. The reason for this is so that it can be applied to any expert advisor.
//+------------------------------------------------------------------+
//| DailyBalanceCheck.mq4 |
//| Copyright © 2011, Jeremy R. Whittaker |
//| http://www.JeremyWhittaker.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, Jeremy R. Whittaker"
#property link "http://www.JeremyWhittaker.com"
double todaysBalance, dDouble;
int iHandle, iErrorCode;
extern string sFileName=”dailyBalance.csv”;
int iDecimalPlaces=2;
int sendWarningCount, sendBalanceCount;
void dailyBalanceCheck(){
int count;
double onePercent;
if(todaysBalance<1){
fnReadFile();
todaysBalance=dDouble;
}
if(Hour()==16 && Minute()==59){
count=0;
sendWarningCount=0;
sendBalanceCount=0;
}
if(Hour()==1700 && Minute()==0){
if(count==0){
todaysBalance=AccountBalance();
dDouble=todaysBalance;
fnWriteFile();
if(sendBalanceCount<1){
SendMail(“Account Update”,”Good evening Mr. Whittaker todays balance is “+todaysBalance+”. Your current account equity is “+AccountEquity());
Print(“Sending Balance Email”);
sendBalanceCount=sendBalanceCount+1;
}
count=count+1;
}
}
onePercent=todaysBalance*0.01;
if(AccountEquity() SendMail(“Warning account equity down 1%”,”Account Balance at 5PM was “+todaysBalance+”. Now it is “+AccountEquity());
Print(“Sending Warning Email”);
sendWarningCount=sendWarningCount+1;
}
return(false);
}
//+——————————————————————+
bool fnReadFile()
{
iHandle = FileOpen(sFileName,FILE_CSV|FILE_READ,’;’);
if(iHandle < 1)
{
iErrorCode = GetLastError();
if (iErrorCode == 4103)
Print(“File not found”);
else
Print(“Error reading file: “,iErrorCode);
return(false);
}
dDouble = StrToDouble(FileReadString(iHandle));
FileClose(iHandle);
return(true);
}
//+------------------------------------------------------------------+
bool fnWriteFile()
{
iHandle = FileOpen(sFileName,FILE_CSV|FILE_WRITE,';');
if(iHandle < 1)
{
iErrorCode = GetLastError();
Print("Error updating file: ",iErrorCode);
return(false);
}
FileWrite(iHandle,DoubleToStr(dDouble,iDecimalPlaces));
FileClose(iHandle);
return(true);
}
//+------------------------------------------------------------------+
Attached are zip files I had or that I was working on for Metatrader. I don’t know if they’re up to date, if they work, or support them in any form.
Whittaker hourly ATR indicator for Metatrader
I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links related to Metatrader. I would recommend learning Python and custom developing your algorithms. It will be much more rewarding.
Attached are zip files I had or that I was working on for Metatrader. I don’t know if they’re up to date, if they work, or support them in any form.
How MT4 Calculates Spread and How to Manually Change it.
I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links related to Metatrader. I would recommend learning Python and custom developing your algorithms. It will be much more rewarding.
MT4 has a crude way of calculating the spread on each trade. It basically takes the current market spread at the time you run your backtest and applies that to all of your trades. Unfortunately, if someone is programming and testing on the weekends all of their results are going to be skewed because of the fact that the spreads on the weekend/after-hours are so high. You can check the spread that your MT4 platform is going to use by clicking on the symbol properties button from within your tester.
If you want to statically set this variable for your backtest purposes you need to download spread changer. It can be found here. http://www.jeremywhittaker.com/wp-content/uploads/2011/04/SpreadChanger.exe
Using this utility is not exactly straightforward. You need to find the file named Symbols.sel within your MT4 program files directory. Once you find the Symbols.sel file drag and drop it onto the Spreadchanger.exe utility and it will allow you to modify it.
The last step is you need to add a fake proxy server to your MT4 platform to trick it from accessing the internet. Because if it can access the server it will over ride your setting. You must also edit the symbols.sel file while your platform is closed.
Attached are zip files I had or that I was working on for Metatrader. I don’t know if they’re up to date, if they work, or support them in any form.