Article Library

9/34
Ranking
Hi Friends,
This time I have decided to share with you all, a method to develop Automated strategy in JForex platform.

Dukascopy offers us various opportunities to grow and strategy development means automated trading is one of them. I believe that if we make combination of manual plus automated trading can increase winning ratio in trade. My personal experience says there are many benefits of designing and developing strategies. In the process of designing strategy and increase its success rate I keeps trying various combinations of indicators. And in the process my manual trading is also improving. Because what looks good on chart may not go well in automated trading, and things which we haven't imagine can work well in automated trading. So, when we keep trying I am sure we can get a combination of indicators which will be highly successful. Another benefit is associated with is test run of strategy using historical tester gives us insight about reliability of strategy as well as reliability of indicators used. If you test run strategy for 2-3 years you will get idea about conditions where strategy will work and where it will fail. This guides us when to enter into trade and wh
Read article
Translate to English Show original
Lowech avatar
Lowech 19 June

класс)

Aviator avatar
Aviator 29 June

well done

anna_n avatar
anna_n 23 Nov.

very useful info! thanks!

Lovely_bee avatar
Lovely_bee 28 Nov.

very good work

Sebine avatar
Sebine 5 Dec.

Great!

orto leave comments
1/44
Ranking
Forewords
This article is a first part of 3 part series of articles about strategy testing in customized JForex. I’d like to show to readers how JForex libraries can be easily used in building custom strategy trader/back tester. The idea behind my articles is, that when one needs to implement some more complex trading algorithm containing tenth or even hundreds of Java classes, requires some custom UI, needs opportunity to debug it would be beneficial to break free from JForex back tester and develop custom program using JForex libraries.
The article series presumes reader has got at least beginner knowledge level of Java programming language, basic familiarity of Java Development Kit, and ideally PowerShell scripting overview or at least working Windows knowledge.
Personally I’m very interested in area of automated / algorithmic trading and as a professional software developer having good command of several languages I’ve found JForex platform like the best option to develop automated strategies on. In this first article of the series I’d like to show you how to download all necessary libraries of JForex and use them in simple Strategy implementation.
II. Get JForex libraries
Read article
Translate to English Show original
CharmingRimma avatar

nice explanation

ak10 avatar
ak10 15 June

I have started developing strategy in Java. I will request you to post one blog or article for middle level strategy developers like me. Your article is new concept. Hope you win.

mcquak avatar
mcquak 15 June

@ak10 thanks. The 2nd part I'm working on now will be about using these jars we downloded in thi article in project in IntelliJ Idea hence having debugging features available, having JavaFX ui with simple observable currency pairs dashboard etc. Will host source code on github.

salamandra avatar
salamandra 17 June

very good

foreignexchange avatar

mcquak  Thx : )

orto leave comments
4/56
Ranking
Abstract
In last month's article was presented the strategy of the Maximums and Minimums [1]. This strategy makes sense in pairs of low volatility, such as EUR/CHF. Although the automation trading has got some well known advantages. This article presents an implementation of the strategy using the JForex language.
Introduction
A JForex strategy is essentially composed of three parts. The first one is the part of the parameters and strategy settings. The second one is the part containing the logic of the strategy (interpretation of indicators) applied to the bars, ticks or both.
Finally the third is a logistics part where we have the functions that allows us to launch and control orders to the market.
In this article, as you can see in the following chapter the focus will be on the first and second part. The following topics are the most important aspects that are implemented in the second part of the strategy.
The Jforex Strategy
You can see the full strategy description on last month’ article at [1].
1. The entry market triggers


“On each closure of the one hour candles, the basic idea is to check if the Close occurs above or below the maximum or minimum of the previous day rela
[/1][/1]…
Read article
Translate to English Show original
OneGoodTrade avatar

Impressive skills. How does Jforex work on Apple? Is it faster than Windows?

LinnuxFX avatar
LinnuxFX 10 Oct.

Thanks! It works fine on my MacBook Pro.

