Although I have an extensive programming background, for more than a few years I've stopped doing any programming and started pursuing other career job, so although I did forgot a lot of things I think I can handle the Visual JForex platform and describe you in details my simple EMA crossover system. The process of creating a strategy is what Dukascopy likes to see, so that was the main reason why I've decided to write this article.
The main concept for this system is incredibly simple yet unbelievably effective and even if you don't have any programming knowledge, you should be fine by simple following the step-by-step guide from this article.
Lets proceed first by giving a short summary of our strategy:
- Indicators we're going to use: 5EMA, 10EMA, RSI(10).
- Time Frame: Hourly (very important!).
- Pairs: Virtually any pair seems to work as this is strictly technical analysis. I recommend sticking to the main currencies and avoiding cross currencies.
- When to Enter a trade: Enter LONG when the 5EMA crosses the 10EMA from underneath and RSI must be above 50 to warrant entry. Enter SHORT when the 5EMA crosses the 10EMA from the top and RSI must be below 50 to warrant entry.
- When to Exit a trade: This depends on your trading plan (everybody should have a plan) and money management rules. Just by glancing at some recent data, the average hourly trend seems to extend beyond 100 pips before reversing. I recommend setting a T/P between 50 - 100 pips. S/L should provide plenty of cushion. Most trades will be winners in the long-term, but I'm uncertain of an exact win-lose ratio. Experimentation will yield the best results. I'd start with a S/L of 40, this way we ensure to have positive RR.
Now, lets start creating our automated trading system but before you proceed further I strongly recommend you to get used with the Visual JForex interface by watching Dukascopy tutorials from this link: http://www.dukascopy.com/swiss/english/forex/Visual/tutorials/
After lunching the Visual JForex make sure you login with your Dukascopy community credentials otherwise you won't be able to save or backtesting your strategy.
As it can be seen from the summary of the strategy we're using 2 EMA but in order to check the EMA cross, wee need at least 4 points, thus 4 EMA blocks. You may ask yourself why 4 blocks, well to be able to detect a cross, you look for the previous bar to have the fast value above the slow value, and the current bar the fast value below the slow value (for short entries). So you need 2 values for each EMA (5&10), one for previous value and the second for the current value.
Now let insert the first indicator that our strategy needs, we're going to drag and drop the EMA block into our workspace, see for further details Figure 1. Next step is to create another 3-EMA block as we already know we need 4 of them. You can repeat the first steps from figure 1 or you simply do right click on the first EMA block and Copy-Paste 3 more EMA blocks (see Figure 2).
- Figure 1.
- Figure 2.
In order to identify the variable more easily we need to create the variable which stores the EMA block results. We are going to use this new variable later so that's the reason we are giving them some specific name to find them more easily later. This new variables will be stored to the left-hand side panel (Variables)- User's Variables.
- Figure 3. On the EMA block click on the Input values to reveal the parameters that need to be changed: Period value should be changed to 1h(remember our system is designed to work on the 1h time frame); Time period should be changed to 5(this is the 5EMA block). Click on the Output value to reveal the parameters, click on the new parameter an new box" Add new variable" should appear and we are going to create a new variable which stores the EMA block results with the title EMA5_current_value. Repeat this steps with the modified value corresponding to each block until you get something like in this figure. Next step don't forget to connect the blocks.
Now we are going to add few more blocks that will make our strategy look more interesting. For now you should already be used with the drag and drop technique so we should add the RSI indicator the right-hand side panel (Repositorium)-Indicator-Oscillator-RSI.
- Figure 4. Change RSI Input values to our strategy requirements: Period:Hourly; Time Period:10 and the Output value name it simple RSI so it should appear on the left-hand side panel (Variables)-User's variables
For us to be able to calculate the cross between the two EMA's we'll need to use a more complex structure of "IF" blocks. First we need to create a check in block "IF", to check if EMA5_current_value is bigger or less than EMA10_current_value. From the first "IF" block we have 2 situation when EMA5_current_value is bigger than EMA10_current_value and when EMA5_current_value is less than EMA10_current_value so we'll need tow more "IF" blocks to compare EMA's previous values.
- Figure 5. We drag the "IF" block from the right -hand side panel(Repositorium)- Component- Logical-"IF" block. Next step is to fill in the right Input value, and on this step we are going to use some of the variables that we have created previously. From the left-hand side panel (Variables)- User's Variables we drag and drop the variables we need in the right place, like in the figure above. Next step don't forget to connect the blocks.
We are one step closer to finnish our automated system, for the next step we need to check if RSI is also in the right direction, this is going to filter some bad trades and make our strategy more accurate. For this we need two "IF" blocks for one case when RSI is above 50 and another case when RSI is below 50. I have to mention one important thing we have, gone far way with our automated system and we forget to save our work, in order to protect our work we should have saved our automated system at each step, so our work won't be lost because of some PC failure.
- Figure 6. In this step we are going to use our last created variable from previous steps. Drag "RSI" variable from User's variables into the "IF" blocks- first input variable, the second variable you should change it manually to 50. Next step don't forget to connect the blocks like in the figure. And we are also going to Save our system.
In the end our strategy will need to check that we have no order opened on our account. To do this, we need again to use the "IF" block from the right-hand side panel (Repositorium). In the first IF block parameter we will have to drag from the left-hand side panel (Variables) the Position Amount variable. As the second parameter we'll enter the value "0". Basically this block will ensure that we have only one position running on our account. If the Position Amount variable is less than 0 this means we don't have any open position and the strategy can proceed opening an Market order. If the Position Amount variable is greater than 0 this mean that we already have an open position and the strategy will not execute any Market order.
- Figure 7. From the right-hand side panel (Repositorium) we can find our new blocks which execute our orders. Component- Trading- Open at Market. One of this blocks is used for Buy orders and the second for Sell orders.
- Figure 8. Your final work should look something like in the figure above. I really had to zoom out far way in order to catch the entire block system.
If you think our strategy is over you're wrong we have to do one more thing which is to backtest our strategy and make sure it's indeed profitable. From the top Menu- Compiler- Build, if there are no errors a new message should pop up: "Strategy builded successfully", click ok. Next from the top Menu- Compiler- Run and after you have established the connection to strategy processor next follow the steps from Figure 9.
- Figure 9.
If you are not impressed with the return of investment than I'll tell you that most hedge fund will cry for having such performance in just one month. Our 37% ROI will beat most hedge funds out there.
Now, go make some money, and let your Automated strategy work for you while you relax.
Thanks for reading,