Some smaller improvements

124 views
Skip to first unread message

Klaus

unread,
Jul 31, 2016, 4:16:40 PM7/31/16
to JBookTrader
Hi, 

I am not sure, whether there is still anyone using JBooktrader. 
However, I would like to report on some smaller improvements, I recently made. 

a) Sometimes it does not make sense to analyze all possible combinations of parameters in optimization. 
(e.g., if the parameters are symmetrical this would lead to a double analysis)
For this I added a method to strategy.java

    // KS: added 160727 - to exclude incorrect parameter value combinations

    public boolean eligible() {

    return true;

    }


This can now be overloaded in your strategy as you like.
In the call-method of the OptimizerWorker I added a corresponding if-statement:

                    

                    if (strategy.eligible()) {

                    strategy.setMarketBook(marketBook);

                    strategy.setIndicatorManager(indicatorManager);

                    strategy.setIndicators();

                    strategies.add(strategy);

                    }

                    else {

                    // System.out.println("Strategy excluded");

                    }


The inner part of the if is the original code.

b) It is sometimes also possible to work with a reduced dataset (I typically gather all the data (24/7) and then just extract the relevant data. - However, often it is also sufficient to use more coarse-grained data for optimization. (this leads to very significant speed-ups) - Of course this depends on your specific indicators whether that is meaningful, and in many cases at least the parameter values need to be adapted in order to make use of such an approach. 

I use a simple R-script in order to make this extraction. The following script extracts only the entries with second "00" and also restrict the time of day. - You can adapt it easily to your need. 
A downside of the primitive script is: at the end the first 10 lines need to reinserted (and the line from the dataframe removed)
#!/usr/bin/env Rscript
args = commandArgs(trailingOnly=TRUE)
# print("Reached 1")
if (length(args)!=1) {stop("the filename needs to be given", call.=FALSE)}
# print("reached 2")
df <- read.table(args[1], skip=10, sep=",", col.names=c("Date","Time","Balance","Price","Volume"),colClasses=c("character","character","numeric","numeric","numeric"))
# print("reached 3")
dfr=df[df$Time>"080000" & df$Time<"170000" & endsWith( df$Time,"00"),]
write.table(dfr, file = paste(args[1],"B",sep=""),sep=",", quote = FALSE, row.names = FALSE)

In order for such an approach to work, it is also necessary to adapt the MIN_SAMPLE_SIZE definition in the IndicatorManager-class. (originally 60*60, here set to 10)

    private static final long MIN_SAMPLE_SIZE = 10;// 60*60; 1 hour worth of samples

Actually, a much better approach would be to proclaim the need for data in units of time by the various indicators, the framework would gather this and take it into account. But this would have required deeper changes.

Again, whether such a scaling is useful appropriate depends very much on your specific strategy and indicators. 

I hope someone finds this useful. 

Klaus



steve....@gmail.com

unread,
Aug 1, 2016, 5:09:01 PM8/1/16
to JBookTrader
Hello Klaus:

Where can I get some Win32 binaries to run this system, it looks great, but I cannot get it to run!
I have tried Eclipse 3.3.0 and 3.8.2 but keept getting errors with JRE 1.7 and JRE 1.8.

Any chance you could post links to some compiled and ready to run binaries???

If so, I will share trading systems and ideas that I develop with it!

Right now I use Quantshare which is OK, but I prefer something where I can run different copies on different machines without all the LICENSE hassles!

Judson Wilson

unread,
Aug 2, 2016, 12:30:04 AM8/2/16
to jbook...@googlegroups.com
Maybe you should post the errors?

--
You received this message because you are subscribed to the Google Groups "JBookTrader" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbooktrader...@googlegroups.com.
To post to this group, send email to jbook...@googlegroups.com.
Visit this group at https://groups.google.com/group/jbooktrader.
For more options, visit https://groups.google.com/d/optout.

Ali Farahani

unread,
Aug 2, 2016, 12:36:40 AM8/2/16
to JBookTrader
Hi Klaus,

I still run JBT (mostly in Forward Test mode). The only indicator I use is Force (Tension). Is your improvement meant to create a better (more efficient) framework to optimize parameters Period, Scale, Entry, and Exit?

Best,

Ali


On Sunday, July 31, 2016 at 1:16:40 PM UTC-7, Klaus wrote:

Ali Farahani

unread,
Aug 2, 2016, 12:46:16 AM8/2/16
to JBookTrader
Hi Steve,

Let's start with the version of Eclipse you are using.You should be using version 4 of Eclipse (Kepler, Luna, Neon). I recently compiled JBT on Neon and it works without errors.

Best,

Ali

Klaus

unread,
Aug 2, 2016, 12:41:56 PM8/2/16
to JBookTrader
@Steve: you should be aware: jbt is a do-it yourself framework: it provides functionality for running and creating strategies. But there are no easy strategies to use: you always have to create your own using Java.
(So, you should be experienced using Eclipse and programming in Java.)
That said: please post your relevant setup and any precise error messages, so we can help.
Please also state: how far did you get in the setup guide before the first divergences occurred.

@Ali: It is mostly support for eliminating some redundant strategies during optimization (how many there are-if any- will depend strongly on the strategy and the parameter ranges). Regarding the second optimization (using a subset of the data): it will basically be like averaging. You may use it for example for doing a first analysis with coarse grained data, then a second with fine grained in the areas of interest. 
The adaptation of the parameter (if any) would depend on the specifics of the indicators / strategies, so basically you have to do it by hand. 
For example: if you want to do a 10 minute average, this would be with a coarse-grained removal (like my example - one data point / minute) for a 10-minute average that the value 10 would correspond to 600 (10*60 seconds) on the fine-grained data.
(In the case I am deriving it there is actually no difference, because the parameters have absolute meanings in time, not periods of time, hence the same values apply.)
I hope this explanation helps.

Cheers
  Klaus
Reply all
Reply to author
Forward
0 new messages