As I mentioned in my last article, I will now illustrate step by step how to create the strategy defined, with the new tool Visual JForex. If you no longer remember the parameters of the strategy here is the link to my previous article: Visual Jforex - Building Strategies (part-I)
- Simple summary of the strategy:
- Indicators RSI and Bollinger Bands.
- Our strategy will open a short position if the current price is above the upper band and RSI> 70.
- On the other side will open a long position if the current price is below the lower band and RSI <30.
- Strategy will open only one order at a time with the TP and SL defined.
- Strategy will work on 5 minute chart.
So to begin, you must start Visual JForex interface, with your DFC credentials.
I will assume that you have already explored some aspect of this tool and we'll direct to action. Once you are logged within the workspace, you're going to start by click FILE in the top menu, then NEW. A box will open, here you write the name of our strategy: BB_scalp1, click Save, done. The workspace is ready to receive all the necessary information. Insert the first indicator that our strategy needs. As I mentioned in the previous article, Indicators Block, is on the right side, inside the Repositorium. After you open the tab and you find the indicator BollingerBands, drag it to the workspace, as you can see in the picture below. Then change the values according to the parameters defined: Period 5 mins, MA type: EMA.
- Image1 - Exemple how to drag BBands Indicator into Workspace of Visual JForex
Well, now that we have our first indicator BBands in the workspace and configured with the correct parameters, we will do the same for RSI indicator and set it too. Then we will connect them together. The next step in the development of our strategy is the logical part of the algorithm. Here begin the doubts and problems since the beginning is not easy to chain the logic blocks easily. The solution I've found has a high number of IF statements, but can be improved in the future.
So to interconnect all the logic of our strategy we will follow step by step the values we need to compare each other. Thus we have:
- If the RSI is higher than 70, check if the current price is greater than the upper band of BBands. If these two conditions are true then check if there is no open order.
- If the RSI is not more than 70, we have to check if it's below 30. If it is true, we check if the current price is less than the lower band of BBands. If the last conditions are true then check again if there is no open order.
- Now that we have all the logic that our strategy needs built, we will drag into the workspace the blocks needed for opening orders. So, we need 2 blocks to open orders at the market price. If our strategy uses pending orders, there are also blocks for such orders.
Sometimes it is not easy to explain certain procedures simply through words. To better understand these steps see the following pictures:
- Image2 - After drag the IF block that was in the Repositorium, right side of workspace. Go to left side, Variables and in User's Variables I have RSI_9. If you do not rename your RSI output variable it will be in Auto Created Variables, with name Outnumber. In my case I do not rename BBands variables. Drag RSI output variable into IF block and set second value to 70 manually. Repeat this step many times, how many IF Statements you see in next picture.
- Image3 - Drag all IF blocks you need and finally drag the Open at Market blocks. Make all connections between IF statements and at the end connect them with the blocks that will trigger the orders.
And you're done, we built our first strategy step by step. Now that the strategy is completed, we need compile our algorithm, for the strategy to be transformed into code and can be used on JForex platform . To do this click COMPILER and then Build in Top Menu.
Now comes the testing process and to make sure that it all works as it was intended. For this Visual JForex also owned a connector that connects itself to the trading platform and runs our algorithm. The tests can be made with passed data (back-test) or with current data (forward testing). Set all settings of our strategy and start the final TEST. For that you need to go again Top Menu, click COMPILER and RUN. If you received a box with an ERROR, click Download and then follow all the steps and see the "magic happen". Our strategy start Running in Jforex Platform...
- Image4 - These message boxes will appear during the beginning of the TEST process, only Strategy Report appear at the end. Follow the steps until the strategy start running on JForex Platform as you can see on next picture.
- Image5 - See our first strategy Running on Back Test
This was my first strategy developed in Visual JForex. It's a simple strategy, but we should always start with something easier. The tool is actually very good, but for more complex strategies may be more complicated develops them in this environment than in a text editor with access to the API. At least for me that I'm used to it. For those who are just starting out and did not notice anything about programming, then is the ideal tool...