priceaction113 avatar

thinks for shearing good job

priceaction113 avatar

very informative article

k_morocco avatar
k_morocco 26 Oct.

thaanks for sharing the information

orto leave comments
1/76
Ranking

I started trading not much like many other starters with fast cars and pretty chicks on mind. I started it as a Research & Development project with a sole purpose of having:
  • A documented accurate trading logic or process that suits my trading style. (Genetic representation & instructions).
  • A precise trading system that ensures: the repetition of accuracy for the above-mentioned process; and that the process is running in a controlled environment.
After having my Crystal Pyramid in place. (the name given to my strategy due to its pyramid-like structure, why crystal?, image-search for the whole term and you might know why).
Finally, it was deployment time. I needed a different broker than those I initially created my trading accounts for my R&D with. Currently, this R&D endeavor has self-financed itself with a proper Return-On-Investment too.
My requirements for that broker was (prioritized in descending order):
  1. Trust to be a business partner.
  2. Tier 2 liquidity provider (STP/ECN brokerage model.)
Read article
Translate to English Show original
BeautybyLesya avatar

cool!

bharatholsa avatar

Excellent ))

pawansansanwal avatar

Brilliant Article

ImranMughal99 avatar

nice

Agnessa26 avatar
Agnessa26 26 July

Отличная работа!

orto leave comments
20/38
Ranking
Continuing previous article...Note: On previous article i forget to make the link to the forum thread where you can download this strategy. You can download it here.Image 1: On this image i explain bellow all the strategy window items (on the left) and the option windows for changing Stop Loss and Take Profit respectively after order submition (at center). At the left of the image we have one example of the strategy running where we have two orders closed, three orders submited where two of them are filled (one with profit and one with loss) and one pending order waiting to trigger if the conditions are meet. Also we can see the Stop Loss and Take Profit prices on the red circles if the orders have them. On the green circle we have the price of the pending order and it will be filled when price reach the specified price.Legend of the image (missing items are described on my last article that you can read here).8 - "Pips" or "Value" (default "Pips"): Here you define the way you use to fill the Stop Loss and Take Profit boxes. With the default selected you must fill with the pips amount you want for Stop Loss and Take Profit on each of the corresponding boxes. If you select "Value" …
Read article
Translate to English Show original
doctortyby avatar
doctortyby 16 Oct.

I will have to download all your article series and start building a strategy because you provide great information and setups. Keep writing

ecoplace avatar
ecoplace 28 Oct.

good article , thank you

SmithJr avatar
SmithJr 29 Oct.

Thanks JL for all the work behind this tool. Keep the good work ;)

Cristian_Andres avatar

hello sir Jlongo wanted to thank greatly for his work has saved more than one, but I wanted to tell you that I felt some sadness that partial closure myOfflineTrades.jfx had not, I see that the line appears stop loss and take profit in the graph test or historical backtesting, but can not move or drag these lines to modify the stop loss and take profit from the same graph
Finally, I hope my drafting error apologize because I do not speak English speak Spanish but thanks to google I can try to send this message of appreciation and concern
Greetings and many pips

jlongo avatar
jlongo 9 Jan.

@Cristian Andres: With this strategy you can't drag the lines to adjust SL/TP. At this moment i don't have time to try to develop that in historical tester. To change SL/TP just click on correspondig SL/TP cell of the corresponding order at the table orders and a window will pop up to change the value of SL or TP. I hope that helps. JL

orto leave comments
1/38
Ranking
IntroductionIn first place i wish to apologise the fact some readers are expecting i will write about the use of indicators on strategies in this articles as i said before. I need to study more about them to try to do better articles about this theme. But surelly they will come. In this month article i will present you a tool for JForex to allow us to do manual trading in Historical Tester. You may not see any advantage on this, but for me is very important because i have a full time job, also other projects and i can't always be on front of the screen. Sometimes i can, but doing other things where i can't be focused on the charts. I can have some "quality" screen time where i can get focused on the charts at weekends and sometimes at night (my time zone is GMT DST), but at this time the market is closed or going slowly with the asian sessions. With this limitations on mind i tried to find a way to trade on the market at more volatile market periods (London and New York sessions) when i have time available but the only thing i find for JForex is a strategy created by the user "Kirilla" (you can see about it here). But this strategy is very limited with errors and don't do what i pr…
Read article
Translate to English Show original
LinnuxFX avatar
LinnuxFX 10 Oct.

