Article Library

In my recent articles I was focusing on strategy hypotheses checking and strategies paper-trading in R. So all of these activities with so much of development effort in it bring a valid question. Is there any value in such backtesting and hypothesis checking? My answer is definitely yes, and I'm going try to persuade you about it.
Why doing back test in R when my strategy runs in Java/JForex?
This is valid question. Why anyone would be bothering writing thousand lines of code without any possible reuse?
First of all R is good for quick strategy prototyping. Before we would be bothering to write single line of code in Java, it's better to assure that our strategy is profitable. And R is very good tool for it. Ok, fair enough so far. However this would lead us to justified worries about rewriting whole strategy that we potentially have in R to Java. This could be potentially quite big issue since libraries we are used to use in R usually do not have their opposite siblings in Java world. So my personal intention about strategies being written in R is to be able to reuse as much from the code base in R as possible. How?
Reuse R code in Java/JForex? Use Renjin!

When I was starting inv…
Read article
Translate to English Show original
mg64ve avatar
mg64ve 26 Dec.

Dear mcquack, I have tried to implement the R-Java integration as per your article.
I am not using IntelliJ, I am using JForex.
I successfully installed rJava in R and modified the path in Linux.
Unfortunately, if I try to compile your strategy I get:

14:17:32 The import org.rosuda cannot be resolved

Do you have an idea where JRI.jar has to be copied?

cbennici avatar
cbennici 7 Jan.

hi mcquak.

I've  installed properly Rjava and  load the library: '@Library ("C: /Users/calog/JForex/libs/demo_3/3.0.15/JRI.jar")'. The strategy compiles regularly.
At a time when initializing the Rengine "Rengine re = new Rengine (new String []  {" - no - save "}, false, null);" is executed  the platform closes unexpectedly without saving anything.

Rjava under JForex have been tested under Windows 10?

mcquak avatar
mcquak 7 Jan.

cbennici, I've made tests under Windows 7, but it's definitely not a problem.
I did not use standard JForex platform for testing but I used my own local tester built up from JForex .jars so I could  run and debug whole platform from within IntelliJ Idea (which is great for debugging purposes).
I guess for R to be callable from standard JForex platform, you'd need to made some changes in the strategy. If I'm not mistaken there is some metadata attribute that allows to import/reference jars in the platform (see screenshot).

mcquak avatar
mcquak 7 Jan.

mcquak avatar
mcquak 7 Jan.

mg64ve Hi, pls see my 2nd post above, it's perhpas tha same problem. For using/referencing external jars in JForex you'll need to reference them via metadata attributes. @RequiresFullAccess and @Library("PATH_TO_JAR").

orto leave comments
In continuation of previous article, I will now introduce some minor updates and the possibility to back-test the strategy to clearly understand its beahvior: far better than any image or personal comment.
The idea and strategy concept are not intended to be used in full automatic mode, but as additional tool for daily trading and position entries.
Updates on "iLondon"
As always happen everytime I use something I tend to modify it in the attempt to improve. Let's start from the setup parameters window:
As you can see it's more clean and straight forward.
Updates done:
  1. The box is just 1 fixed color.
  2. No more breakout alerts. (eventually can be re-implemented).
Basically the code now will simply draw the box in all instrument charts, then can be stopped.

Updates on "iLondon_Widget"

Here's the setup window updated and widget appearance:
Read article
Translate to English Show original
s_amira avatar
s_amira 21 June

It is very interesting article! Good job!

scramble avatar
scramble 22 June

Thanks :)

Olkiss70 avatar
Olkiss70 25 June

very nice

Natalia_Kisenko avatar

good article!

orto leave comments
Данная статья посвящена принципу работы, созданной мною стратегии, на основе индикаторов T3 и S&R (ссылка на стратегию ). Также, в статье представлена инструкция, о том, как получить данные по трейдам и индикаторам на историческом тестере (шаг за шагом).
Условие открытия позиций
*Risk % рассчитывается в привязке к SL и каждый трейд будет нести риск во столько процентов от депозита, сколько вы укажете. То есть если SL = 10 pips , a Risk % = 1 то при депозите в 100 000$ объем сделки будет равен 0.01 mio итд.

