Grid Bot Simulator

This script is a grid bot simulator for ranging/choppy markets. Prices are divided into grids, or trade zones, that will trigger signals each time a new zone is entered. During ranging markets, each transaction is followed by a “take profit.” As the market starts to trend, transactions are stacked (compare to DCA ), until the market consolidates. No signals are triggered above the Upper Limit or Below the Lower Limit.

Settings overview:
Upper Limit/Lower Limit : Highest and Lowest values for entire grid.
Number of Grids: Number of trade zones.
Show Grids: Show or hide all gridlines.
Show Only Current Grids: Only display the grids just above and just below the current trade zone.
High/Low for signals: If enabled, signals are triggered as soon as the price touches the next zone. If disabled, signals are triggered after bar closes. Enable this for “Once Per Bar alerts. Disable for “Once Per Bar Close” alerts.

Highlight Trade Zones

The grid bot should work well during ranging/choppy markets. Each zone will have only one trade, and then will immediately take profit in the next zone.
Ranging/Choppy Market

However, trending markets can produce multiple signals in rapid succession:
Trending Market

If the gridlines are compressing the chart space, enable the “Show Only Current Grids” in settings.
Show Only Current Grids disabled

Show Only Current Grids enabled

When changing symbols, adjust the Upper and Lower Limits to accommodate the new symbol. Otherwise, the chart will look compressed.
XBTUSD chart with ETHUSDT settings

The bot is a proof-of-concept and is considered experimental. Possible future updates will include Fibonacci grids and “smart entry/exits,” depending on the current trend. Comments and suggestions are encouraged.
版本注释: Adjusted signals to buy at LowerLimit and sell at UpperLimit if 'extremes' is enabled.
  • Added market direction filter. Bot will skip ever other signal against market direction (up or down).
  • Added option for signal plot size.
版本注释: Fixed Upper and Lower Limit lines not showing
版本注释: Fixed signal arrow sizes
版本注释: Fixed "Transp" deprecation warning
版本注释: New version available:

Grid Bot Auto

本着真正的TradingView精神,该脚本的作者将其开源发布,因此交易者可以理解和验证它。为作者加油! 您可以免费使用它,但是在发布中重复使用此代码受网站规则的约束。您可以收藏它以在图表上使用。

ETH(ERC20): 0xe5f4aab4dd0f297843146d51605010bf2c2


Great Work! This script will be featured in the official german TradingView Newsletter!
500 代币
+1 回复
500 代币
+1 回复
interesting. can this be turned to an automated bot that can excute orders directly on trading view using any of the available brokers?
+8 回复
mvs1231 KareemFarid

You could be able to do that in the webhook section of the alert box if you use a service like Alertartron or Scavengerbot
This publication is now featured in our Editors' Picks: .
In the name of all TradingViewers, thank you for your valuable contribution to the community, and congrats!
+1 回复
The lower part of the grid is not showing completely

I’m plotting btc/usd with range from 34k-55k, 70 grids.
mvs1231 waronad

This is a Pinescript limitation.

Pinescript won't draw more than (approx) 50 lines.

A possible work-around could be to dynamically draw only 25 grids above and 25 grids below the current price. Have to think about how to implement.
waronad mvs1231
@mvs1231, thanks.
Hi, I've found that the script misses a level if there is a gap in price. Is there a fix for this?
mvs1231 novoa
@novoa, @novoa, This is part of the algorithm -- may be able to figure a work-around.