Log in or register to download unlimited Forex robots!
Build your own EA (for Beginners)
Hello there.
I would like to share something I have been doing for a while on how to test your own strategies with months and months worth of data in only a few minutes. (Maybe hours)
The point of this post?
I am going to show you how to create and test your own EA, and then improve upon your EA to improve its accuracy as much as possible.
But ...Why?
Because a lot of traders, particularly beginners, like to experiment and like to try new indicators, wondering if that could help their trading. This can take a lot of time and even cost a lot of money.
More 'about stuff': We are going to make use of a website, :
http://www.forexeadvisor.com/expert_generator.aspx
This Website allows you to build your own MT4 EA, (up to a point, you are limited to 5 parameters, We'll get to that.)
Excellent.
In the section to build your own EA you will note that you will need a basic understanding of 'greater than' and 'less than' , this information is covered in most primary schools as well as some high schools so i'll skip over that.
Next, lets use our big fat brains and experiment
What do we want from an EA?
How about trend direction? the Trend is your friend right? Trading with the trend can improve the probability of your trades being profitable.
what else?
How about CLEAR entries and CLEAR exits? we want to know exactly when to enter and when to exit.
Some traders make use of targets and stop losses,
Some like to enter and exit when they get signals from the market.
lets not get into which is better or worse. that matters ill at this point.
lets leave it at those two things for now.
Trend Direction
Entries and Exits
So. Trend direction? how about an EMA? This can be anything from a 50 period Moving Average to a 200 period moving average, the choice really is yours, we are here to experiment and learn without using all of our time and money. (efficiency when we test and effectiveness when we trade.)
Sweet. lets keep moving
Entry Signals????
Hmmmm. How about an RSI? CCI? MA cross over?
Okay, for this example (emphasis on the word EXAMPLE) we will use a 9 period CCI
(add this indicator to your chart, levels of 50 and -50 and set the period to 9)
Awesome
Lets review at this point, add the CCI to your chart.
Add 100 EMA to your chart.
Now the rules we will have here, are :
BUY = Price over 100 EMA, and CCI crosses from below -50 to above -50
CLOSE BUY = CCI crosses below +50 from above +50
SELL = price below 100 EMA, and CCI crosses below 50 from above 50
CLOSE SELL = CCI crosses above -50 from below -50.
(These parameters are not optimal but they will do fine for the purpose of this example.)
fill this information in at the EA builder website mentioned above and remember to set the cross over points
NB!! Cross over points can be set in two parameters/rules.
Example
CCI, Period 9, shift 0, > Value, 50
CCI, Period 9, Shift 1 < Value, 50
this instruction means that the CCI is currently greater than 50 but shifted back 1 step it is less than 50.
what this will do is make sure the EA only places trades when the CCI crosses and not just when the CCI is above or below..I repeat, using the shift 1 will cause the EA to place orders only when the CCI Crosses! that is good, that is what we want.
Great!!.
The criteria must be set for buy and sell trades and for close buy and close sell trades.
Then....
go to "Expert Advisor Code" and click on 'Generate'.
Next, all the mq4 coding for your EA comes up. fantastic. now you can save it and test it on your mt4 strategy tester.
that is part one done. If it worked. well done. don't forget to set your stop loss and take profit levels.
Part Two!!
Here is the Great part. the EA you just made, can be added to.
The website says you can only set 5 parameters. yes? Yes it does.
so how do we get around that?
hmmmm.
Lets open up that EA you just made in MetaEditor.
when you open it up you will see all the code and explanations for all your buy and sell rules etc.
so lets go to the website and make another EA,
We will set the parameters as Hour > 8 and Hour < 17
this will only allow the EA to trade between 8am and 5pm. (this can be done for any times you want to set)
now press generate. find the line of code that has the hour in it on the website and copy that into metaeditor. paste it in the open Buy and Open Sell rules and make sure all the Parenthesis balance. This is probably the trickiest part. I will do a tutorial on this at a later stage if need be.
okay. now that that is out of the way. press "Compile" on the top of your screen on metaEditor. this will analyse the code and tell you if there are any errors.
if there are Errors. It will tell you the line of code and which column the error is in and it is usually easily fixable.
if this has been done successfully. save your code, either overwrite your old one or create a new one.
Test this on your strategy tester.
This process can be repeated as many times as you wish. Unfortunately we are limited on some indicators (IE Ichimoku) but with this site we can use RSI, CCI, MACD, EMA, ADX and many others.
So now. hopefully I have helped some of you.
Please PM me for any details.
The Intent behind this post is to help people test their ideas and strategies as much as possible and as fast as possible. if the strategy does not win over the long term it probably isn't good, regardless of how much people say back tests do show true results. go ahead and forward test these strategies too (ON DEMO).
Other Notes:
I have found that Multi Time Frame correlation improves accuracy.
Don't be afraid to test anything and everything.
(I have used 3 RSI's, 3 Different Period RSIs with entries and exits based upon the cross overs of these RSI's.
Use this with multiple time frames.. using lower time frames for entries and Re-entries to add positions)
So I emphasize! Experiment!
Ask Questions and Look For Answers!!( Questions on their own are not at all good enough)
Like I said, For any more info on what I have said, Post a Reply or even PM me.
Sometimes a system is good for entries, EXITS are difficult. pay Special attention to EXITS!
EXITS EXITS EXITS!
Good luck to all. Wish you Many Green Pips
Antares,
You have shared a really good post, but as we know it limited to 5 parameters,
but somehow it worth call a nice sharing
When I get around to it, I will perhaps post some images with much better instructions on how to bypass the 5 parameter limitation
It could take some time. I want to make it as clear and concise as possible.
I would be thankful to you on this antares,
many of users dont like sharing there successful experiences
but thumbs up to you dear you doing it
Thanks for that post. I had a look at the site - very nice builder, I'll look at it later in more detail later.
Karel
I am currently working on an Example.. hopefully with images to explain how to by-pass the 5 parameter limitation.
Should be up soon if it all goes well.
By-Passing the 5 Parameter limitation
*** PLEASE READ***
This may take some explaining so please bear with me.
Alright. Straight to the point
Step 1: Go to the website mentioned above and create your EA with 5 parameters per Rule.
(open buy rule, open sell rule etc..)
Step 2: Generate your Expert Advisor code
Save it into your MQ4L/Experts folder. it is a good idea to remember the name of your EA.
Step 3: Open up Meta editor. this can be found in your program setting in the folder where your MT4 is installed. it can also be found in your MT4 by pressing the F4 key on your keyboard.
(or you can click on tools and open 'MetaQuotes Language editor')
Step 4: Click on "File" and then "Open" and then select your EA
These steps should be very easy if you are familiar with computers.
Now it Gets tedious.. Patience WILL be required for the next steps. That should be okay though. Forex traders excel in extraordinary displays of patience .
Step 5: go back to the Website listed above. and make an EA with the Remaining parameters which you did not fit in earlier
Step 6: Generate the code for that EA
Step 7: Read through the code and find the rules you had put in.. (new open buy rules. etc...) copy that section of the code. (Pictures will be very useful here.)
Step 8: Take the rule (the code you copied in step 7) and paste it into the correct line of code on your MetaEditor.
(it should say "This is your open buy rule" next to the open buy rule line of code and so on for each rule)
Be sure to click on the "Compile" button and make sure you place in the proper parenthesis' in the code (ie backets.. ---> "()"
as well as place the ---> "&&" signs to ensure the code is correct if there should be "&&" signs
Dont worry. I will put pictures up for you. I am not the best at explaining in great detail.
Do these last few steps to fill in all the rules you have for your code you can make them ALMOST as complex as possible..
I say Almost because i have had some bugs in mine (I dont exactly know how to make sure rules only activate when stochastics are over certain levels ONLY when the bar CLOSES.. I have had trades open on H4 bars because news pushed the price higher and the stochastic over the 80 level and then back down again without the bar actually closing..
i suppose i could put in rules for the times for each H4 bar but that would be a lot of parameters.. which is doable but very annoying.
I am Working on the Pictures now for you. Will post them soon. hopefully they will be worth one thousand valuable words.
okay. what I have done is made a simple EA with An open buy rule ONLY. as this is an example of A system I like to do Manually.
It consists of 6 rules more rules can be applied for more accurate re entries and exits and stuff.. lets TRY to keep it simple for now
My open Buy Rules
1* Stochastic Daily 100, 10,10 sma Shift-0. must be over the 80 level
AND
2*Stochastic H4 100, 10, 10 sma Shift-0. must be over the 80 level
AND
3*Stochastic H4 8, 3, 3, sma Shift-0. must be over the 80 level
AND
4*Stochastic H4 8, 3, 3 Sma Shift-1 must be BELOW the 80 level
And
5* Hour > 7 (Hour must be greater than 7 = not trades before 7'o clock)
My 6th rule will be
6* Hour < 17 (No trades after 17:00)
So I have made the original with 5 parameters.. lets add the 6th parameter
I have generated an EA on the Website with ONLY my 6th Rule. (It is easy to learn how to add these rules just by reading the code which the website generates.. Continuous learning.. very good for you)
I have copied the rule and pasted it into my MetaEditor where it says "this is your open buy rule"
After clicking on "Compile" I see I have an Error.
The Error is there Because i never filled in the "&&" things which mean "AND" . filling them in Fixes this issue entirely.. you will need to get the hang of this.
The Full Line now Reads:
if((iStochastic(NULL,PERIOD_D1,100,10,10,MODE_SMA,1,MODE_MAIN,0)>80)&&(iStochastic(NULL,PERIOD_H4,100,10,10,MODE_SMA,1,MODE_MAIN,0)>80)&&(iStochastic(NULL,PERIOD_H4,8,3,3,MODE_SMA,1,MODE_MAIN,0)>80)&&(iStochastic(NULL,0,8,3,3,MODE_SMA,1,MODE_MAIN,1)<80)&&(Hour()>7)&&(Hour()>17)) // Here is your open buy rule
When Pressing "Compile" the results will come up at the bottom
The General Rule of Thumb for this is: Errors NEED to be Fixed, Warnings do not .
Now for this Exact EA I made.. I do not have a Close Rule for my Buy Rule.. Which means I will have to set stoplosses and take profits or else my trades will never close unless I close them myself. (which is the easiest job in the world.)
I will try be active on this thread/Forum so I can answer questions. and perhaps I could finish this EA if it appeals to anyone here.. perhaps soon I can Upload it for anyone. (I'm sure there are faaaaar more advanced EAs here. but i'm happy to offer everything I know)
Picture 2.jpg 31.86 kb, 4 downloads since 2015-03-14
Picture 3.jpg 19.82 kb, 5 downloads since 2015-03-14
How can i make EA, can anyone help me to about this, i have tried to make EA, personally i am trying for me@ ....
Hello Great thread, I'll Investigate the issue of creation of automated systems. Sure I will learn a few things and improve increase manuals strategies. thank you
Why don't many people post their daily winning results?
MT4talk PRO members can Turn off MT4talk daily winning result post requirements for $49.99 / month. More info...
Latest profit posts from the Trade Executor EA users.
By using the MT4talk website, you automatically agree to the Forum Rules & Terms of Use, as well as the terms below.
Everything you see on the MT4talk website is created by its users, mainly the members of the MT4talk forum.
What is MT4talk?
MT4talk is an online Forex forum with over 5000 Forex robots and over 3000 Forex indicators uploaded by forum members in the last 10 years, available to download from forum posts. The Uploaded file does not come with support.
The website doesn't sell Forex robots and doesn't provide support for the ones you download. MT4talk offers a PRO membership, allowing you to download unlimited files from forum posts. Even though the site usually doesn't provide support for downloaded Forex robots, if you're new to Forex and need help, you can buy the MT4talk dedicated support membership from the MT4talk forum. The MT4talk Dedicated support subscription is only available for purchase for MT4talk PRO members.
The MT4talk Team also provides an Artificial Intelligence Forex robot called "MT4talk Forex AI Signal - Trade Executor EA" to PRO members. However, this Forex robot is only a bonus and is not included in the original PRO membership.
Updates for the Forex robots may be limited or nonexistent, depending on the creator. If you choose to download any Forex robot or setting file from the forum, you acknowledge that you are using it at your own risk. MT4talk PRO membership is a digital product. Therefore, after you complete the PRO membership purchase, there is no refund available!
We are conducting real-life tests on Forex robots to assess their performance. For certain robots, we may use a demo account to conduct tests, and for other Forex robots, we may use a real Forex account. It's essential to recognize that we are not financial advisors and cannot provide investment guidance. Our objective is to discover effective market analysis solutions through testing various strategies, which could be beneficial to our community.
CFTC RULE 4.41 – HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING PROGRAMS, IN GENERAL, ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFIT OR LOSSES SIMILAR TO THOSE SHOWN.
Disclaimer - No representation is being made that any Forex account will or is likely to achieve profits or losses similar to those shown on backtests in this forum. In fact, there are frequently sharp differences between hypothetical performance results and the actual results subsequently achieved by any particular trading program. Hypothetical trading does not involve financial risk, and no hypothetical trading record can completely account for the impact of financial risk in actual trading. All information on this forum is for educational purposes only and is not intended to provide financial advice. Any statements posted by forum members or the MT4talk EA Tester Team about profits or income expressed or implied, do not represent a guarantee. Your actual trading may result in losses as no trading system is guaranteed. You accept full responsibilities for your actions, trades, profit or loss, and agree to hold the MT4talk team and forum members of this information harmless in any and all ways.
Affiliates Disclaimer - The website may have links to partner websites, and if you sign up and trade through these links, we will receive a commission. Our affiliate partners are FXOpen, FBS, LQDFX, and MyForexVPS.
Copyright MT4talk.com Forum Rules - Privacy Policy.