1. Overview

In my previous publications I concentrated on strategies to be used in strategy contest development. As presently developed strategy needs further testing and it consumes a lot of time I decided to describe possibilities how visual jforex could be used to implement trading ideas and to use it in demo account.

2. Setting of strategy parameters

Strategy which building will be described in further sections of article is dedicated for catching of small movements inside tight range. Time when strategy to be used could be chosen so that no big movements in selected pair during selected period of time could be predicted. It could be for example be loaded during Asia trading session when most pairs with exception of those with JPY's do not move very intensively.
Thus strategy which will be developed parameters to be as follow:
- Pair - EUR/USD;
- Maximum number of simultaneously opened trades - 3;
- Opening of trade based on 10 min candles if last tick is 1 or more pips higher than candle open - sell trade is executed, if 1 or more pips lower - buy trade I executed. This rule applies if there is no open positions at the moment. If there is one open position additional requirement for opening trade is that existing position loss is higher than 3 pips. If there is two open positions additional requirement is that existing positions cumulative loss is higher than 9 pips;
- SL is 12 pips, TP is 3 pips;
- Trade amount - 0.001.

3. Programming of strategy

So strategy specification is done and now it is time for strategy development. Firstly in visual jforex default parameter should be set to values according to prepared specification, i.e. SL - 12 pips, TP - 3 pips. Trade amount - 0.001 and pair - EUR/USD is set by default so in this case no adjustments of default parameters are needed.

Secondly we need to choose strategy start point OnTick and follow with blocks and its interconnection.


As can be seen from picture above strategy start point onTick is connected with block "If" in which check is done if tick instrument is equal to default instrument. Here only default instrument ticks are filtered. Next block "If" checks if number of open positions is less than 3 as in strategy specification there is a limitation of 3 simultaneously opened positions. Further "Get Historical Candle" block is used for fetching of present 10 min candle which open value will be used further for decisions on opening of trade (default period is 10 min if another period to be used either default period could be adjusted or new value jus entered in block parameter field).

Next "Calculation" block is used for determining how high or how low present rate is from present 10 min candle open. Thus parameters in this field are last tick value and present 10 min candle open value. In lower part of this block subtraction should be chosen in order to indicate what mathematical action should be performed with mentioned values.

Now we have value "span" (result of calculation) which will be used for determining to open position or not and if open in which direction.

Now strategy logic should be split in two branches as in one case we are going to look for buy trade and in another for sell trade. For this purpose "Multiple Action" block is used. First output of mentioned block is directed to block "If" which checks if present rate is higher than present 10 min candle open more than 1 pip. If it is the case further blocks are triggered if not strategy ends cycle and waits for another tick to come for analysis. Second output of "Multiple Action" block is directed to another block "If" which checks if present rate is lower than present 10 min candle open more than 1 pip. If it is the case further blocks in this branch are triggered if not strategy ends cycle and waits for another tick to come for analysis.

Analysis is identical in both branches thus only one branch will be described.


Again firstly this branch should be divided in 3 sub branches according to the number of open positions. For this purpose "Multiple Action" block is used again and 3 outputs of this block are directed to 3 "If" blocks where check of number of open positions is made. According to this check different actions are performed if there is 0, 1 or 2 open positions. If there is no open position "Open at Market' block is triggered immediately and in this case sell trade is opened. If there is 1 open position "Position Viewer" block is used. First output of this block is triggered every tine when every open position is taken for analysis. So in this case as there is 1 open position first output of this block will be triggered 1 time. After this position will be taken for analysis "Calculation" block will be triggered and profit loss in pips of open position will be added to variable profitloss. In this case value of this variable will be the same as profit loss of open position. Later second output of "Position Viewer" block will be triggered and logic will come to "If" block were comparison if loss is higher than 3 pips will be made and if it is the case another sell trade will be opened. After all this steps value of variable profitloss is set to 0 in order to use this variable in another cycle calculations.

If there is 2 open positions logic goes similar but in this case first output of "Position Viewer" block will be triggered two times and "Calculation" block will be used 2 times also thus value of variable profitloss will represent cumulative profit loss of 2 open positions. Later on according to specification check if loss is higher than 9 pips will be made and if it the case third position will be open.

As was already mentioned another branch (which looks for opening of buy trade) has the same logic. Strategy could be amended by additional blocks which will allow strategy running for example during night time from 00:00 to 07:00 GMT for this purpose "GetTimeUnit" block could be used and later on further "If" blocks in order to implement time window when strategy should run.

4. Loading of strategy to demo account

As strategy is already prepared it could be compiled and loaded to demo account now in order to see how it works and if there is any deviations from set specification. For this purpose we need to open demo jforex platform go to strategies section and load source code which could be fetched from visual jforex platform by right clicking of strategy icon in right side of visual jforex platform.


Thus strategy is loaded and now will be clear if it works according to specification. After enough time will pass and required for testing fluctuations will occur conclusions on strategy performance could be made.
After strategy ran for some time it could be concluded that it performs according to specification.



Trades are opened when rate goes more 1 pip away from 10 min candle open and check of cumulative profit loss is also made before opening second or third trades.

5. Conclusions

Strategy performs according to specification but the most tricky moment is actually define time windows when rate fluctuates without sharp moves as strategy is not dedicated to run during sharp moves. Already mentioned possibility is simple time window during night time but there should be also other possibilities to run and stop strategy based on various indicators, price action, etc.
But purpose of this article was to demonstrate how easy with means of visual jforex trading strategies could be developed. Definition of windows when to run strategy is not in scope of this article and will be covered in coming publications.
Translate to English Show original