26
Aug
09

How open strategy in Dukascopy JForex platform

First of all you need login into JForex platform using your username and password.
Strategies management tree located in ‘Workspace‘ panel which usually placed in left lower corner.
You should see leafs ‘Currencies‘, ‘Strategies‘ and ‘Charts‘. ‘Strategies‘ – this is what we looking for.

Lets say, you have code of your strategy opened somewhere in text editor from where you can simple copy and paste him.

Do right click on ‘Strategies‘ leaf and select ‘New Strategy‘ item.
JForex platform will open new editor window with some initial strategy template.
This template is useful when you need start development but as long we already have code we can dont heed him.
Clear edit area by deleting template.
Copy all code of your strategy into buffer(hint: to select all use hot key Ctrl+A) and paste him into JForex Platform editing area.

Once you did this save the strategy pressing ‘Save‘ button or using hot key ‘Ctrl+S’.
Name of your file should be the same as name of main class of your strategy.
You can get this name looking in the beginning for the code where you should find something like this:

 public class MyGreatStrategy implements IStrategy {
 ....

In this example you need save file under name MyGreatStrategy.java.

Another way add your strategy in platform is open saved file from hard drive.
To to this select ‘Open Strategy‘ from menu and find file with code.

Now lets check is our code bug free and at least can be compiled.
To do this right click on ‘MyGreatStrategy‘ and select ‘Compile‘.
Doing that you will transform your strategy in binary form acceptable for execution of JForex Platform and in same time do code verification for syntax errors.
Depends on size of strategy compilation may take some time.
Results(good or bad) you able to monitor in ‘Messages‘ tab which will change color of title once process is finished.

Imagine that we are leaving in ideal world and everything was ok this time.
From that point we have 2 directions – do historical testing(‘Test‘) to verify logic or go trading(‘Run‘).
In most of the cases we suggest test what you have before trading.
Yes, historical tester not cover full picture and sometimes his results far from the real market situation but he can show is behaviour of your strategy is meet your expectations.

Sometimes you need external libraries which was supplied with strategy code.
In our example additionally to standard Java classes we use extra libraries: axonsoftware-jforex-utils.jar and spread.jar

To include this files in compilation you need provide full path to them in special tag @Library separated by ‘;’ e.g.

 @Library("c:\\extra_libs\\axonsoftware-jforex-utils.jar;c:\\extra_libs\\spread.jar")

Hint: use simple paths like c:\\extra_libs(or /home/user/extra_libs on Unix/MaxOS) this will reduce quantity of errors

Another important thing is adding symbols which is using in your strategy.
Dukascopy JForex platform allow you manage subscriptions for symbols what mean that market updates will be send to you only if you subscribed.
If you strategy working with EUR/USD, USD/JPY and EUR/GBP – dont forget to include them in subscriptions.

Original source

30
Jun
09

Working with Dukascopy FIX Gateway

My first impression from Dukascopy FIX Gateway was something like ‘wow’. Very simple to use, fast and efficient. They[Dukascopy] provides great services and their IT team very very benevolent and willing to help.
All this great when you need develop something simple – place market order, place stop order, cancel something etc. But sometimes clients want to have same functionality which JForex provides but through FIX protocol – positions management, S/L and T/P on positions and so on. You`ll never find this on Dukascopy FIX Gateway(from the scratch this working on FXCM FIX). So if you want some high-level features – please, implement it on your own side. And we did this. I very proud of developed solution. Right now our trading API supports positions and S/L and T/P for Dukascopy. This conditions was realized using Stop and Stop_Limit orders. We handle links between orders on our side and performing some actions if situation changing.
Lets say, you manually close market order from terminal. Our API will cancel linked Stop and Stop_Limit orders automatically.
To be honest there are a lot of things to do, such automatic Stop and Stop_Limit size changing in case size of position was modified. I will update blog once we will implement this functionality.

20
May
09

Axon FIX LogViewer is Out

Axon FIX LogViewer

AxonSoftware company announces about release of Axon FIX LogViewer, utility used for the analysis of log files in the FIX-notation.

Axon FIX LogViewer can be useful:

  • to programmers developing applications which using FIX protocol
  • to support engineers who are responsible for maintenance of FIX-compatible solutions
  • to people studying FIX protocol as gives the chance to display all exchange of messages visually

Main features:

  • support of all versions of FIX protocol
  • ability to read custom fields specific to the brokers
  • work with several logs windows in same time
  • message filtering on load stage. You can load messages from file inside specified time frame or/and message type(e.g. exclude MarketDataSnapshotFullRefresh)
  • correct analysis of repeating groups any level of enclosure
  • filters based on message types
  • flexible log view table configuration. You able to select which fields of messages should be mapped into table. Your selection will be remembered and available after restart.
  • export of selected data
  • list of recently opened files
  • saving of customisations of tables and layouts of windows after reboot
  • cross-platform(will work on Linux, Win and Mac)

Original source is here

04
Feb
09

Few words about FXCM FIX protocol API

FXCM and FIX Protocol logosOne of the best FIX API for retail trading we ever use was provided by FXCM.
I am not trying to affiliate FXCM Corp, I just want say big thanks for their engineers and mangers who was working under that great solution. Maybe this small review will help people make right decision about programming interfaces.

So, what so great we have find out?
Any version of FIX protocol provides big set of messages, useful for traders(and for developers too). Things is that most of the brokers implements only very limited quantity of them. Yes, FIX protocol not force you to do this, you free provides only some basics which allow you to tell – ‘look, we also have FIX interface’.

Lets say broker X(sure, you can replace X with someone familiar to you, there are a lot of around) can process NewOrderSingle for Market, Stop and Limit orders(plus some limitations), OrderCancelRequest(to cancel pending orders), OrderCancelReplaceRequest(to modify pending orders).
From their side broker will response using ExecutionReport, OrderCancelReject and Reject, plus market feed streaming with MarketDataSnapshotFullRefresh(not all provides market feed through FIX protocol).
Looks like this is enough to trade.
Open orders, receive confirmations, modify and cancel….
From point of view of trader – yes, this is good enough.

But is this list of messages enough to build stable and robust trading application?
I think no. Why?
Behind of high level abstraction like open order developers have tons of nuances like stability of network communications, transmission latency, problems of synchronization to keep integrity of trading information.

Today most of us have good and reliable Internet connection but even now sometimes something going wrong and connection can disappear.
After several tough call to your ISP link is up and this is great.
But using described above list of messages you simply cant restore your current status of order book.
We can suppose that nothing was changed and all your orders still open.
This way is like jump into the dark. Second – open broker’s trading terminal and ‘manually’ check/sync orders with your application.
This sounds like a bad joke but few months ago one broker suggest me do this.

Why we like FXCM?
They provides rich FIX protocol API for developers and integrators.
You can track status of your orders/positions and accounts in real time.
You can sync trading history, you able to receive orders book(full or with some conditions), send messages to deal desk using Email message, ask to re quote market orders, get market depth for select symbols.
Yes, this is not all functionality which included into FIX 4.4 but this is good enough(at least for us).

To summarize FXCM FIX API functions:

  • open/close positions
  • open/modify/cancel conditional orders
  • synchronize positions
  • synchronize conditional orders
  • receive updates about accounts statuses
  • work with market feed(subscribe, unsubscribe, receive market prices)
  • check security statuses
  • send messages to deal desk

Honestly, we not using all of this functions but better to have them than constantly send requests to broker and ask ‘when we will finally have this’ and receive standard ‘we working under this’.
FXCM FIX API is not ideal and have some weak sides(from my point of view and this is definitely another story) but you can close eyes on this because their provides one of the best API for integration.
Their API can be a educative example for another developers which working under sell side functionality, for the integrators it a good prize:)

Original article located here

26
Dec
08

Indicators framework

Indicators is the one of widely used instruments for financial analysis. Almost each trading(manual or automated) platform has support of indicators. This article is our point of view on task how indicators should work inside application.

Preconditions for creation of separate component for indicators calculation:

  • different trading rules may use the same indicators.
    There situations even applying the same parameters. There is no point perform calculation of the same data from different places of application, if it can be done centrally.
  • calculating the value of the indicator is a painstaking task, in which involved mathematical operations and interaction with the repository(s) of historical information.
    Unavoidable time delays that may adversely affect the productivity applications, when the same indicator used from different places of application

Possible architecture

Indicators service can be a separate thread(s) responsible for interaction with subscribers (registration of new requests for indicator calculation, issuance of the latest targeted data on demand, removal of the subscriber), working with repositories of historical data and the direct calculation.

Steps:

  1. Client sends a query, which indicates that it should expect an indicator H with parameters A, B, C. These actions can be performed, for example, the section Init of trading rules.
  2. Service adds a request and increases the count of subscribers. If it can not be register (for some reason) than throws the exception. Upon receipt of the exception system should block all accounts signed by given trading rule.
  3. With the arrival of market prices indicator service should calculate values according to subscription.
  4. To get latest calculated values of indicators, application should use interface, offered bu service. If request contains indicator or settings that were previously not register, service must return an exception. In handling this exceptional situation can be, depending on location, to register / subscribe to the indicator. As a result, following successful.
  5. Upon completion of work (for example, the account given by trading rule, was blocked) must submit a request to make a come-off.

Exceptions

  • Error while registering a new request for calculation indicator
  • Error treatment without subscription
  • Error calculation indicator. Incorrect data

Original article locate here

    15
    Nov
    08

    Automated trading system. Widely happens errors. Part 1.

    Today possible find plenty of commercial and few free(or de bene esse free of charge, if will want) automated trading systems for Forex. Their rapid grow is explained by increasing speeds of data processing and similarly by a difficult mathematical formulas, applied at an analysis. I will not jut out into reasonings about the questions of efficiency of one or another strategy or software, its realizing.

    It is ungrateful pastime and there is a risk to be reputed a man, using black PR in the aims. My reasonings will carry rather a technical tint and potentially can help you at a choice or planning a new software. In latter days we had to do some the work with set of automatic systems of third-party developers and I marked on your own some vexatiously mistakes. I will make attempt tell about most considerable.

    End users

    Textual programming language now almost always present in entry or middle level trading systems. He can be used for strategy coding or/and for extending of existing functions of application(e.g. – creation of new indicators). This is wonderful possibility! Question is for whom. In many cases developers forget who will be end user of their product. That’s why we have systems where strategies are written on C or C++. I personally don’t see problems here but thing is that I am earn by programming, not from trading. Trader is not a software developer and he don’t have time to dive deep in shading of C programming. No time, no desire, no mood.

    Certainly, when manager will try to sell you that type of system, for sure he will tell about high performance and such kind of things. Yes, this is a true. C++ unambiguously faster than scripting languages. But reality is that in 80% of cases you will not have and advantages of more faster system. How many orders do you plan process simultaneously? How many accounts to manage? 1, 10, 100, 500? We successfully did applications on Java which handling thousands of orders on usual computer. Yes, if you need to work with 10 000 of orders – superfluous productivity will not injure, but, probably, out-of-shelf system will not meat your requirements and you will use something custom, created especially for you, application.

    If you unable to develop strategy personally, you need search for external consultant. And here you will be surprised by level of prices! Good C developers expensive. What does remain except to appeal for help to the company what developed and sold you software? How do you think why they used C or C++ :) ?

    My personal opinion is that using scripting languages like Ruby, JavaScript, Perl inside regular trading system is absolutely normal solution. In many cases this languages is only high level wrappers around native application libraries and play role of glue. As for extending system itself by adding new features – here better not sacrifice speed and use native language of platform. If it C – better write on C, Java – on Java and so on.

    Original source here

    11
    Oct
    08

    IPhone too young for business…

    Several months ago we made a decision create web based remote administration tool. We plan use this panel to control main parameters and get statistics information from execution core of automated trading system. Of course, not all of them, only more important like status of FIX connections, ability to stop/start processes, read uptime and used resources. Web pages was tuned special for Apple iPhone according to their HTML Guide.

    To prevent unauthorized access to web pages, we configure Apache web server to grant access to clients only with pre-installed special pki keys. Yes, weak place of such system is if someone stole your phone he will have access to system. But as long it was only prototype we just postponed implementation of more serious access restrictions.

    But then come big disappointment. First was ‘backdoor’ confirmed by Jobs. I dont know how about rest of humanity but I personally and our clients feel not very comfortable because of some one can trace or even control our actions. I am sure that Apple will not use private information but where guarantees that ‘backdoor’ soon will be not ‘open’ by smart guy? And our private data will flow to unknown direction…This scares.

    Another nice surprise happens with me personally few days ago. I also using iPhone(honestly, I was the one who push idea use iPhone as control point to customers…This was my big mistake). One wonderful morning I have found out that my big contact book disappear. Phone showed to me only one number – my. Probably to alleviate disappointment – look, you dont lost all numbers. Obviously, here partially my mistake. I always though that cell phone – dramatically stable thing and never made backups. Why should I do this if all my previous phones working for a years without any problems. Yes, they was not so pretty looking, without touch screen and MP3 player. Is MP3 and touch screen can balance the scale with stability? Not for me for sure.

    Phones become more feature rich, bit vendors trying to move responsibility of pure testing/buggy firmware from their R&D departments to you and me. You need permanently backup your contacts because we cant make out applications stable enough.

    Here all depends for what you need your phone. For me phone is only instrument, not the part of image. Our clients just want do their work without risk lost some information or be hacked one day.
    Even with personal use bugs are annoying, what to say about business? From our point of view Apple tried gain the market, it was rush – be the first with such phone, and they reduce testing time. Maybe this is wrong opinion. But for sure we will not recommend iPhone for our clients because he too young for serious business.

    23
    Sep
    08

    Real time monitoring system Axon Monitor

    What reliable you would create software, what steps would be undertaken by developers for maintenance of reliability and stability of work of applications – there is always will be possibility of errors occurrence and problem situations.
    Further all depends on application sphere: the mankind can quite endure failure in your photos gallery management tool but failure in the control system of Atom power plant or in exchange server can carry rather unpleasant consequences.

    Errors will arise — it is necessary to accept it as an axiom.
    Hard disks and memory fail, the network equipment and communication channels refuses, disk sections are overflowed, there are failures in fulfilment of applications in a consequence of arrival of the incorrect data — this list can be continued eternally.
    It is important to be able to react in right time at approach such here non-staff situations.

    Most our clients are financial institutions.
    Our experience has poured out in creation of tool called Axon Monitor intended for the centralised console to for collecting and processing status information from various sources.
    Using the uniform console, technical support engineer can trace a condition of a considerable quantity of the services started on various servers and computers.

    Architecture

    In the center of Axon Monitor located data transfer bus which generally are message exchange server.
    Axon Monitor architecture
    Currently there is a considerable quantity of solutions quite successfully coping with a problem of the data transfer.
    The experiments made by us have allowed to choose the optimal (from our point of view) from them.

    Server tasks include message transfer from applications into the central console of monitoring system.
    Necessary to notice that it is possible to connect more than one console and everyone can carry out own problems.

    Using configuration utilities, possible to set reactions on events of certain type, e.g send SMS to manager Y if value X has exceeded some threshold and so on.

    Basic features

    • Ability to create groups from users(e.g. support engineers, managers)
    • Ability to manage schedules. Functions to bind to time intervals individuals of groups of users
    • Support several types of messages from remote/monitoring systems: HEARTBEAT, INFORMATION, ERROR, CRITICAL_ERROR
    • Several ways of notification:
      1. On central console
      2. Sound alert from central console
      3. E-mail alert
      4. SMS alert
      5. Alert through Jabber protocol to IM.
    • Support of several types of message bus:
      1. Spread
      2. RabbitMQ
      3. ApacheMQ
    • Embedded language which allow create own callbacks on alerts
    • Standard set of alerts
    • Easy to use API which allow add support of your own services in short terms

    Article original locate here

    15
    Aug
    08

    FIX log analyser

    If you are engaged in development software for trading systems there can be a necessity of the FIX engine log analysis. There are a lot of reasons, the most simple – define how much there correspond parameters of the developed application of the validity. This mean: your database speaks you one supposedly warrants, openly have been sent so much so much, closed so much, and actually all can be differently. If the parameters received at the analysis of a database will differ from the parameters received at the analysis FIX engine logs – it is time to sound alarm. Someone says lies, and most likely this someone – your application:).

    Log file of FIX engine usually represents a set of text lines. The choice of the tool for their analysis has come at once – certainly, Perl:). One of problems consists that supports FIX for Perl simply are not present. There is a plenty of the servers written in every possible languages (basically, it Java or C ++) among which it is possible to meet even Ruby and Python (I so understand, the craze), but hotly favourite by us Perl is not present. All right, not a problem. We can write analysis of text data even if there are no working on Perl engines.

    There was a problem of analysis of a file for trades with one well known forex broker. The basic application from our party has been written on Java with use of QuickFIX/J engine. Obtained trades data are stored in the separate file which growing quickly enough. At the moment of start of a test script the size of log file exceeded the 1.5 GB. The script run on all lines, choosing all necessary types of the message and analyzing conditions of orders has been developed really quickly. The result (for a day) is printed the report of a sales volume with format usage.

    The script is not ideal in view of a hardcoded binding of variables and there is a direct dependence from our broker (they have a little expanded standard protocol with the own types of variables) but the general idea is more or less clear.

    In any case the script has made the work and has made it quickly. I think that the choice Perl as the tool of the analysis was more than is justified in view of speed of development and the general code understanding. Conclusions – I was very happy.

    Source code and original article located here

    02
    Aug
    08

    Axon FIX Debugger is out

    Someone has told what simply enough to write base application which using FIX protocol but much more difficult to force him work without mistakes. The basic problem consists that you need cooperate with software where you almost don’t have opportunity to influence on it behaviour. Lets say, you make integration with FXCM, Hot Spot, DGCX, DukasCopy or any another exchanger. You can send FIX messages and will receive on them answers. By laborious work and selection of messages you can check up all possible situations which can arise during the real trading. But nevertheless there is a probability, that some sequences will be missed and will prove only at use in production.

    Engineers of our company (AxonSoftware) constantly involving in integration development and constantly collided with greater time losses at debugging FIX components of application. The received experience has poured out in realization of the program under name Axon FIX Debugger, intended for simulation of behaviour of sell side. What advantages can be received using Axon FIX Debugger? Here some of them:

    • ability to simulate work of sell side on the basis of versions 4.0, 4.2, 4.4 of FIX protocol
    • ability independently form messages which will be sent to your application
    • ability investigate trading session in a graphic kind. Debugger will give you the list of entering and proceeding messages with breakdown on fields
    • built-in programming language, allowing to set as much as flexible answers on messages coming from your side

    Main principles of work

    Axon FIX Debugger are tiny sell side application with the graphic console and some additional opportunities. At start the debugger creates session and expects connection of the client. As soon as session is established, the client application can start send FIX messages. Received messages will be displayed on the screen. The debugger will allow you to familiarize with contents of each of them in more details.

    Developer can independent, at any moment, generate any message and send it in the debugged application. For interactive interaction the opportunity of the task callback – functions which will be called by debugger when client will send FIX message which we looking for.

    Basic features of Axon FIX Debugger

    • Quantity of simultaneous client sessions: one
    • Graphic debugging panel, allowing to study messages
    • Sending the messages to the debugged application in a manual mode
    • Ability to bind callback functions on any entering FIX message
    • Built-in programming language, allowing to form answers of any complexity
    • Editor with syntax highlighting and opportunity to include created patterns of a code (code snippets)
    • Delivery with a standard set of answers
    • Built-in help system describing the basic functions of the programming language and containing examples of their usage
    • Editor, allowing to make changes in standard FIX protocol – enter new fields and values
    • Multiplatform. Axon FIX Debugger it is capable to work on Linux, Win32 and MacOS

    Original content is here.