Nice upgrade of Kirilla strategy, you bring it to a new and functional level, I will test my manual strategies with this useful tool. Good Work!

SmithJr avatar
SmithJr 29 Oct.

Useful tool. Really nice work JL!

ecoplace avatar
ecoplace 29 Oct.

nice collection very useful

hyperscalper avatar

Very good approach

patrickjames avatar

Does anyone have any issues while running this on a mac? When I load it, the window that allows me to buy/sell is cut off and I'm unable to extend it.

orto leave comments
4/41
Ranking
Backtesting a strategy (continuation)In my last article i don't have the space to write all i want about. To make the things easier i provide again in this article the corresponding image, but to see all 6 first items description you need to go to read my last article. Image 1: Historical Tester and the options on it. Explanation below (for the first ones read my last article).Legend (continuation):Red 7: Custom Tester Settings - In this window we have two areas. The first one is related with visual mode settings (if checked on blue rectangle). Here if we check the options, we have a chart representation added to the main chart of the evolution of "Equity", "Balance" and "Profit/Loss" with the evolution along the test. If you want to have more space available for the main chart ou if you want to add indicators to this main chart you can uncheck them and get the values on the final report where we get the results of the test. On the template dropbox we can select the template for chart presentation. On period dropbox we select the period bars we want to use to visualise the main chart. In the second one we can decide if we want to save the test originated messages and reports saved …
Read article
Translate to English Show original
jlongo avatar
jlongo 26 Sep.

@tcsabina: Yes you can do backtesting with only the API. Go to "src" folder under the unziped API file and search for "TesterMainGUIMode.java". You can start to see how works without JForex and if you want you can develop a program for that. I don't talk about that in this articles series because of complexity and some laziness to get into this, as i don't need it. Hope that helps. JL

tcsabina avatar
tcsabina 26 Sep.

absolutely. this helps me!
thanks for the fast reply.

jlongo avatar
jlongo 26 Sep.

Welcome tcsabina :)

deansi avatar
deansi 30 Sep.

Good news jlongo, final reports CAN be made from backtests run with Optimisation switched on! ,

you just need to double click on the result list (after the backtest is completed) to generate a html report for the pass# you have double clicked on, and you can do it to any or all of the passes in the list you like!

jlongo avatar
jlongo 30 Sep.

@deansi: Thank you for warning us :) Trade well

orto leave comments
20/41
Ranking

IntroductionAfter we create a strategy we need to compile and test it and if everything goes well, use it on "production" environment. Maybe all of us know how to do that, but probabily there are the ones who don't know how to achieve this. In this article i talk about how to compile, test and do historical tests with a strategy (if applicable) or indicators as well. For that we can use directly the sources provided with JForex API (testeMain and testerMainGUIMode), but this is somewhat more complex than using JForex client itself.  By this reason i only talk about using JForex client to do this work (if you have some doubts about using the API sources directly just ask and i will see if i can help if i know how to answer). In past articles i provided some basic strategies to understand the basic functionality and in last one i provided two strategies that do something usable. In other article i have presented other strategy where we extend JForex functionality with one different approach for market hours. You can use them to go over the steps on this article. Probably i will talk about indicators details (programming details) and how to use them on our strategy in next ar…
Read article
Translate to English Show original
Myprox4x avatar
Myprox4x 20 Aug.

great job, very useful, detailed, neat +1

LinnuxFX avatar
LinnuxFX 26 Aug.

First place its yours again...

