Krypto-trading-bot icon indicating copy to clipboard operation
Krypto-trading-bot copied to clipboard

Improvement: Range Trading

Open Camille92 opened this issue 7 years ago • 8 comments

Hello everyone,

It has been a long time before I submit an idea for improvement, so it's time to fix that.

I think this improvement can be good for all types of traders when/if implemented. This idea was seen in the Leonardo bot http://marginsoftware.de/leonardo-papertrading.html.

How does it work: I think it could fit in the protection area of the bot or even as a safety or mode, it's your call :p.

(I'm thinking about how to make the bot easier to understand between mode/safety/protection when I find a good solution I'll post an issue).

So what we need here: We define a time in minutes (period) and register in the database the highest and lowest trade during each minute of this time.

The rule will be to buy at the highest registered price during the defined period and buy at the lowest point during the period.

As it might be difficult/impossible to buy at that maximum in case of spikes, we also define a percentage that acts as a waiver. So if we put 80 in the percentage space we buy at 80% of the difference between lowest and highest registered trade.

One example to make that easier to understand.

Let's say you're looking at a 3mn period: Minute 1: Highest trade 105 lowest 104 Minute 2: Highest trade 100 lowest trade 98 Minute 3: Highest trade 102 lowest trade 101 Minute 4: Highest trade 104 lowest trade 95

So at minute 4, we look at the past 3 minutes to make a trade decision: Highest trade 105 lowest trade 98. So the difference is 7. If we use a percentage of 80: We sell at: lowest trade+ (7 * 80)/100 = 103.6 We buy at: highest trade+ (7 * 80)/100 = 99.4

At minute 5 we look at minute 2 to 4 to make a trade decision: Highest trade 104, lowest trade 95 Difference 9 If we use a percentage of 80: We sell at: lowest trade+ (9 * 80)/100 = 102.2 We buy at: highest trade+ (9 * 80)/100 = 96.8

And we keep going updating that every minute.

I hope you understand how that can be easy and efficient for market making. I understand that for some very fast traders like @serzhiio and others, it might be more interesting to have that updated every second instead of every minute so maybe being able to chose if we have "period" in minutes or seconds could be good to fit all needs.

I hope you like it,

Happy trading, Camille

Camille92 avatar Dec 29 '17 09:12 Camille92

IMHO it diverges very much from basis principle of K. If we start to gather minutes (1-3-5 etc.) stats we need to count candles (OHLC) and this is quite different source of data. Sounds like just candle trades.

serzhiio avatar Dec 29 '17 09:12 serzhiio

Well, you don't need to gather all data just highest and lowest of every minute, and as we have the trade data on the right this could be done easily :)

Camille92 avatar Dec 29 '17 10:12 Camille92

For this we just can fetch WS OHLC data. I cant understand this strategy if we are getting long downtrend how can it help to make profit? ;) P.S.: i cant see it usable with 0 spread

serzhiio avatar Dec 29 '17 11:12 serzhiio

what's WS, Wall street?

Well, it's like the current market making system but a bit smarter and usable in a different time frame.

You don't worry about the spread, just that the price has been here for the past x minutes. You can read more at the strategy here:

https://www.investopedia.com/terms/t/tradingchannel.asp https://www.netpicks.com/simple-range-trading-strategy/ http://traderhq.com/trading-strategies/using-price-action-to-analyze-stocks/

Here is a picture of an example of the strategy in place in BTC/USD using 30 minutes (roughly).

The red lines are where would be the top / bottom of the channel for 30 minutes during the period. Now you calculate 80% of the difference between the top and bottom for each period and you get where you buy/sell.

I know it's a bit messy but it's hard to make that by hand! telechargement 5 .

Camille92 avatar Dec 29 '17 13:12 Camille92

Looks interested, but only in case flat market.. Scary to imagine what would happen if run this strategy on downtrend. Or long downtrend and uptrend is a special cases of short periods on long intervals?

donaldforest avatar Dec 29 '17 19:12 donaldforest

Yes fair point @donaldforest but I think it can't work with a good TBP setting so even if it goes downtrend you don't buy above your TBP + pdiv. (same for upward movement).

Camille92 avatar Dec 29 '17 19:12 Camille92

WS is a WebSocket that we can fetch from any exchange because OHLC is open data. So we dont need even to gather info, we simply can get candle info with any interval.

serzhiio avatar Dec 30 '17 17:12 serzhiio

Oh yes, that's good :)

Le 30 déc. 2017 18:43, "serzhiio" [email protected] a écrit :

WS is a WebSocket that we can fetch from any exchange because OHLC is open data. So we dont need even to gather info, we simply can get candle info with any interval.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ctubio/Krypto-trading-bot/issues/520#issuecomment-354558763, or mute the thread https://github.com/notifications/unsubscribe-auth/AGizFr6huuPPR53xFLkB5gyXi7Cb8M_Lks5tFnYtgaJpZM4RO-fq .

Camille92 avatar Dec 30 '17 18:12 Camille92