Q1:
Is it possible to create a script/algorithm that will purely place a BUY or SELL order of a selected currency pair, depending on whether e.g. an interest rate announcement is higher ( or lower ) than the forecast figure?
I know many other technical and fundamental factors must be taken in to account before buying and selling financial instruments, but purely as an experiment I'd like to determine if this method is possible.
If this can be achieved,Q2:
how can an interest rate announcement be embedded straight in to a script, so that once the figure has been released the BUY or SELL order is immediately executed?
Note: This will only be used on a demo trading account.
Previous alternative attempts to execute positions based on a fundamental data price reaction:
- Setting up an automatic BUY and SELL orders, just before an interest rate announcement, and allowing a significant up or down price movement in one direction to automatically open a position ( the disadvantage with this is that the position is usually opened too late ).
A1: IF ...
Yes, it is:The idea is doable, however several externalities make it very sensitive to factors out of the scope your code can control.
Network transport latencies are not your worst enemy. These account for some
0.1 - 200 ms
, depending from which location ( over which connectivity / services ) you try to source some remote / distant information and process them locally. For colocated hosting, this would be on the shorter end of this interval, for COTS office equipment this would be on the longer end.Application-based transaction processing latencies are the next, more dangerous ones. Every
XTO
transaction is not happening in zero-time. The respective delays ( latencies ) are typically regularly recorded / monitored so as to have a in-vivo latency envelope for respective Market Access Agent / Broker Office. Figures vary,so does their over-relaxation
in the order of several orders of magnitude during Black-Swan event periods
or under high transactional load periods /
XTO
-traffic-storms.Spurious spread explosions
are your worst,
while still hidden
from many views,
enemy. On Fundamental News announcement, as you have reported above, you feel the time, but the hidden danger is not the linear time ticks, but the explosion of spread, i.e. the PriceDOMAIN area, where no-one can place / execute a trade ( an
XTO
) to be filled, or a an explosed Trader's Margin Attack anybody has to carry, if there is an Equity exposed to a market risk during such period of time.Translated into a plain english - no-one is principally able to click a button "in-time" after a US NFP and similarly seismic News announcement.
A2: HOW ...
The algorithm will communicate with the news providerThe embedding is not the right expression, your algo-trading will have to become a part of a distributed-processing system, that altogether will form the trading-infrastructure.
Market Data Feed -- which delivers quote-stream updates to your local processing
Market Access -- where you place / cancel your
XTO
instructionsNews Feed -- where you source macro-econ news from
Technical means used for sourcing News Feed's data are typically based / dependent on the agency commercial offerings / API specifications. While one of common FOREX trading platforms, the MetaTrader Terminal does offer a News service, mediated from Broker, one shall sooner or later realise that waiting for a Broker to re-publish the news is a dual-edged sword, because if your Broker / their Risk Management Control trades "against" one's positions, they have an unfair advantage of delayed announcement without any associated risk, which is not balanced into an equally fair, decision-making position for traders, who have their equity exposed to market risk. Next, your algorithmic tools have no News-reading API/interface to handle these events fully agorithmically once delivered into your localhost realm of MetaTrader Terminal so you will in either case remain dependent on external news-stream processor, that communicates with your code, in case of MetaTrader Terminal the
MQL4
-code in a distributed-system manner.Having this said, your algo-trading strategy can cooperate with News Feed and execute decisions based on the content, published automatically ( typically faster than after the same announcement got fetched / evaluated / ( delayed ) / re-processed / re-published via other tertiary processors ).
The key in this is a viable
XTO
& failure-remedies strategy, to escape both the time-trap and the exploded spread-trap.Good luck & aim well
on this
ultimately thrilling hunt!