Когда значение индикатора Т3 меняется с DownTrend на UpTrend и наоборот, стратегия проверяет условие: меньше или равна дистанция от индикатора до последнего значения S&R поддержки(зеленые точки), значению SL SizeLimit, как показано на изображении ниже.
При нисходящем тренде SL SizeLimit измеряется от синих точек индикатора S&R.
Закрываются позиции по ТР или при смене тренда.
Анализ данных на историческом тестере.

Для того чтобы получить данные следует установить настройки как на изображении ниже. *Тестер, по окончании работы, сохранит отчеты и сообщения в папку Документы, на вашем компьютере.
Запускаем тестирование.
Полученные данные, открываем в программе MS Exc…
Read article
Translate to English Show original
FX90 avatar
FX90 29 Feb.

thank you and good luck

Illya avatar
Illya 29 Feb.

Thank you too!) And wish u good luck for the following month!

FX90 avatar
FX90 29 Feb.

@Illya thanks a lot

Natali_Niyazova avatar

Luck for everybody!! Yiiiiha!!! :)

Illya avatar
Illya 29 Feb.

@Natali_Niyazova Right Natali, Luck for everyone!)))Yooopppiiii :)

orto leave comments
There is no mystery that the world is full of patterns and we're governed by them and the financial market are not exception of this rule. The time element such as the time of the day could also play a big role in how certain FX pairs may behave. There is an empirical research conducted by major institutions which suggest that there are strong evidence of a predictable time-of-day pattern in FX. This research was conducted by Angelo Ranaldo from SNB.
The main idea behind this article will be to turn a simple trading pattern backed up by an extensive empirical research into an automated trading system using the Visual JForex platform.
Read article
Translate to English Show original
Metal_Mind avatar
Metal_Mind 25 Apr.

Even though i disregard automated strategy i can say this is one excelent article , with a lot of details  and highly qualitative. Good luck !!!

Mani avatar
Mani 26 Apr.

good job

Faster avatar
Faster 26 Apr.

well done

Daytrader21 avatar

Metal_Mind  Automation has its advantage and disadvantage, it's up to the trader which route decide to goes.

demomailru avatar
demomailru 20 Feb.

"Click on Figure to Enlarge" does not enlarge images for some reason!

orto leave comments

Not more than 3 months ago I've been writing an article about how you can trade the 4:00PM London Fix, giving out an easy step by step guide on how to profit from the price action around that time. You can read more about it here: London Fix Strategy
In this article we're going to make one step further and automatize the whole process by using Dukascopy Visual JForex. This will be one of those strategy that will require no indicators and I'm going to use some of the blocks that I've already been using them in my previous article, and you should be already familiarized with them. I like to keep things simple so in this regard even if you don't have any programming skills whatsoever you will be able to understand the whole process.
Lets proceed first by giving a short summary of our strategy:
  1. Currency pair: GBPUSD;
  2. Time Frame: 1h;
  3. Target= 16 pips. Since beginning of the year the average pips volatility at 4:00PM was around 16.6 pips (see Figure 1);
Read article
Translate to English Show original
MobNaga avatar
MobNaga 13 Oct.

Nice work. FYI, Counter strategy (for GBP/USD) is good between 17 - 25(LondonTime) in last 10 years.

Likerty avatar
Likerty 23 Oct.

I'm sceptical about historical testing of volatility based trading systems as trading already formed candles and ones - still in the making (real-time) produces very different results..

Jignesh avatar
Jignesh 25 Oct.

Congrats Daytrader21 on finding a strategy and automating it, not an easy endeavor.

Daytrader21 avatar

MobNaga Thanks for the info I'll check that out. Likerty So far I've seen big difference between the backtesting results and what I get in real-time environment. Jignesh Thanks buddy.

Stix avatar
Stix 31 Oct.

Interesting and useful Article. Thank you very much. :) :)

orto leave comments
On-line parameter optimization for automated Strategies
Most strategies have parameters to set and depending on the situation, a certain parameter value does best. The result is that most strategies work for a while and then aren't valid anymore. But the entire strategy might not be obsolete, the parameters just need fine-tunning.
Here I’ll show you a way to optimize the parameters while the strategy is running and I compare it to a strategy where the parameters are set once and for all at the beginning of the test period with classical optimization over a period in the past.
When is on-line parameter optimization applicable

Just for the sake of having a real-life example, the method is applied to an automated strategy which I talked about in my previous article this month. However, the method is applicable to any strategy with optimizable parameters. The strategy in question gives a probability that the next movement will be positive or negative:
If you have a strategy that works in the way of the drawing above, you’ll soon notice that having a position open at all times isn’t
the best idea. A better plan might be to only open a position when the probability of a rise is either v…
Read article
Translate to English Show original
Airmike avatar
Airmike 22 Mar.

You can minimize cost of trading by adding an another parameter to machine learning. as limited expected movement. does not make sense to let your algorithms learn from noise. you can increase your profit factor and decrease number of trades. that is a thing I was talking about last time. you used a wrong model for calculation of your costs. cost ratio always depend on volatility (range) and liquidity(spreads)

olga avatar
olga 25 Mar.

Hey, thanks for the comment but I don't realy understand what you mean by the "limited expected movement". I use a minimum movement threshold... however, forex is a noisy time-series, there's no perfect way around it but an LSTM network can deal with noise. As for the calculation of costs, I plain dissagree, high volatility is great but, a priori, you don't know which way the next movement will go so that doesn't impact "cost" it impacts possible profits OR losses. the only things that impact cost is spread and commission, if you didn't have these you could trade "for free" whatever the range.

olga avatar
olga 25 Mar.

Perhaps we only disagree on the interpretation of trading costs.

orto leave comments
Machine learning can help us optimize automatic trading strategies. By studying the huge amount of past information, we can identify patterns that help us predict the evolution of the market to a sufficient extent. This is of course what some traders have been doing for a long time but the automatization of the process allows us to find much better strategies and much faster than it would take a human. Here we propose a speculative strategy that has been successfully tested and demonstrates the possibilities brought by machine-learning in forex.
Automatically finding a winning speculative strategy on eurusd

EUR/USD is a very lucrative pair for a speculative strategy built from machine-Learning algorithms, although our method is able to find winning strategies on other instruments and some that work across several instruments, the strategies developed for EUR/USD give the best returns. This is how the strategies are built.
We cannot feed the actual price to the algorithm because we want it to recognize patterns independently of their height on a chart. We therefore feed it price movements, from high to high and low to low (better than open to close). This is a simple kind of indica…
Read article
Translate to English Show original
Likerty avatar
Likerty 8 Jan.

Interesting article, really. Just a bit of a problem lies in the price feed of the past - the exact levels that are in play - rarely get reaction "to the pip" - more often they get overshoot as the real accumulation is happening just beyond the level (10/40 pips), not exactly at it. So, by studying past price is difficult to find things.. I would rather shoose to look for levels in advance and by watching price reaction to the spot in real time, I can say - is it a correct level or not..

Skif avatar
Skif 11 Jan.

automatic trading - its benefits are well documented!!!

olga avatar
olga 11 Jan.

cheers, I should have said something about the benefits yeah. for me, the major advantage is that these machines don't have emotions like us, but humans manage and test them and they still have emotions.

Airmike avatar
Airmike 12 Jan.

nice article olga. looking forward to next article about machine learning

nick21 avatar
nick21 31 Jan.

Well done Olga

orto leave comments
Hi guys, Thanks for Reading!I have been asked a few times where to find info on how to develop strategies in JForex, there are limited resources available online so i thought to help you guys by creating a few basic strategies over here.There a few different sort of strategies such as:- trend following strategies- trend reversal strategies- scalp strategiesIMHO the easiest strategies to develop are trend following strategies, because usually the take profit and stop loss defined by these strategies are wider than for scalping strategy and therefore their entries points need to be less complex.Enough Talking let's go through your first piece of code/*The following lines are pretty much standard you can just copy them if you wish to all your strategies.*/package com.pipscity;import com.dukascopy.api.*;import java.util.*;import java.lang.Math;import java.text.DecimalFormat;import java.awt.Color;/*The following line define the name of your strategyIn Java the Name of the Class "MyFirstStrategy"also must be the name of the file you are going to if you create a class named MyFirstStrategy you need to save it*/public class MyFirstStrategy implements IStrate…
Read article
Translate to English Show original
ritesh avatar
ritesh 28 Aug.

check out my articles too at

Quant-Trader avatar

Very nice.. I wating for more tutorials :) .. Maybe something with api news calendar.. ? +1 from me ;]

Quant-Trader avatar

In my opinion articles about coding is very very good idea.. write more pls ;)

pipscity avatar
pipscity 31 Aug.

thanks quant, that article was very bad, i will try to make one easier to read in the future, will see when i got time for that ,-)

northernwave avatar

Many thanks. I am going to read all your articles.

orto leave comments