FX31337 / FX-BT-Scripts

:page_facing_up: Useful scripts for backtesting.
MIT License
34 stars 39 forks source link

convert_csv_to_mt.py: implement a form of control point and open price models #94

Closed ghost closed 5 years ago

ghost commented 5 years ago

This attempts to resolve #89. It generates FXT files for all 3 models now and they do not appear to generate errors when I open them in MT4.

The control points model attempts to work by only keeping new highs and lows and the open price model attempts to work by only keeping the first tick for a given timeframe.

It appears to implement the main things that were requested, but let me know if it is missing anything or has issues. I wasn't sure what testing you had in mind.

kenorb commented 5 years ago

Allow me to test this over the weekend, as I need to find some time.

ghost commented 5 years ago

Understood. If it fails, please let me know how I can test it so I can see about fixing it. Thanks.

kenorb commented 5 years ago

I've tested the changes by converting into FXT and back to CSV format, and comparing the files manually. I think the filtering works as expected when choosing different models. I'll be fully testing in MT4 after a while, but I don't see any reason it won't work. So I'm merging it.

Testing steps:

wget https://raw.githubusercontent.com/FX-Data/FX-Data-EURUSD-DS/EURUSD-2017/EURUSD/2017/02/2017-02-01--12h_ticks.csv
./convert_csv_to_mt.py -i 2017-02-01--12h_ticks.csv -t m1 -m 0,1,2
./convert_mt_to_csv.py -i EURUSD1_0.fxt -f fxt4 -o 2017-02-01--12h_ticks.csv.new.EURUSD1_0.fxt.results
./convert_mt_to_csv.py -i EURUSD1_1.fxt -f fxt4 -o 2017-02-01--12h_ticks.csv.new.EURUSD1_1.fxt.results
./convert_mt_to_csv.py -i EURUSD1_2.fxt -f fxt4 -o 2017-02-01--12h_ticks.csv.new.EURUSD1_2.fxt.results
vimdiff 2017-02-01--12h_ticks.csv.new.EURUSD1_0.fxt.results 2017-02-01--12h_ticks.csv.new.EURUSD1_1.fxt.results
vimdiff 2017-02-01--12h_ticks.csv.new.EURUSD1_1.fxt.results 2017-02-01--12h_ticks.csv.new.EURUSD1_2.fxt.results