ctubio / Krypto-trading-bot

Self-hosted crypto trading bot (automated high frequency market making) written in C++
https://127.0.0.1:3000
Other
3.29k stars 815 forks source link

Trade solution request (Martingale betting_system pings) #420

Closed donaldforest closed 6 years ago

donaldforest commented 6 years ago

Martingale betting system principle: Starting orders from some low size value. Then in if pong complete with profit, we start new ping and reset martingale (all ok). Else, if price go away for our ping, we make another ping with increased order size. If ping missed trend again, we again increasing next ping value and etc, while we dont get summary price of all pings based on sizes when can sell all by average. More simple way is do not increase first start size, but in this case average price will be mo higher.

1) Simple example bets on red and black. We add bet 1$, for example, on red and if win black we double our bet to 2$ and continue play on red side, then if again black, we set 4$ on red and etc.. This is an example with linear multiplier martingale x2.

2) Same example for BTC/USD: We have first order 0.01BTC by price 8300$. Price go down to 8200$, then we buy 0.03BTC by 8200. Then if price go down again 8100, we buy 0.09BTC by price 8100$. Now we have: 0.098100 + 0.038200 + 0.01*8300 = 1058 USD Total 0.09 + 0.03 + 0.01 = 0.13 BTC Total 1058 / 0.12 = 8.138.47 USD min price to sell all merged pings and do not lose. This is an example with linear multiplier martingale x3.

More interested example can be with exponential multiplier. But I think the principle already is clear. https://en.wikipedia.org/wiki/Martingale_(betting_system)

ctubio commented 6 years ago

nice soo.. the plan is to dinamicaly increase the order price if market price goes away, otherwise keep pings at minimum order price while matching pongs, hope i undertood right' this could be a new option in the safety selector called Martingale and needs a new input to set the increment of each step i think

Camille92 commented 6 years ago

I just come in to say that martingale for both trading and casino is a stupid and dangerous strategy unless your capital is illimited.

If your example of martingale x 3 for every 100USD down if the price goes down from 8300 to 7300 with a starting bet of 0.01 you're would have to invest 295.24 BTC to make your investment back (or around 1,5 MILLION USD) and all that to make a ridiculous profit if the price goes up a bit.

Martingale is well documented on the internet and is basically a good way to lose all your investment.

I would suggest not to implement it in the bot as it could lead to lose ALL OF YOUR STACK pretty quickly in strong market conditions.

More reading here: https://www.investopedia.com/articles/forex/06/martingale.asp "As attractive as the martingale strategy may sound to some traders, we emphasize that grave caution is needed for those who attempt to practice this trading style. The main problem with this strategy is that often, seemingly sure-fire trades may blow up your account before you can turn a profit or even recoup your losses. In the end, traders must question whether they are willing to lose most of their account equity on a single trade. Given that they must do this to average much smaller profits, many feel that the martingale trading strategy is entirely too risky for their tastes."

http://forexop.com/martingale-trading-system-overview/ Does Martingale Always Work? In a pure Martingale system no complete sequence of trades ever loses. If the price moves against you, you simply double the size of the trade.

But such a system can’t exist in the real world because it means having an unlimited money supply and an unlimited amount of time. Neither of which are achievable.

In a real trading system, you need to set a limit for the drawdown of the entire system. Once you pass your drawdown limit, the trade sequence is closed at a loss. The cycle then starts again.

When you restrict the ability to drawdown, you’re departing from a theoretical Martingale system. And in doing so you’re using an approximation that will always have a failure point.

Camille92 commented 6 years ago

If you want to try what I'm saying, go to prime dice (https://primedice.com/play) and in automated betting put "on loss augment size by 100%."

I promise that you'll soon have insufficient funds to keep playing.

donaldforest commented 6 years ago

This is the only way to avoid losing. You in any case make ping like in casino. Any indicator dont gives you more than 5-10% guaranties. Any ping possible integrate with martingale and this ping can be with any level of previous analyze. Martingale can be last layer of protection from incorrect trend analyse. If you like risk with trade by bigger parts of depo, you always welcome use bigger static parts!

ghost commented 6 years ago

@Camille92 Thats why you would run martingale on an uptrend and double your betting every time you win on something with volatile patterns like Bitcoin since in normal market conditions it fluctuates 200-400$ every few hours, Another thing you can do is reset your bet every time you lose (essentially a downtrend), and then have a stoploss for if it crashes

Camille92 commented 6 years ago

It's normal until it is not and you're left with no money.

Le 13 déc. 2017 03:00, "Optictrollz" notifications@github.com a écrit :

@Camille92 https://github.com/camille92 Thats why you would run martingale on an uptrend on something with volatile patterns like Bitcoin since in normal market conditions it fluctuates 200-400$

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ctubio/Krypto-trading-bot/issues/420#issuecomment-351257468, or mute the thread https://github.com/notifications/unsubscribe-auth/AGizFmsM_RYyL0fUqFLdz0iQUZyHlcQsks5s_y-2gaJpZM4Qom59 .