Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

[Feature] Buy/Sell with fixed size #1681

Open
pdelbeato opened this issue Aug 15, 2018 · 0 comments
Open

[Feature] Buy/Sell with fixed size #1681

pdelbeato opened this issue Aug 15, 2018 · 0 comments

Comments

@pdelbeato
Copy link

I propose to have an option like "--fixed-size " where we can set a fixed amount of currency to be bought/sold, instead of a percentage of the remaining currency.

With this option, e.g. in a bollinger strategy, a multiple touch on the lower band leads to multiple buy but with fixed amount of currency (e.g. 500 EUR every time, no matter the price) instead of a percentage (e.g. supposing a start amount of 1000 EUR, "--buy_pct 50" leads to different buy: 500, 250, 125, etc.). Every "quantum" is a trade in "my_trades", so it has its "profit" value. When there is a touch on the upper band, a sell signal is set, and only quantums which satisfy their profit value are sold.

At the moment, everything is connected with "last_trade_worth", leading to a sell with profit for the last trade, but a possible loss on previous ones.
Simple case: bollinger strategy, "--buy_pct 99" as default. Starting with 1000 EUR.
First buy: price 100, 990 EUR for 9.9 assets, 10EUR remaining.
Price go down and touch again the lower band at 80. Second buy: price 80, 9.9EUR for less than 0.1 asset, 0.1 EUR remaining.
Price go up and touch the upper band at 90. "last_trade_worth" is more than 10%, so it triggers a signal to sell everything, and sell about 10 assets at 90, total 900 EUR. I lost 100 EUR.

With a e.g. "--fixed-size 200". Same condition (bollinger strategy, "--buy_pct 99" as default. Starting with 1000 EUR)
First buy: price 100, 200 EUR for 2 assets, 800EUR remaining.
Price go down and touch again the lower band at 80. Second buy: price 80, 200EUR for 2.5 asset, 600 EUR remaining.
Price go up and touch the upper band at 90, triggering a signal to sell. Every opened trade is checked against their "profit value". The second trade triggers, so zenbot will sell 2.5 assets at 90, total 225 EUR. I gained 25 EUR and I have yet a position opened, ready to be sold when times will be good (or when the stop loss for that trade is reached).

I have a simple bot in Coffescript, tested on a known cryptobot website, and backtesting it I had very good results while the same strategy in zenbot lead to a considerable loss (same parameters, same period, same interval).

I hope to have been clear. Any comments?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants