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
Do not worry dear reader, I do not want to scare you by some horrible stories about killing monsters that must be stopped, I'd like to bring your attention to machine learning and also would like to apply and demonstrate some basic neural network sample showing the way how to apply it over spot forex data aiming to predicate future (one day) return.
In recent time machine learning has started to be using as buzzword in many areas of human activities and currency trading does not stand aside. Machine learning has started to be introduced as tool of the future. From trading perspective one can have impression that with regards to machine learning new age is opening before us, because everything seems to be easily driven by some machine learning magic, whatever it means, and so trading also. These ideas are easy to claim though hard to proof them and find an evidence how it could be applied to trading correctly and also if it is possible at all. Another problem is that many people and traders tend to see machine learning like some black box where time series is passed at one side and after some processing by magic machine learning algorithm the super accurate prediction drops on othe…
Read article
Translate to English Show original
Natalia_Kisenko avatar

useful article!

iiivb avatar
iiivb 17 June

though barely understood the programming thing... was super interesting!

mcquak avatar
mcquak 18 June

iiivb thanks alot, appreciate your comment

mcquak avatar
mcquak 18 June

Natalia_Kisenko thank you Natali for stopping by and read the article

mcquak avatar
mcquak 30 June

I'd like to thank all above comments creating great creative atmosphere below my article! And thanks to Dukascopy making this discussion to be possible!

orto leave comments
In my recent article I’ve introduced R and its basic abilities towards FX trading. In this article I’d like to persuade you, that R is really good tool for manual as well as algorithmic traders and that it’s worthy of your attention.
SIT and R
Let’s assume we have found strategy that looks pretty good on first sight. How would you back test such strategy? By looking on the charts and calculating everything manually or by spending your time with writing some C# or Java quants and algos applying the strategy on historical ticks? I’ve used both these techniques of back testing and I’ve realized I was wasting my time testing that way once I’ve found and learn R and Systematic Investor Toolbox (SIT) [1]. SIT is open source library available on github that can be used for investment research. With R you can test new strategy nearly instantly. With R and SIT together you can back test absolutely instantly.
Strategy for the test
For the sake of simplicity and readability of this article I’ve chose really simple strateg[/1]…
Read article
Translate to English Show original
Nihad avatar
Nihad 20 Jan.

Kaplar's work or SIT on the top of R has one day forecasting feature using GARCH, I would be interested to see a one-day forward tests for any forex instrument of your choice. Its possible for Stocks and Indexes on SIT, but would like to see if it is possible for Currencies using SIT. Thanks for Sharing

Vitalinka_Pavlenko avatar

great job

mcquak avatar
mcquak 26 Jan.

Nihad thank you. Do you mean this Kaplar's article?

isbar avatar
isbar 29 Jan.

very interesting

Legacy avatar
Legacy 31 Jan.

I am new to the Dukascopy platform and have no knowledge of how to load the code. Can you assist please?

orto leave comments