freqtrade / berlinguyinca-trading-strategies Goto Github PK
View Code? Open in Web Editor NEWoutdated - please use the official repo https://github.com/freqtrade/freqtrade-strategies from now on.
License: MIT License
outdated - please use the official repo https://github.com/freqtrade/freqtrade-strategies from now on.
License: MIT License
[![Coverage Status](https://coveralls.io/builds/55228737/badge)](https://coveralls.io/builds/55228737)
Coverage decreased (-0.1%) to 94.996% when pulling 6c96a2464ffd136cb8f3aa98cf7f94d9f7fa4fcd on feat/convolutional-neural-net into 935275010f37738efc4667bff608762d89db0559 on develop.
Originally posted by @coveralls in freqtrade/freqtrade#7807 (comment)
Hi! hoping you can help.
To test and assure the freqtrade bot backtest is working as would be expected we're executing a simpleMA crossover test against tradingview and freqtrade.
1hr candles, ETHBTC, binanace, 20180520-27
On trading view we get 4 hits. On freqtrade zero.
This may well be as ive crafted the strategy incorrectly.
Please can you run your eye over it, hopefully will benefit your project too!
thanks
Please can somebody take a look at this Freqtrade strategy.
I'm trying to mimic the script further below executed on tradingview.
Freqtrade returns no backtest trades, on tradingview there are 4 hits.
Cmd Output:
python3 ./freqtrade/main.py -s Freqtrade_backtest_validation_freqtrade1 backtesting --export trades --export-filename=Freqtrade_backtest_validation_freqtrade1.1.json --timerange=20180520-20180527 --refresh-pairs-cached
2018-06-06 18:15:01,268 - freqtrade.configuration - INFO - Log level set to INFO
2018-06-06 18:15:01,269 - freqtrade.configuration - INFO - Using max_open_trades: 200 ...
2018-06-06 18:15:01,270 - freqtrade.configuration - INFO - Parameter --timerange detected: 20180520-20180527 ...
2018-06-06 18:15:01,270 - freqtrade.configuration - INFO - Using data folder: user_data/data/binance ...
2018-06-06 18:15:01,270 - freqtrade.configuration - INFO - Parameter -r/--refresh-pairs-cached detected ...
2018-06-06 18:15:01,270 - freqtrade.configuration - INFO - Parameter --export detected: trades ...
2018-06-06 18:15:01,270 - freqtrade.configuration - INFO - Storing backtest results to Freqtrade_backtest_validation_freqtrade1.1.json ...
2018-06-06 18:15:01,270 - freqtrade.optimize.backtesting - INFO - Starting freqtrade in Backtesting mode
2018-06-06 18:15:01,299 - freqtrade.strategy.resolver - INFO - Using resolved strategy Freqtrade_backtest_validation_freqtrade1 from '/Users/creslin/PycharmProjects/freqtrade_new/freqtrade/strategy/../../user_data/strategies'
2018-06-06 18:15:01,299 - freqtrade.strategy.resolver - INFO - Override strategy 'ticker_interval' with value in config file: 1h.
2018-06-06 18:15:01,299 - freqtrade.exchange - INFO - Instance is running with dry_run enabled
2018-06-06 18:15:01,302 - freqtrade.exchange - INFO - Using Exchange "Binance"
2018-06-06 18:15:01,891 - freqtrade.optimize.backtesting - INFO - Using stake_currency: BTC ...
2018-06-06 18:15:01,891 - freqtrade.optimize.backtesting - INFO - Using stake_amount: 1 ...
2018-06-06 18:15:01,891 - freqtrade.optimize.backtesting - INFO - Using local backtesting data (using whitelist in given config) ...
2018-06-06 18:15:01,897 - freqtrade.optimize - INFO - Download data for all pairs and store them in user_data/data/binance
2018-06-06 18:15:01,897 - freqtrade.optimize - INFO - Download the pair: "ETH/BTC", Interval: 1h
dumping json to "user_data/data/binance/ETH_BTC-1h.json"
2018-06-06 18:15:02,224 - freqtrade.optimize.backtesting - INFO - Ignoring max_open_trades (realistic_simulation not set) ...
2018-06-06 18:15:02,263 - freqtrade.optimize.backtesting - INFO - Measuring data from 2018-05-20T00:00:00+00:00 up to 2018-05-27T00:00:00+00:00 (7 days)..
2018-06-06 18:15:02,279 - freqtrade.optimize.backtesting - INFO - Dumping backtest results to Freqtrade_backtest_validation_freqtrade1.1.json
dumping json to "Freqtrade_backtest_validation_freqtrade1.1.json"
2018-06-06 18:15:02,290 - freqtrade.optimize.backtesting - INFO -
==================================== BACKTESTING REPORT ====================================
pair buy count avg profit % total profit BTC avg duration profit loss ETH/BTC 0 nan 0.00000000 nan 0 0 TOTAL 0 nan 0.00000000 nan 0 0
Freqtrade strategy:
# Freqtrade_backtest_validation_freqtrade1.py
# This script is 1 of a pair the other being freqtrade_backtest_validation_tradingview1
# These should be executed on their respective platforms for the same coin/period/resolution
# The purpose is to test Freqtrade backtest provides like results to a known industry platform.
#
# --- Do not remove these libs ---
from freqtrade.strategy.interface import IStrategy
from pandas import DataFrame
# --------------------------------
# Add your lib to import here
import talib.abstract as ta
import freqtrade.vendor.qtpylib.indicators as qtpylib
import numpy
class Freqtrade_backtest_validation_freqtrade1(IStrategy):
# Minimal ROI designed for the strategy.
minimal_roi = {
"40": 2.0,
"30": 2.01,
"20": 2.02,
"0": 2.04
}
stoploss = -09.90
ticker_interval = '1h'
def populate_indicators(self, dataframe: DataFrame) -> DataFrame:
# SMA - Simple Moving Average
dataframe['fastMA'] = ta.SMA(dataframe, timeperiod=14)
dataframe['slowMA'] = ta.SMA(dataframe, timeperiod=28)
return dataframe
def populate_buy_trend(self, dataframe: DataFrame) -> DataFrame:
dataframe.loc[
(
(dataframe['fastMA'] > dataframe['slowMA'])
),
'buy'] = 1
return dataframe
def populate_sell_trend(self, dataframe: DataFrame) -> DataFrame:
dataframe.loc[
(
(dataframe['fastMA'] < dataframe['slowMA'])
),
'sell'] = 1
return dataframe
Tradingview Script:
//@version=3
/// This is to be ran on traderview.
/// Comparing the results from this test to "freqtrade_backtest_validation_freqtrade1.py"
/// executed on the bot are used to confirm like for like results in backtest
/// between Freqtrade and Tradingview
strategy("FreqTrad Backtest Valdiation 1", shorttitle = " freqit_1 ", overlay=true, max_bars_back=2000)
// Revision: 1
// Author:
// === INPUT SMA ===
fastMA = input(defval = 14, type = integer, title = "FastMA", minval = 1, step = 1)
slowMA = input(defval = 28, type = integer, title = "SlowMA", minval = 1, step = 1)
// === INPUT BACKTEST RANGE ===
FromMonth = input(defval = 5, title = "From Month", minval = 1, maxval = 12)
FromDay = input(defval = 20, title = "From Day", minval = 1, maxval = 31)
FromYear = input(defval = 2018, title = "From Year", minval = 2017)
ToMonth = input(defval = 5, title = "To Month", minval = 1, maxval = 12)
ToDay = input(defval = 27, title = "To Day", minval = 1, maxval = 31)
ToYear = input(defval = 2018, title = "To Year", minval = 2017)
// === FUNCTION EXAMPLE ===
start = timestamp(FromYear, FromMonth, FromDay, 00, 00) // backtest start window
finish = timestamp(ToYear, ToMonth, ToDay, 23, 59) // backtest finish window
window() => time >= start and time <= finish ? true : false // create function "within window of time"
// === SERIES SETUP ===
buy = crossover(sma(close, fastMA), sma(close, slowMA)) // buy when fastMA crosses over slowMA
sell = crossunder(sma(close, fastMA), sma(close, slowMA)) // sell when fastMA crosses under slowMA
// === EXECUTION ===
strategy.entry("L", strategy.long, when = window() and buy) // buy long when "within window of time" AND crossover
strategy.close("L", when = window() and sell) // sell long when "within window of time" AND crossunder
plot(sma(close, fastMA), title = 'FastMA', color = yellow, linewidth = 2, style = line) // plot FastMA
plot(sma(close, slowMA), title = 'SlowMA', color = aqua, linewidth = 2, style = line) // plot SlowMA
Output for tradingview script ran for same UTC period
If you have a recommended pairs and max open trades for each strategy, can you add that?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.