DEV Community

loading...
Cover image for How to make forex Bots (signals) Using Programming

How to make forex Bots (signals) Using Programming

charlygarcia120 profile image Carlos Alberto Updated on ・4 min read

I want to show how to write code to make your own Forex Signals, based in your statistical criteria, for help in the forex contracts with any CFD.

Alt Text

First of all, you need to understand the context.

We need

1 A computer for host the application(hosting)
2 Select a data provider
3 Make the code for save the raw data from your data provider
4 Make your own strategy using you own saved data
5 Make an algorithm for your strategy
6 Save the events (signals) for your future backtesting
7 Select a cron service or use your own
8 Take snapshots of the graph to add to the signals
9 Save the signals, and send this to a telegram channel, or to a email (emails)
10 Show the historical list of signals created by your system.

Step by step explanation.

1 A computer for host the application(hosting)

A host is a computer in the internet that allows to upload files , to make it public, or private (this is the mean of server) , there are many providers and you need to select one using criteria like:

  • Programming languages
  • Operative Systems
  • Aditional services
  • Data transfer
  • Connectivity (Network)
  • Hard Drive space (dedicated , share or VPN)

Comparation of hosting providers

2 Select a data provider

You need to choose your data supplier
The data rates must be in the correct frame time for your algorithm , (1 second, 1 minute, 15 min , 1, H,4H, daily, etc ) and this service must work and be updates updated every Second (or your selected time frame) in real-time, you'll get all the major Forex Currencies in Machine Readable format (JSON & XML syntax). For each currency that you want, you need the Rate and also the timestamp when it was last updated.

Some data providers:
1forge.com service
Intrinio.com
rtfxd.com

3 Make the code for save the raw data from your data provider

If the demos of the connection with your data provider are working good, you need to make the code for save the data into your own hosting , and this can be done using these options

A Flat files
B Database records

For flat files the best option is using perl (Practical Extraction and Report Languaje), and for database records (mysql , postrgress, MariaDb and many others)

4 Make your own strategy using you own saved data

You need to be able to understand the time series indicators, or develop you own indicators.

Forex technical indicators consist of mathematical calculations that forex traders often use based on the exchange rate, volume or open interest of a currency pair. Technical traders who operate in the stock market typically look at the price of a stock, but forex traders look at the exchange rate of a currency pair. The majority of the major forex indicators are computed from exchange rates.

The four fundamental types of moving averages that forex traders frequently use in trading currency pairs and for general technical analysis purposes are:

Simple moving averages
Exponential moving averages
Weighted moving averages
Smoothed moving averages

in this URL you can see an explanation of this:

A List of best forex indicators

5 Make an algorithm for your strategy

You need to make arrays in your programs and, to apply statistical methods, or your own statistical methods for this array, searching patterns or rules that show a special characteristic of your own rule.

Alt Text

Example: The last 3 candles have a X% percentual change of the last 30 candles, and the min and max of the 10 last candles have ..... bla bla bla

this is the core of the method, I think that this is the most important, then you need to familiarize a little with time series analysis, the mathematical methods and numerical methods (flow diagrams and algorithms) to make your automata make this automatically.

I will to recommend to you the next URL to understand the time series analysis

Complete guide to time series analysis and forecasting

6 Save the events (signals) for your future backtesting

When you make a signal from any of your strategies you need to save the timestamp, the value, the recomendation, of the signal , for make backtesting in the future, this is the key.

Alt Text

The previous saved data is the history for benchmarking the past signals generated for your bots, the signals tat are being generated in the present are the supply for the future analysis of the present. (the present will be , the past in the future, then you can connect the dots and you will have a more holistic scope of the thechnical and fundamental analysisfor the instrument and the time).

7 Select a cron service or use your own

If your hosting account has a cron service, then you can schedule the scripts that get de data from de data sources, the cron for make the evaluations of the criteria over the data, and the cron for make the forex or crypto signals.

Alt Text

If your hosting don't have the cron service, or this is not very exactly, then you need to use the service or a third part, like this:

THIS ARTICLE IS IN CONSTRUCTION

Discussion (3)

pic
Editor guide