binary-com / binary-bot

Visual automation for binary.com
binary-bot.binary.sx
MIT License
232 stars 523 forks source link

BackTesting candle strategies #1232

Closed mexarrinha closed 5 years ago

mexarrinha commented 5 years ago

Is there a way that i can backTest candle strategies like: Candle patterns, rsi, crossovers?

aaimio commented 5 years ago

Hey @mexarrinha,

We currently have no way to backtest strategies through Binary Bot, although this is a feature that's being discussed internally.

Regards, Aaron

binary-ex-machina commented 5 years ago

I used to test the strategies using the CLI command, that you can find in this repository how to install and some examples of how to use. You must know javascript and can recreate any strategy in there and test.

mexarrinha commented 5 years ago

I can test a few strategies like rsi, but i can't make them very reliable. The problem is that I'm testing with closed values. So i can get a trade signal and a profit statement (win or loss) but only with the closed values. Yrah i don't know Javascript at least not enough to make that. Do you know of any good examples?

binary-ex-machina commented 5 years ago

you can get all the values of the candles/ticks using the CLI. Try to use console.log(Bot) and you will see all the commands you can use. An example is here https://github.com/binary-com/binary-bot/blob/master/cli-examples/speed-test.js

getOhlc() will return the latest 1000 candles of the specified market, so you need to map all the candles to return the value you want.

below is an example of sma cross up on a running bot.

image

Below is an example of backtesting, using a very simple filter, close value of the actual candle is above the SMA5-High and above SMA13-High. It the conditions met, it checks if the open value is below close value of the candle (meaning a win for call) if open value is above close is a loss.

image

You can expand this a lot, including smaa(array), sma, emaa(array), rsi, rsia(array) and so on. Uopu can create functions to calculate stochastic, cci, S&R and other indicators to be used on your analysis.

mexarrinha commented 5 years ago

Ok i do understand the syntax. Can i use Visual studio to run that code and it will connect to binary? Or do i need to safe it on xml file and open through binary bot? Or do i run it through the cmd? Thkx

mexarrinha commented 5 years ago

Is there a way or a better browser for dealing with checking last 1000 digits or ticks? I use chrome but it gets really slow and i think it is delaying when i do a buy order.

mexarrinha commented 5 years ago

@binary-ex-machina can i use mt5 to trade the v100 market?

binary-ex-machina commented 5 years ago

@mexarrinha yes you can. Download the MT5 from binary.com and crate a MT account in binary.com site

mexarrinha commented 5 years ago

@binary-ex-machina so we can actually backtest trough there. Tick by tick.. I'm not very familiar with mt5 but code wise might be better than trading view. And it would return very accurate trading history

mexarrinha commented 5 years ago

I run in to a problem xD i can't seem to find a binary sale order. They use tp and sl to close the orders... I might have found a solution but i haven't tested it yet.

mexarrinha commented 5 years ago

It doesn't work or i just can't figure it out. Due to it being binary options and expire 5 ticks later or 5 minutes, they don't have that way for selling the positions i think.. what program were you using in the images above?

@binary-ex-machina

mexarrinha commented 5 years ago

Can be closed @aaron-binary