![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Enough of this nonsense. Enjoy your millions![](https://c.mql5.com/forextsd/smiles/angel_smile.png)
Link from Kimiv... way back when
https://www.mql5.com/en/forum/174933
Mr. Marketz,
Though I appreciate your last post with the link, I dont appreciate your condensation or sarcasm......
1. I never said it was the Holy Grail.
2. I figured you would have realized my last post was joking.
3. I was getting a little upset because I got multiple responses telling me I'm just going to get a bunch of losses or I'm not going to make any money.
4. I never asked anyone to do this for free, my question was "Can you create this EA?" That only requires a yes or no answer. Then from there we could discuss the fee, details, etc.
5. I dont plan on making millions, I have only been trading 1 lot for 10 pips each time, or about $100 profit a day.
You want to know the pair? Its the GBP/JPY. You can do your own back testing if you want. Almost every day it will go ATLEAST 10 pips past the previous days High or Low. Rarely it will stay in a tight range and not hit either, in which case you just reset it come 5pm. Use a stop-loss if you want, but I never do.
I'd like someone to take a look at the following code and make sure I didn't mess anything up. It simply does the math and tests whether or not FireSlayer's theory is correct.
Instructions:
1. Paste into the deinit() function of a new EA
2. Go to strategy tester. Select EA. Set to daily on any currency.
3. Hit start, then stop.
4. Go to journal and look at results.
int lost=0;int won=0;
int i,pb;
int profit_pips=0;
int spread = MarketInfo(Symbol(),MODE_SPREAD);
bool exit=true;
int exit_after=10;
for (i=Bars;i>=1;i--) {
Print("Testing BAR: " + i);
// i = current bar, looking forward
if (High>=High) {
// LONG Order would be hit, so check if it would be profitable
Print("-->LONG");
for (pb=i+1;pb>=0;pb--) {
if (High[pb]>High+tp*Point+spread*Point) {
Print("---->WON");
profit_pips += tp;
won++;
break;
} else {
if (pb==0 || (pb >= 0 && pb-1 >= i-exit_after && exit==true)) {
Print("---->LOST");
profit_pips -= (High-Close[pb])/Point;
lost++;
break;
}
}
}
}
if (Low<=Low) {
// SHORT Order would be hit, so check if it would be profitable
Print("<--SHORT");
for (pb=i+1;pb>=0;pb--) {
if (Low[pb]<Low-tp*Point-spread*Point) {
Print("<----WON");
profit_pips += tp;
won++;
break;
} else {
if (pb==0 || (pb-1 >= 0 && pb-1 >= i-exit_after && exit==true)) {
Print("<----LOST!");
profit_pips -= (Close[pb]-Low)/Point;
lost++;
break;
}
}
}
}
}
Print("-----------------------------");
Print(" TEST OF FireSlayer26 THEORY ");
Print(" LOST trades: " + lost);
Print(" WON trades: " + won);
Print(" PIPS WON: " + profit_pips);
Print("-----------------------------");
I do like the idea of such a simple EA, if the statistics work, however I noticed on the currencies I tried I'd have about 9-10 failed trades. These are ones that are hit and never go back into positive.
I threw in a variable called "exit_after" that will close the trade if number of bars go by and it's still negative. If don't want it to ever do that, then set "exit=false"
Hey Airforce,
I did as you say. But when I go to Journal it shows:
TestGenerator: unmatched data error (volume limit 17700 at 2008.03.10 00:00 exceeded)
GBPJPY Daily: loaded successfully
Did I do something wrong?
No, I get those errors all the time, it has to do with the tester in MT4 and the data it's using.
You should see something like:
-----------------------------
PIPS WON: -1205
WON trades: 85
LOST trades: 25
TEST OF FireSlayer26 THEORY
-----------------------------
If you wait until it's finished.
I want to post this code so that someone else can see if I have made any logic errors in detecting the number of good/bad trades, etc. As far as I can tell it did it correctly, but the numbers are saying there's a lot of bad trading going on, in which the stop will be hit but the takeprofit will not.
If I may suggest, Chage this code
Print(" TEST OF FireSlayer26 THEORY ");
Print(" LOST trades: " + lost);
Print(" WON trades: " + won);
Print(" PIPS WON: " + profit_pips);
Print("-----------------------------");[/CODE]
With this code, to show the result on the chart which for much more easier to look.
[CODE]Comment("\n-----------------------------"+
"\n TEST OF FireSlayer26 THEORY " +
"\n LOST trades: " + lost+
"\n WON trades: " + won+
"\n PIPS WON: " + profit_pips+
"\n-----------------------------");And as I read on the first post, it should only open 1 trade each day. And the high low value base on the prev day.
Sometimes we can't test it just like that coz we never know when the price go to our TP sometimes it's journey could against our posisiton first and hit our SL (if there is) after that it hit our TP.
Airforce,
Can you post the new EA you made with the test code in it, I cant get mine to work for some reason. I just keep getting the "unmatched data errors".
Oh, and I dont use stop losses. So that may be why your getting so many loss trades.
Here is the EA.
Very simple settings:
tp Takeprofit, in pips.
sl Stoploss, in pips.
lots Number of lots for each trade.
max_days Set to a huge number if you don't want it used. This will close an open order after X days if the takeprofit still hasn't been hit.
magic Individual magic number for this EA.
-Jason
Hey Airforce,
I got it loaded up, but on the strategy tester I keep getting OrderClose errors and Pending Order #XXX cannot be closed. Every trade is closed for a negative. It is also making multiple trades a day. It should only make one trade per day. Either a buy at the previous days High or a sell at the previous days Low. Which ever trade it takes, when it takes profit on that trade it should cancel the other pending trade and not do anything else till 5pm of that trade day when the system should reset for a new trading day.
Try this one. Fixed a bunch of stuff.
If you get any errors, I need as much information as possible, because I'm not having any problems on my side. It also *should* close the other pending order if one is already in play. This may be difficult to test in the strategy tester, because a single tick will go through the stop and hit tp before the other trade even has a chance to close.