I'm quite new here, however I have some forex experience especially countless screen hours. I did a few of my own EAs but I wanted to see what other people did so far in this area and I quite impressed by Steve's work. I'm still not decided if I should continue my work on my own libraries and EAs or just learn Steve's. Any way...
I loaded this EA and fired against the last 3 years of data. Before coming to an end screen was full of 130 errors so I stopped it, looked at the results. It looks like the modify works as it should and based on my experience I suspected it should be some crims crap so I decided to contribute a little. I looked at code where as I expected there is no check against crim's freeze level.
To save you from google it, each crims cand set it's own pair dependent "freeze level" variable and the distance between Sl/TP and Ask/Bid has to be bigger then this "freeze level". Some crims like Oanda has 0 while FXPro has 5pips, Alpari beeing in between.
this can be extracted with
double FreezeLevel=MarketInfo(Symbol(),MODE_STOPLEVEL);
Here are some changes..
Code: Select all
//line 794 instead of modify = true;
if (Bid- NewStop > MarketInfo(Symbol(),MODE_STOPLEVEL)) modify = true;
// line 801 instead of modify = true;
if (NewStop - Ask > MarketInfo(Symbol(),MODE_STOPLEVEL)) modify = true;
// line 839 instead of: if (Bid >= sl + ((JumpingStopPips * 2) * Point) )//George
if (Bid >= sl + ((JumpingStopPips * 2) * Point) && Bid - sl - (JumpingStopPips * Point) >MarketInfo(Symbol(),MODE_STOPLEVEL) )//George
// line 855 instead of if (Bid <= sl - ((JumpingStopPips * 2) * Point) )//George
if (Ask <= sl - ((JumpingStopPips * 2) * Point) && sl - (JumpingStopPips * Point) - Ask > MarketInfo(Symbol(),MODE_STOPLEVEL)) //George
// line 896 instead of if (Bid >= sl + (TrailingStopPips * Point) )//George
if (Bid >= sl + (TrailingStopPips * Point) && Bid - sl - (JumpingStopPips * Point) >MarketInfo(Symbol(),MODE_STOPLEVEL))//George
// line 912 instead of if (Bid <= sl - (TrailingStopPips * Point))//George
if (Ask <= sl - (TrailingStopPips * Point) && sl - (JumpingStopPips * Point) - Ask > MarketInfo(Symbol(),MODE_STOPLEVEL))//George
// line 956 instead of modify = true;
if (Bid- NewStop > MarketInfo(Symbol(),MODE_STOPLEVEL)) modify = true;
// line 966 instead of modify = true;
if (NewStop - Ask > MarketInfo(Symbol(),MODE_STOPLEVEL)) modify = true;
The idea is simple, to buy you pay the Ask price, when you close you get the Bid.
2-3 pips between Ask and Bid will not make a difference when we want 100 but.. who knows...
I did these changes and 130 errors are gone. I don't know from resource point of view on Empty4 if is better to do only once at init a MarketInfo call or just put FreezeLevel into a variable and check against it. I have no idea if Criminals change the FreezeLevel when news comes in.
I still get some errors occasionally:
2012.02.03 11:02:56 2009.05.22 15:44 Graeme EURUSD,M15: OrderModify error 1
and
2012.02.03 11:07:07 2011.11.29 11:30 Graeme EURUSD,M15: object name passed to ObjectType function cannot be an uninitialized or empty string
I may look into this errors some time... but this Empty4 doesn't have too many debug options and there just a few errors not that bad.