OPEN-SOURCE SCRIPT
Tailwind.(BTC)

Imagine the price of Bitcoin is like a person climbing a staircase.
The Steps (Grid): Instead of watching every single price movement, the strategy divides the market into fixed steps. In your configuration, each step measures **3,000 points**. (Examples: 60,000, 63,000, 66,000...).
The Signal: We buy only when the price climbs a full step decisively.
The "Expensive Price" Filter: If the price jumps the step but lands too far away (the candle closes too high), we do not buy. It is like trying to board a train that has already started moving too fast; the risk is too high.
Rigid Exits: The Take Profit (TP) and Stop Loss (SL) are calculated from the edge of the step, not from the specific price where you managed to buy. This preserves the geometric structure of the market.
The Code Logic (Step-by-Step)
A. The Math of the Grid (`math.floor`)
pinescript
level_base = math.floor(close / step_size) * step_size
This is the most important line.
What does it do? It rounds the price down to the nearest multiple of 3,000.
Example: If BTC is at 64,500 and the step size is 3,000:
1. Divide: $64,500 / 3,000 = 21.5$
2. `math.floor` (Floor): Removes the decimals $\rightarrow$ remains $21$.
3. Multiply: $21 * 3,000 = 63,000$.
Result: The code knows that the current "floor" is **63,000**, regardless of whether the price is at 63,001 or 65,999.
B. The Strict Breakout (`strict_cross`)
pinescript
strict_cross = (open < level_base) and (close > level_base)
Most strategies only check if `close > level`. We do things slightly differently:
`open < level_base`: Requires the candle to have "born" *below* the line (e.g., opened at 62,900).
`close > level_base`: Requires the candle to have *finished* above the line (e.g., closed at 63,200).
Why? This avoids entering on gaps (price jumps where the market opens already very high) and confirms that there was real buying power crossing the line.
C. The "Expensive Price" Filter (`max_dist_pct`)
pinescript
limit_price_entry = level_base + (step_size * (max_dist_pct / 100.0))
price_is_valid = close <= limit_price_entry
Here you apply the percentage rule:
-If the level is 63,000 and the next is 66,000 (a difference of 3,000).
-If `max_dist_pct` is **60%**, the limit is $63,000 + (60\% \text{ of } 3,000) = 64,800$.
-If the breakout candle closes at **65,000**, the variable `price_is_valid` will be **false** and it will not enter the trade. This avoids buying at the ceiling.
D. TP and SL Calculation (Anchored to the Level)
pinescript
take_profit = level_base + (step_size * tp_mult)
stop_loss = level_base - (step_size * sl_mult)
Note that we use `level_base` and not `close`.
-If you entered because the price broke 63,000, your SL is calculated starting from 63,000.
-If your SL is 1.0x, your stop will be exactly at 60,000.
This is crucial: If you bought "expensive" (e.g., at 63,500), your real stop is wider (3,500 points) than if you bought cheap (63,100). Because you filter out expensive entries, you protect your Risk/Reward ratio.
E. Visual Management (`var line`)
The code uses `var` variables to remember the TP and SL lines and the `line.set_x2` function to stretch them to the right while the operation remains open, providing that visual reference on the chart until the trade ends.
Workflow Summary
Strategy Parameters:
Total Capital: $20,000
We will use 10% of total capital per trade.
Commissions: 0.1% per trade.
TP: 1.4
SL: 1
Step Size (Grid): 3,000
We use the 200 EMA as a trend filter.
Feel free to experiment with the parameters to your liking. Cheers.
The Steps (Grid): Instead of watching every single price movement, the strategy divides the market into fixed steps. In your configuration, each step measures **3,000 points**. (Examples: 60,000, 63,000, 66,000...).
The Signal: We buy only when the price climbs a full step decisively.
The "Expensive Price" Filter: If the price jumps the step but lands too far away (the candle closes too high), we do not buy. It is like trying to board a train that has already started moving too fast; the risk is too high.
Rigid Exits: The Take Profit (TP) and Stop Loss (SL) are calculated from the edge of the step, not from the specific price where you managed to buy. This preserves the geometric structure of the market.
The Code Logic (Step-by-Step)
A. The Math of the Grid (`math.floor`)
pinescript
level_base = math.floor(close / step_size) * step_size
This is the most important line.
What does it do? It rounds the price down to the nearest multiple of 3,000.
Example: If BTC is at 64,500 and the step size is 3,000:
1. Divide: $64,500 / 3,000 = 21.5$
2. `math.floor` (Floor): Removes the decimals $\rightarrow$ remains $21$.
3. Multiply: $21 * 3,000 = 63,000$.
Result: The code knows that the current "floor" is **63,000**, regardless of whether the price is at 63,001 or 65,999.
B. The Strict Breakout (`strict_cross`)
pinescript
strict_cross = (open < level_base) and (close > level_base)
Most strategies only check if `close > level`. We do things slightly differently:
`open < level_base`: Requires the candle to have "born" *below* the line (e.g., opened at 62,900).
`close > level_base`: Requires the candle to have *finished* above the line (e.g., closed at 63,200).
Why? This avoids entering on gaps (price jumps where the market opens already very high) and confirms that there was real buying power crossing the line.
C. The "Expensive Price" Filter (`max_dist_pct`)
pinescript
limit_price_entry = level_base + (step_size * (max_dist_pct / 100.0))
price_is_valid = close <= limit_price_entry
Here you apply the percentage rule:
-If the level is 63,000 and the next is 66,000 (a difference of 3,000).
-If `max_dist_pct` is **60%**, the limit is $63,000 + (60\% \text{ of } 3,000) = 64,800$.
-If the breakout candle closes at **65,000**, the variable `price_is_valid` will be **false** and it will not enter the trade. This avoids buying at the ceiling.
D. TP and SL Calculation (Anchored to the Level)
pinescript
take_profit = level_base + (step_size * tp_mult)
stop_loss = level_base - (step_size * sl_mult)
Note that we use `level_base` and not `close`.
-If you entered because the price broke 63,000, your SL is calculated starting from 63,000.
-If your SL is 1.0x, your stop will be exactly at 60,000.
This is crucial: If you bought "expensive" (e.g., at 63,500), your real stop is wider (3,500 points) than if you bought cheap (63,100). Because you filter out expensive entries, you protect your Risk/Reward ratio.
E. Visual Management (`var line`)
The code uses `var` variables to remember the TP and SL lines and the `line.set_x2` function to stretch them to the right while the operation remains open, providing that visual reference on the chart until the trade ends.
Workflow Summary
Strategy Parameters:
Total Capital: $20,000
We will use 10% of total capital per trade.
Commissions: 0.1% per trade.
TP: 1.4
SL: 1
Step Size (Grid): 3,000
We use the 200 EMA as a trend filter.
Feel free to experiment with the parameters to your liking. Cheers.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
📖Revista El Especulador:
drive.google.com/file/d/1Fs8l9xSpZIy5haCb5l0HWzgeAanOifs_/view?usp=drivesdk
👉t.me/ElEspeculador96 (Telegram)
drive.google.com/file/d/1Fs8l9xSpZIy5haCb5l0HWzgeAanOifs_/view?usp=drivesdk
👉t.me/ElEspeculador96 (Telegram)
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
📖Revista El Especulador:
drive.google.com/file/d/1Fs8l9xSpZIy5haCb5l0HWzgeAanOifs_/view?usp=drivesdk
👉t.me/ElEspeculador96 (Telegram)
drive.google.com/file/d/1Fs8l9xSpZIy5haCb5l0HWzgeAanOifs_/view?usp=drivesdk
👉t.me/ElEspeculador96 (Telegram)
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.