orto leave comments
1/43
Ranking
IntroductionI'm a litle indecise what about what will be this article. I have several choices at the moment about other important aspects, but as some readers are expecting i write about how build strategies, i  will do their will. There are too much to talk about this, and this article i will talk only about two strategies i made and the steps to make them: one i used on last month contest only for fun and to see how contest works and the other will be present on this month contest. To help you to keep on track, if needed, read my last articles:-Are you ready for your first Strategy ???-Creating your first strategy.-Creating your first strategy (Part 2).-Creating your first strategy (Part 3).All needed files to follow this articles are placed at Dukascopy forum and you can access them here.Blind GameBlind Game is a very simple strategy. I made it just for fun and to understand how Strategy Constest work as i never participate in this. Basicaly what this strategy do is "toss a coin" and gets what side of the coin is up and places one order at the market with a predefined Stop Loss and Take Profit in the direction gived by the "side of the coin" that it gets.Image 2: The "brain" of …
Read article
Translate to English Show original
psox avatar
psox 4 July

Wow! what an article, I managed to write my first jforex strategy in 2 days flat after reading all the five articles!!

positive avatar
positive 6 July

It is called doing things differently. Very well narrated with very neat presentation.

Bluedragon avatar

Nice article. I Hope to see you in TOP+ in the end of Month. Regards, +1 ;)

men79 avatar
men79 10 July

Great articles , man +++++

madihazulfiqar avatar

great very very nice article

orto leave comments
21/48
Ranking
IntroductionPrevious related articles:-Are you ready for your first Strategy ???-Creating your first strategy.-Creating your first strategy (Part 2)In this article i will talk on the areas of a strategy where all the action happen. But before i want to inform you that in the last article i made some changes in the code on order submit validation and corrected the getLabel method/function because there was a error with charateres on the label string refused as invalid by the platform. This code changes are available at the support thread for this article here. The main areas where all action occurs are "onTick", "onBar", "onMessage" methods/functions. We focus our attention now on them and in some important aspects specially in bar and tick filtering because it's essential we understand this.Bar and tick filteringThe methods/functions onBar and onTick are executed always for ALL subscribed instruments (onBar and onTick) and ALL bars completion (onBar only) on ALL basic periods - 10 secs, 1 minute,  5 minutes, 10 minutes, 15 minutes, 30 minutes, 1 hour, 4 hours, 1 day, 1 week and 1 month! I have to mention that this time is determined from Dukascopy servers time and for example 4 hou…
Read article
Translate to English Show original
Smackenn avatar
Smackenn 27 June

Many thanks indeed for taking so much trouble to teach us about jforex api coding. I have been reading your article about filtering, which I have found to be extremenly useful. What I need to do now is to filter so that the action takes place immediately after the close of a specific time bar, for example the 08:00 GMT bar when the period is 30 minutes. How do I do that (I have tried to post this as a comment that all could see but I get a message saying that the comment server is unreachable) / Seamus McKenna

jlongo avatar
jlongo 27 June

@Smacken: If i understand your question correctly, what you need is to compare the time of the bar with the 8:00 GMT time. In onBar you can get the open bar time with askBar.getTime(). Take in consideration the time is returned in miliseconds and you need to convert the 8:00 GMT also to miliseconds to do the compare or the contrary. Also you need to filter the bar period with period == Period.THIRTY_MINS and do the comparations with bars that pass this filter. I hope that helps and if you need anything more, just ask.
Trade well and prospers in your way. JL

doctortyby avatar
doctortyby 27 June

I find your articles very useful as I was trying to find info about creating the first strategy in J-forex. I hope that you win this month, really great articles

kkforex avatar
kkforex 30 June

Nice series of articles!

Chrysos avatar
Chrysos 16 Oct.

Very useful articles. I enjoy reading them. Keep up the good work.

orto leave comments
28/48
Ranking

