Few Nights Spent Coding Jforex: Trend Trading with Bollinger Bands

INTRODUCTION
With the new year start, I began learning the JForex strategy coding (in java). Within one week of study, I've came to a conclusion that JForex is much more powerful coding language than MQ4 and other automated trading strategy we see around us. Being based on Java, the code is not only reliable and prevents lot of execution errors with efficient handling of exceptions before first run, as well the strategy is platform independent. The servers and technology infrastructure installed by Dukascopy also have reliability. On top of all this, the upcoming facility of running your strategy next to Dukascopy's trading servers in Switzerland makes the life of scalper, high frequency trader a lot easier and profitable! See my audio related to server co-location here.
I've figured out that the JForex Wiki, the API Docs and Dukascopy Forum has immense knowledge about JForex strategy coding, if one takes out time for learning and testing out the logic. Henceforth I'd like to present a showcase of my experiences with JForex Strategy coding. The support given by Dukascopy on Forum is exceptional and terrific.
The JForex Edge
Most people are said to lose out in trading. And it's commonly seen that most brokers out there are using MT4 as their trading platform, while Dukascopy engineered JForex based on Java. The speed, scalability of JForex system makes it the best suited for all kind of traders, and even Scalpers! To say it clearly in a trader's point of view, MT4 was technically made to make people lose. The reason is the lack of charting types as well as limitations on chart period.
The Strategy
My interest in JForex coding came due to the strategy contest, and to code a simple day trading system on JForex which contains five indicators for generating one entry signal and exit using either of two reversal signals. One of the indicators is Bollinger Bands and the same system can trade both trending as well as range bound markets. Till date, I'm able to code logic for just one indicator while the rest four would be implemented in coming weeks hopefully along with the exit strategies.
Learning Curve
Since the interest developed due to strategy contest, I stating off reviewing the code of past winning strategies and found them to be without much or any comments. This makes the logic difficult for a beginner to grasp, while experienced ones can clearly read the code like a book. So the lack of comments within the codes proved difficult to learn the language. Then I found the API Docs, which were quite detailed and one can clearly see how much power the JForex-API has given to traders for developing the strategy code exactly as per the requirement of trading system. However due to lack of examples, I was still stuck with basic class import declarations in my JForex programming code.
Finally I got to see the various forum post made in Dukascopy JForex Forum. The topic threads and the discussions really provides the base for a massive Knowledge Base of JForex. I believe the Forum will provide immense help to everyone learning JForex, and this trend would growing in future too, due to more brokers starting to use Dukascopy's JForex as their trading platform (e.g. FXDD, Alpari are using JForex in US). The code examples and above all, the support team provides quick relief to all kind of questions placed by novice and experienced strategy programmers alike.
JForex Tick Data
There are lot of misconceptions around the trading world, for example that backtesting is not reliable. However with tick data, one can really test the system for each price movement. While MT4 is able to give just 1 minute time frame as the minimum dataset, Backtesting using JForex is immensely powerful due to the tick data availability. I've even came across few help sections on internet forums, where people are downloading historical tick data off the JForex platform, only to convert the JForex data into MT4 readable format. Using JForex historical tester and tick data of past years, strategy can export various indicator's parameters to spreadsheet and one can analyse the results later to find potential failure points within all trades taken by strategy in past, which are frequently occuring and can be filtered to improve the expectancy of the system. Any system which cannot be tested in historical tick data, can be considered unreliable for use.
High Frequency Testing!
The standalone API implementation of JForex, for example also allows us to run multiple instances of same strategy for back-testing using different parameter values. This enables us to see a clear edge of little variations in our order management or trading logic. For example: A take profit of 63 pips in this strategy resulted in lower Risk:Reward ratio and the account was unable to compound quickly as expected even with high leverage.

However using a take profit of 60 pips, the back test resulted in making account equity four times the original size within just nice days! Henceforth, I found the JForex coding as well as the historial testing of immense value to all traders.
I'm very keen to test my strategy on different pairs and on various time frames using different parameters of those five indicators. On top of that, different position sizing can be used for each trade based on indicators or system logic. Results for each currency pair and each parameter of indicator, as well the position sizing strategy used would obtain so many different results across different time frames of charts. So one can only imagine how difficult it might be to test all such combinations and evaluate them against each other in order to find a higher expectancy out of your existing system, while all this seems tough, it actually isn't at all with JForex.
In short, with the powerful JForex API and historical tick data, it is really easy to do the search for "Holy Grail within our own trading system" to reap the fruit of success with our hard work.
Bollinger Bands as Individual Trend Trading System
In range bound markets, bollinger bands produce squeeze effect and price moves up and down within the Bollinger Bands. Whenever market breaks this squeeze, there comes a powerful move in one direction and all gains/losses made during squeeze period be wiped out/covered in one or two losing trades if proper stop loss is not maintained. With JForex, I tried to code Bollinger Bands as a part of my 5 indicator entry signal logic. While testing the JForex historical tester, few interesting patterns appeared that I would like to share here.
+ A standalone Bollinger Bands based strategy made money over time, and gave more than 10% annual return on equity by risking 0.50% capital on each trade.
+ The strategy made big money while markets were trending and protected the capital when market was choppy or not fit for trend trading.
+ Strategy when used with very high leverage can make great money, while risk of losing initial capital increased.
+ Results of strategy changed when trade size was increased along with account equity.
+ The strategy was tested on a the most volatile currency pair of 2011: AUD-JPY and it worked out fine.
While the step-wise increment in trade size along account equity seems like a good idea, however the variations in it's parameters can affect overall performance of the system. As explained in past articles, it's not the entry however the exit which makes or breaks a system. Hence we can keep the trade size fized irrespective of account equity (i.e. 0.50% risk per trade) for below given strategy.
The Jfx code
Download the present version of Bollinger Bands based strategy to make a review and see if it works for you. I'd use the same strategy in February month's strategy contest and all will be able to review a better and revised code by then hopefully, using the above same link. 


The above run was done on Aussie-Yen, 5 minute chart with a 21 EMA on Bollinger Bands. The 21 EMA is my favorite and it's usefulness and actual usage is well explained in past articles of this pipping recipe.
Closing Notes
Based on my level of understanding, one needs to have little however completely free time to code their system in JForex. Once coding is done, it might take time to test your strategy on this tick data (if you were using MT4, back-test results will be different because historical testing in MT4 is based on one minute candle and not tick data). JForex expedite the system testing with multi-threading and indicator values can be easily exported tick-by-tick to find best parameters for the system.
I sincerely hope this articles and strategy motivates lot of wannabe JForex learners to switch to this powerful strategy coding platform.
(loop=yes) {
All wishes for your prosperity in this new year. Happy trading;
} ;)

Efegen
geula4x
LinnuxFX
AdrianWS
topsygirl
Brasileiro
Airmike
Likerty
doctortyby
12 Jan
kkforex
13 Jan
Nicco
13 Jan
quantum_fx
14 Jan
Tinktank
21 Jan
ritesh
21 Jan



