OPEN-SOURCE SCRIPT

AUTOMATIC GRID BOT STRATEGY [ilovealgotrading]

Updated
  • OVERVIEW:

This Grid trading strategy can help you maximize your profit in a ranging sideways market with no clear direction.

  • INDICATOR:

We can get some money by taking advantage of the movement of the price between the range we have determined.
Short positions are opened while the price is rising, long positions are opened while the price is falling.
Therefore, there is no need to predict the trend direction.


  • What is different in this indicator:

I want to say thank you to © thequantscience. His GRID SPOT TRADING ALGORITHM - GRID BOT TRADING strategy helped me when I was writing my indicator.

  • I want to explain what I have improved:

*1- Grid strategy is a type of strategy that can be traded in very short time frames and users can trade this strategy algorithmically by connecting this strategy to their own accounts with the help of API systems. For this reason, I have developed a software that can give us signals by dynamically changing the long and short messages when users are trading.
*2- We can change the start and end dates of our grid bot as we want. It is necessary to use this setting when setting up automatic bots, so that previously opened transactions are not taken into account.
*3 - Lot or quantity size should not be excessively small when users are taking automatic trades because exchanges have limitations, to avoid this problem, I have prevented this error by automatically rounding up to the nearest quantity size inside the software.
*4 - Users can avoid excessive losses by using stop loss on this grid bot if they wish.
*5 - When our price is over the range high or below the range low, our open positions are closed, if the stop button is active. We can also change which close price time frame we take as a basis from the settings.
*6 -Users can set how many dollars they can enter per transaction while performing their transactions automatically.

  • IMPLEMENTATION DETAILS – SETTINGS:

This script allows the user to choose the highs and lows leves of our range. Our bot trades in the specified range.
https://www.tradingview.com/x/jW39QvxZ/
1. This strategy allows us to set start and end backtest dates.
2. We can change range high and range low leves of our bot
3. IF people want to trade algorithmically with the help of this bot, there are 6 different input systems that will receive the Json codes as an alarm
4. IF the price closes above the upper line or below the lower line, all transactions will be closed. We can determine in which time frame our transactions will be stopped if the price closes outside these levels.We can adjust how our bot works by activating or turning off the Stop Loss button.
5. In this strategy, you can determine your dollar cost for per position.
6. The user can also divide the interval we have determined into 10 parts or 20 equal parts.
7. The grid is divided and colored at the interval we set. At the same time, if we don't want we can turn off colored channels.

  • Notes:

If you're going to connect this bot to an automatic Long and Short direction,
Don’t forget! you need to Webhook URL,
Don’t miss paste this code to your message window {{strategy.order.alert_message}}

  • ALSO:

Set your range below the support zones and above the resistance zones.
Don't be afraid to take a wide range, it doesn't matter if you make a little money, the important thing is that you don't lose money.


*If you have any ideas what to add to my work to add more sources or make calculations cooler, suggest in DM .
Release Notes
  • Debugging Strategy Update:

- The software update resulted in no change in strategy.
- I rewrote some code and we don't get any suggestion or error anymore
Release Notes
  • Strategy Update:


What changed in this update ?
https://www.tradingview.com/x/s55f6A9R/

- Users will now be able to open transactions in the direction they want,
- For example, users who want to do DCA in a falling market can only choose the LONG direction and automatically lower their average and sell automatically when the price is on the rise.
- In the other situation, users can open and close their transactions in parts by choosing the SHORT direction in the extremely rising market.
- If the price is in the consolidation phase, they can choose the BOTH direction and earn money from the small rises and falls of the price.
Release Notes
  • Small Update:

I encountered an error while trading automatically. If the quantities we receive are too small, we encounter an error in the stock market. To avoid this situation, I added a code snippet that automatically adjusts the amount of product we buy according to price conditions.
Release Notes
First of all I want to say thank you my Indian friends Abdul and Sunny for their ideas.

  • What changed in this update ?


https://www.tradingview.com/x/0oUv8nII/

1 - Firstly who want to use stop loss then they should activate button "Use StopLoss"
2-We can CLOSE our grid bot after stop loss. With button "Close Bot After Stop Loss"
With help of this option were are not constantly open and stop our positions when the price very close on the range high or range low region.
People who want to use this feature could activate this button while setting up their bots and avoid being stopped repeatedly.
3-For users who want to use stop loss, we have considered range high and range low levels by default, but some users may want to set stop levels above range high or below range low.
IF users want to enter their own levels, they need to DEactivate the "Use Stop Loss Where HIGH and LOW GRID PRICE" button and then enter the desired levels.


Let's make two examples together

First example

https://www.tradingview.com/x/mmSBeHym/


Second example

https://www.tradingview.com/x/6nrfDeio/

Release Notes
  • First of all, I want to say thank you to my Polish friend Greg for his ideas and helps.


What changed in this update ?

https://www.tradingview.com/x/Esy6tWUK/

1 - I added to table to show us "Open Positions", "Open profit", "Total trades", "Total profit", "Current equity" (With the help of this table, we can quickly check the features shown in the table while setting our strategy.)
2- We can open and close table with button "Show Table"
3 - We can change location of table
4 - We can change size of table
algorithmictradingalgotradingBands and ChannelsGRIDgridbotgridtradingrangestrategyVolatility

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


I am an engineer who has been working in the topic of algorithmic trading for more than 5 years.By browsing our website , you can review and use many sample indicators that I have designed for you.
Also on:

Disclaimer