chrisleekr / binance-trading-bot

Automated Binance trading bot - Trade multiple cryptocurrencies. Buy low/sell high with Grid Trading. Integrated with TradingView technical analysis
MIT License
5.05k stars 1.1k forks source link

Take minimal profit #142

Open GrigorovskyA opened 3 years ago

GrigorovskyA commented 3 years ago

Take minimal profit feature.

Think it is possible to introduce a strategy that can be called "Take the minimum profit" - For this, you can refuse the Coin Sell settings. I keep thinking about the idea of ​​making a large number of transactions and taking a small profit from them. Thus, having made a lot of not very profitable deals, we will receive a good profit due to the number of deals. And yes - it is a very aggressive strategy!

Create a checkbox. next to the Sales menu.

If this checkbox is activated. a more aggressive strategy will be enabled in the bot. The bot will buy prices that are set as it is now. But he will sell after reaching the minimum profit according

if (current_profit> buy_price * (2 * fee (0.1%) * multiplyer) and ( current_profit < prev_tick_profit):
 create sell_limit order (or sell by market_price)

where Multiplier is necessary for the deal to be at least a little profitable. fee - by default 0.1%(if bridge not BNB)

Thus, we will be able to buy on short candles and make the minimum quick profit without tracking with a trail. In this strategy, there will be no situation when the price does not reach the Sell - trigger percentage. And it happened to me that before the creation of a sell order, one hundredth of a percent was not enough and the coin flew into the abyss :)

chrisleekr commented 3 years ago

This is interesting. So instead of using trailing sell, you want to sell immediately once it reaches the minimum profit?

Would you give some examples of the formula and sample configuration? If I understood correctly,

Settings

Then when it reaches 10%, it sells the market or limit instead of trailing stop-loss sell. I am not quite understand why need 2 x of fee, the multiplier and previous tick profit? And what does previous tick profit do?

GrigorovskyA commented 3 years ago

In the strategy that I propose, at the moment I see it as follows:

  1. We do not set any parameters of the percentage for sale, except for the internal formula - so that the profit would cover the commissions for buying and selling
  2. We do not create trailing in this strategy in order to follow and thus quickly fix the profit.
  3. I think how it would be possible to implement trailing in the bot, so that it would collect profits from 0.3% to 1% in short periods of time in candles like that image

In such a strategy, I think it will be possible to set a lower frame for buying a coin with current bot strategy. Then the bot monitors as soon as the profit becomes positive, i.e. covered the commission - the bot is ready for sale. And at this moment I think how profitable it would be to sell the coin and monitor its further behavior. So far, I think that the simplest thing is to compare three previous values ​​(the average of the previous 3) - to several future values. and as soon as the previous ones become larger than the current ones, sell on the marketplace (in this type of transaction, we will definitely not get stuck on filling out a limit application)

Well, this is just an idea - and I want the community to join and share ideas. because I have no education in market analysis :)

ThomasPelster commented 3 years ago

I had the bot running against the testnet yesterday and tried to implement a similar strategy.

@GrigorovskyA Why not place a sell order directly?

E. g. Buy, and place order to sell with 0,3% profit. 1000 times 0,1% profit = 100% profit ;-)

chrisleekr commented 3 years ago

Well, this is just an idea - and I want the community to join and share ideas. because I have no education in market analysis :)

Totally agree to get collective knowledge from the community. I also don't have any education in finance. So we are on the same page. I am more than happy to learn a new strategy to improve the profit.

  1. We do not set any parameters of the percentage for sale, except for the internal formula - so that the profit would cover the commissions for buying and selling

I am kind of against using the internal formula. It is purely because I don't have any control over it. If I can make a configuration, I definitely make it.

  1. We do not create trailing in this strategy in order to follow and thus quickly fix the profit.
  2. I think how it would be possible to implement trailing in the bot, so that it would collect profits from 0.3% to 1% in short periods of time in candles like that In such a strategy, I think it will be possible to set a lower frame for buying a coin with current bot strategy. Then the bot monitors as soon as the profit becomes positive, i.e. covered the commission - the bot is ready for sale.

So basically, whenever it is in the profit position (configured minimum profit 1%) excluding the commission, sell at the market price or limit price, am I understanding correctly?

But couldn't this achieve with the current trailing sell strategy? For example, if I configure like below:

image

Then it would take 0.9% and follow the increase?

GrigorovskyA commented 3 years ago

@GrigorovskyA Why not place a sell order directly?

When you create a limit order at an inopportune moment - the market may change - and your limit order will not have time to be filled. those. you will find yourself with a coin, instead of having time to quickly sell it at the price you need.

E. g. Buy, and place order to sell with 0,3% profit. 1000 times 0,1% profit = 100% profit ;-)

