JFUtil is a Quantisan.com open-source project focused on reusable JForex trading strategy components. Latest version is 2.1.3 released on April 8, 2011. Please keep your local JFUtil library up to date for the latest patches and features.
1. Access to IContext and IAccount from anywhere in your project files. The one and only JForexContext object in JFUtil is a thread-safe, singleton object which can be called from anywhere within your projects, across any class file. No need to declare global IContext variables. No need to pass it around in parameters.
2. Simplify order submission with ticket builder. Set your trade order parameters with an order ticket object using a builder constructor. You can build ticket with as few or as many parameters as you like. All with intuitive method names in the same ticket class.
OrderTicket buySpTicket = new OrderTicket.Builder(label, instrument,IEngine.OrderCommand.BUY, 0.1) .setStopLossPrice(stopPrice) // set stop price to ticket .setTakeProfitPrice(targetPrice) // set target .build();
3. No more confusion about indicator methods. Indicators are encapsulated into their own bean object with their full function name and parameters are set using intuitive, clearly described methods.
// get an EMA indicator value by building an indicator bean MovingAverage maBean = IndicatorBeanFactory.getMovingAverage(); // then sets its parameters with obvious method names maBean.setAppliedPrice(IIndicators.AppliedPrice.MEDIAN\_PRICE) .setMAType(IIndicators.MaType.EMA) .setWidth(14); // all of these are optional parameters // feed the bean into a generic calculation method to get the result double ema = Indicating.calculate(instrument, Period.ONE\_MIN, maBean);
4. Implicit multi-threading for ordering. Ease your main thread's workload for processing incoming data and avoid your order manager holding up the traffic. All automatically performed in the background without extra coding for you. 5. Built-in popular numerical functions for forex trading. Calculate expected profit or loss in your account currency. Saves you from writing boilerplate codes and reinventing the wheel. 6. Continuous improvements! JFUtil is continuously being improved based on feedback from traders like you. See the changelog below for major changes since the initial release in November 2010.
To best illustrate how JFUtil can make your JForex programming life easier, see this JForex strategy source code example.
Download the latest JFUtil library jar file including the javadoc for your own use (use the @Library annotation in your strategy) or fork the project at Github to participate in this open-source project to make programming trading strategies in JForex easier for everyone.
Please report any issue or discuss your question or recommendation in the [comments section below]. Alternatively, you can contact me directly.
v2.1.0 - March 22, 2011 - indicator bean, label maker v2.0.0 - March 8, 2011 - singleton access to JForex objects, order ticket building, global currency conversion, global printer utility. v1.0 - November 24, 2010 - JFUtil 1.0