IntroductionPrevious related articles:-Are you ready for your first Strategy ???-Creating your first strategy.Finally we begin to structurate our strategy. For this introduction, our objective is to create a strategy for automated trading where we can use any indicator available. We begin with simple concepts and later we add some more functionalities after implementing the last ones, for example, adding money manegement, send email messages on entry and exit, and eventually what you will suggest in comments. Also we try to explain how to backtest and do some tunning on the strategy itself. To not  fill the articles with repeated code, i show you on next image a empty  strategy with the main areas identified on this image. I will provide the code you need to insert on each of this areas. I will create a thread on forum to provide complete code. So, let's begin.Image 1: The strategy base structure with the identified areas where we write the code excerpts presented in this article and the next ones.The needed JForex API "objects"To access the Dukascopy stream data servers and interact with the client platform or the api we need to create the objects who are responsible for …
Read article
Translate to English Show original
kkforex avatar
kkforex 30 June

Good luck to you 1+

tcanuto avatar
tcanuto 8 Jan.

Hello Jlongo! Okay? I am studying your article and after I wrote the code myconsole. getOut, etc., the following message appeared to me in NetBeans: "Select the main class to run", and would like to know which class do I select?

jlongo avatar
jlongo 8 Jan.

@tcanuto: if you want to run the strategy inside netbeans you need to configure and run testerMain.java or testerMainGUIMode.java inside the singlejartest source files provided in SDK... the main class is on both of this files but you need to adjust the parameters on this files. The easiest way is to open your strategy done in netbeans inside JForex, compile it and run inside JForex. The strategy itself don't have a main class and can't be executed alone, only runs on a prepared environment for itself. I hope this helps... JL

tcanuto avatar
tcanuto 9 Jan.

Ok ... so you mean I can disregard these error messages in NetBeans to compile in JForex?

tcanuto avatar
tcanuto 9 Jan.

Once again thank you for part 2 of the article! Not me looking so hard!
Is ... now I see that we already have a lot of code. But come on ... for now this is copy and paste. Over time I will getting used and absorbing all the information. Some codes that are green in the images, for me this in black. Why? Have any problem staying in black?
Well, it seems to me that the "private String getLabel ... are not explained, and I did not understand what is written in code, and if you can explain why one writes on each line, understand better. But ... C'mon ... later we learn gradually.

orto leave comments
19/48
Ranking

IntroductionIn my last article i have informed you where you can get information to learn about Java, JForex API and start to introduce and explain some steps needed to build our strategy and his structure . In this article we are going deeper on this aspects. I'm thinking about a Strategy for automated trading that can be used for Strategy Contest, Demo Accounts trading but don't try it on Live trading (well, you can use, but i'm not responsible for any losses you get with it, but if you get big wins - really big - i ask you to remember me to give me at least the thanks, nothing more).Going deeper...Image 1: If You don't have read my last article, this image represents a functional but empty strategy.On last image we have the beginning of our strategy, sligthy different of the presented on last article because i want to introduce to you some new concepts not present there:Package name: represents the localization of our strategy if we have a global project with more java files. Usualy match the base directory structure of our project. Working just with our strategy don't is needed.Import area: usually here we add all standard libraries needed by our strategy. Also after w…
Read article
Translate to English Show original
doctortyby avatar
doctortyby 27 June

Good programming skills, good info

withthesun avatar
withthesun 11 Feb.

Sincere thanks.

withthesun avatar
withthesun 11 Feb.

Sincere thanks.



withthesun avatar
withthesun 11 Feb.

Appreciate your article.

lfspinho avatar
lfspinho 9 Mar.

jlongo, I am very grateful for your excellent work, and unlike madiha I do believe we must learn to walk before we can run, and the "walkers" go elsewhere - Mark Twain said "If you have nothing good to say... say nothing!". Everything you wrote concerns the creation of the first strategy and are very important for does who know nothing, and you say specifically "...explain some steps needed to build our strategy and his structure." I am writing to thank you, but also to correct what I consider pure injustice, by raise my voice against that very missed placed and unjustified criticism.

orto leave comments