I don't sure bot have implemented fee calculation. @chrisleekr This profit includes fee?

GrigorovskyA commented 3 years ago

I am kind of against using the internal formula. It is purely because I don't have any control over it. If I can make a configuration, I definitely make it.

Yes, so I indicated the multiplier in the formula, which is multiplied by the commission. it can probably be specified as a parameter.

On your screenshot which you want to get. But this 2% may not come soon. And on this new strategy - I mean, as soon as we have a profit - we immediately get it - without waiting for any boundaries, except for covering the commission.

ThomasPelster commented 3 years ago

@GrigorovskyA In my opinion, the sell parameters stop / limit price exist for this purpose. When these thresholds are reached, the coins are sold at a loss, e. g. bot should cancel placed sell and create a new.

Apparently we have a different strategy in mind ;-)

@chrisleekr I think @GrigorovskyA and I both think in milliseconds, so I wouldn't monitor at all but place the sell directly. If the price falls, the bot would have to cancel it. The sell strategy / parameter would only be the "rescue".

GrigorovskyA commented 3 years ago

@GrigorovskyA

In my opinion, the sell parameters stop / limit price exist for this purpose. When these thresholds are reached, the coins are sold at a loss, e. g. bot should cancel placed sell and create a new.

Apparently we have a different strategy in mind ;-)

In my strategy I try to refused from any of sell borders. Just insta profit=insta market sell

chrisleekr commented 3 years ago

I don't sure bot have implemented fee calculation.

The bot has a fee calculation .

0.1% of the order quantity based on the Binance specification - https://www.binance.com/en/support/articles/115000429332 I do not consider whether your account is set to use BNB or not. It gets complex to calculate. I found Binance does not take the commission from the order. You must possess the commission amount of the coin.

On your screenshot which you want to get. But this 2% may not come soon. And on this new strategy - I mean, as soon as we have a profit - we immediately get it - without waiting for any boundaries, except for covering the commission.

True, it may not come 2% soon.

Ok, so let's talk about some calculation.

Let's say my configuration is as below:

If the current price reaches $101, which is 1%, then it won't sell because of the commission

To get 1% without commission, we should configure

Then if the current price reaches $101.3, which is 1.3%, then it won't sell because of the commission

Does this sound like the correct calculation?

ThomasPelster commented 3 years ago

@chrisleekr The calculation is correct, I would only take 0.1% (without commission). But the bot sets the sell order only when the price is reached - correct?

GrigorovskyA commented 3 years ago

Fee by bying image

Fee by selling image

So need to multiply the profit by fee twice.

I see that it makes sense to enter a trade as soon as possible, even with minimal profit and no stop-loss limits(% of profit,trailing). image Let's imagine we see the following candles. At point 1, we buy at the low with the settings - image Yellow border - is 0.2% of comission. And as soon as the profit becomes more than the commission even a little bit bot ready to sells coins on the marketplace (what would it be instantaneously)

Within a few ticks, the bot compares the current price with the previous one - and if the current one rises, it waits. If the current one is less than the previous one, it sells. (These values ​​should probably be averaged somehow - for example, take 3 current averages and 3 past averages, because it is clear that over time the price changes up and down often and quickly - but we can observe a trend) Yes, I understand that we will find ourselves in a situation that the candle temporarily goes down - and then it shoots up and we will lose the possible high profitability. But at this time we will already try to jump into another coin :)

multiplier - is a simpler tool for making a profit. its purpose is the same as the Trigger Percentage on Sale if multiplier is 10 - pure profit will be ~1%

fee = 0.1% Profit is current_price - bought_price buy_fee - sell_fee current_price (*multiplier for greater profitability)

Let's see with multiplier - 2 And for sure you can see the graph of the dependence of the multiplier, price and profitability. and understand which one is better to put. But I put it purely for informational purposes, so that the commission is exactly covered.

We bought coin for 500 usdt:

If multiplier 5 Profit = 502.5 - (502.50.0015) - (500*0.001) = 499.4875 499.4875 < 500

And if the expression is true (current_price>bought_price) - check next price: if next price < current price : create sell Market_sell order if nex price > current price: waiting for next tick

Forgive me if I don't explain it very well, the day was hard :) Feel free to ask questions.

chrisleekr commented 3 years ago

@GrigorovskyA

I think the strategy is pretty simple. As soon as it becomes positive profit excluding the commission (2), then create a sell order. The multiplier would give extra profit based on the commission.

I kind of hesitate to introduce the concept of the multiplier since most configurations are percentage base. So if I just change the multiplier to percentage, it should still work, right?

I wonder how many people are supporting this strategy.

Let's keep this issue open and see what others think.

GrigorovskyA commented 3 years ago

I kind of hesitate to introduce the concept of the multiplier since most configurations are percentage base. So if I just change the multiplier to percentage, it should still work, right?

Yeah. you right - it can be changed to percentage. My var:

With %:

GrigorovskyA commented 3 years ago

In that time I'll test next settings image

ThomasPelster commented 3 years ago

@GrigorovskyA

I configured / run my proposal against the testnet.

GrigorovskyA commented 3 years ago

@ThomasPelster Can you share the settings you mean? I want to cover - fee and make a small profit from the deal. let's test with that settings. bot should do 0.2% of profit image

ThomasPelster commented 3 years ago

@GrigorovskyA

GrigorovskyA commented 3 years ago

ok, I'll test it. thx

GrigorovskyA commented 3 years ago

Well I ran for 3 days - and sometimes I need to sell coins manually when it ~-5% at the morning for example. not so big profit without stop-loss feature I suppose image image

But sometimes it is real to get fast profit image

GrigorovskyA commented 3 years ago

Well another upd. My strategy - sucks :) image

image

chrisleekr commented 3 years ago

@GrigorovskyA

So taking a minimal profit strategy not working?

I disabled stop-loss for now. I found eventually rising up. :(

GrigorovskyA commented 3 years ago

Yeah Chris, the strategy not working well. =/

chrisleekr commented 3 years ago

@GrigorovskyA

That is too bad. :(

I also tried the above setting and had lost. Thus, I changed to a conservative strategy. It's slow but I am having some trades. Although I had to disable the stop-loss feature yesterday and it was very hard to see balance going down. :( Mostly recovered today!

I am interested to see if #158 can decrease risk and increase the profit.

habibalkhabbaz commented 3 years ago

Hello everyone, In the last two days I was thinking about something similar to this strategy.

I am not a finance guy also :) but however I am sure if we need a greedy strategy, this will work somehow better than waiting for current price to reach the lowest price but I need to discuss the following with you guys.

I enhanced this idea by monitoring the change in price for a symbol in the last 5 minutes. For example, if it is changed by more than 2% within the 5 minutes period then place a buy order and sell with a 1% profit. So the idea is based on the change in price instead of the lowest price

I changed @chrisleekr code based on what I explained above and hurray I got 11 trades in around 30 minutes with a good results! 🎉 I lost in 2 trades only 😆 and I sold them manually because we have to think about something to deal with such behavior, a stop-loss for example

Screenshot

image

I post this for discussion to improve this strategy to deal with such situations so feel free to comment about this.

Best, Habib

ilbuonmarcio commented 3 years ago

Are you accounting for fees? That plays a bigger part in your strategy

habibalkhabbaz commented 3 years ago

Are you accounting for fees? That plays a bigger part in your strategy

I set the minimum profit to 1%. So my total profit will be 0.9%, is that right?

shawnsaimohan commented 2 years ago

Hello everyone, In the last two days I was thinking about something similar to this strategy.

I am not a finance guy also :) but however I am sure if we need a greedy strategy, this will work somehow better than waiting for current price to reach the lowest price but I need to discuss the following with you guys.

I enhanced this idea by monitoring the change in price for a symbol in the last 5 minutes. For example, if it is changed by more than 2% within the 5 minutes period then place a buy order and sell with a 1% profit. So the idea is based on the change in price instead of the lowest price

I changed @chrisleekr code based on what I explained above and hurray I got 11 trades in around 30 minutes with a good results! 🎉 I lost in 2 trades only 😆 and I sold them manually because we have to think about something to deal with such behavior, a stop-loss for example

Screenshot

image

I post this for discussion to improve this strategy to deal with such situations so feel free to comment about this.

Best, Habib

////////////////////////////////// please share settings..it will be helpful for me

ahsanaasim commented 2 years ago

Hello everyone, In the last two days I was thinking about something similar to this strategy.

I am not a finance guy also :) but however I am sure if we need a greedy strategy, this will work somehow better than waiting for current price to reach the lowest price but I need to discuss the following with you guys.

I enhanced this idea by monitoring the change in price for a symbol in the last 5 minutes. For example, if it is changed by more than 2% within the 5 minutes period then place a buy order and sell with a 1% profit. So the idea is based on the change in price instead of the lowest price

I changed @chrisleekr code based on what I explained above and hurray I got 11 trades in around 30 minutes with a good results! 🎉 I lost in 2 trades only 😆 and I sold them manually because we have to think about something to deal with such behavior, a stop-loss for example

Screenshot

image

I post this for discussion to improve this strategy to deal with such situations so feel free to comment about this.

Best, Habib

@habibalkhabbaz Hi. I would like to know which branch has this code you mentioned. I would like to play with the codes and would love to work on their optimizations.