Strategy · Pine Script v5 · On the chart

BTC WaveTrend R:R=1:1.5

by hasnocool· code credited to TrendCrypto2022

This strategy calculates the WaveTrend oscillator from HLC3 averages and its smoothed difference to generate long signals on BTC price charts.

View on GitHub

GitHub stars106on the repository
Pine versionv5runs as is
Lines of code39
Settings8inputs
LicenceGPL-3.0
Last update2 years ago18 Sep 2024

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

39 lines of Pine Script v5 from BTC WaveTrend R-R=1-1.5.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

BTC WaveTrend R-R=1-1.5.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// ©TrendCrypto2022
//@version=5
strategy("4 - BTC WaveTrend R:R=1:1.5", overlay=true)
//WaveTrend indicator - author LazyBear
n1 = input(10, "Channel Length", group = "Set up WaveTrend")
n2 = input(21, "Average Length", group = "Set up WaveTrend")
oblv1 = input(60, "Over Bought Lv 1", group = "Set up WaveTrend")
oblv2 = input(53, "Over Bought Lv 2", group = "Set up WaveTrend")
oslv1 = input(-60, "Over Sold Lv 1", group = "Set up WaveTrend")
oslv2 = input(-53, "Over Sold Lv 2", group = "Set up WaveTrend")
 
ap = hlc3 
esa = ta.ema(ap, n1)
d = ta.ema(math.abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * d)
tci = ta.ema(ci, n2)
 
wt1 = tci
wt2 = ta.sma(wt1,4)
//Strategy
limitwt1 = input(20, "Limit value WT1 to open entry long", group = "Set up risk : reward")
buy = ta.crossover(wt1, wt2) and wt1 < limitwt1
if (buy)
    strategy.entry("Long", strategy.long)
//Set up risk : reward
rr = input(1.5, "Risk : Reward", group = "Set up risk : reward")
var float stoplosslevel  = na
if buy  and strategy.position_size==0
    stoplosslevel := math.min(low, low[1], low[2])
takeprofitlevel = strategy.position_avg_price + rr*(strategy.position_avg_price-stoplosslevel)
strategy.exit("Long", limit = takeprofitlevel, stop=stoplosslevel, comment="TP/SL")
//Plot SL and TP
p1=plot(strategy.position_size > 0 ? stoplosslevel : na, color=color.red, style=plot.style_linebr, title="SL")
p2=plot(strategy.position_size > 0 ? takeprofitlevel : na, color=color.lime, style=plot.style_linebr, title="TP")
p3=plot(strategy.position_size > 0 ? strategy.position_avg_price : na, color=color.silver, style=plot.style_linebr, title="Entry")
fill(p1, p3, color=color.red, transp = 90)
fill(p2, p3, color=color.green, transp = 90)
Expand (44 lines)

Overview

BTC WaveTrend R:R=1:1.5 enters positions when WT1 crosses above WT2 and stays below a limit value. Stop loss triggers at the recent bar low while take profit distance equals the risk-reward ratio times the risk amount. The script plots SL, TP, and entry price lines with color fills on the main price chart. Main settings change oscillator lengths, overbought-oversold levels, entry limit, and risk-reward ratio. It draws signals directly on the price chart with no separate pane.

Details

Published by

hasnocool on GitHub

Code credit

TrendCrypto2022, as written in the script's header

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

Oscillators & momentum, Moving averages

Markets

Crypto

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

analysisbtcusdtcryptocurrencydatapandaspythonsimulationtradingtradingview

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Channel Lengthint10n1
Average Lengthint21n2
Over Bought Lv 1int60oblv1
Over Bought Lv 2int53oblv2
Over Sold Lv 1int-60oslv1
Over Sold Lv 2int-53oslv2
Limit value WT1 to open entry longint20limitwt1
Risk : Rewardfloat1.5rr
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

330 stars

2 EMA/SMA + RSI Strategy [Alorse] combines three configurable moving averages with a short-period Relative Strength Index filter. It plots fast, slow, and trend moving averages on the price chart. Long entries trigger when the fast moving average is above the

Strategy v4 TrendOscillators & momentum
Updated 2 months ago · None stated GitHub repository of 2 EMA/SMA + RSI Strategy [Alorse]

Acrypto - Weighted Strategy

by AlbertoCuadra
318 stars

This strategy plots on the price chart and opens long or short positions when a weighted score from MACD, Stochastic RSI, RSI, Supertrend and a moving-average crossover exceeds a user-set trigger. Each component has its own weight and candle delay. Entries can

Strategy v5 TrendOscillators & momentum
Updated 3 years ago · Custom licence GitHub repository of Acrypto - Weighted Strategy

This strategy combines Arnaud Legoux Moving Average percentage price change calculations with an adaptive Gaussian Moving Average to generate trend-following signals. Long and short entries are triggered when the ALMA change calculation crosses above or below

Strategy v5 Moving averagesOscillators & momentum
Updated 6 weeks ago · None stated GitHub repository of ESM2024 - ALMA Smoothed Gaussian Moving Average

MACD Strategy

by TradersPost
218 stars

This overlay strategy is built around MACD inputs for a fast average, a slow average, and a signal line. Comments say the script keeps MACD values available and can draw a histogram and zero line in a separate pane, with an optional overlay on price. Settings

Strategy v6 Oscillators & momentumMoving averages
Updated 3 months ago · None stated GitHub repository of MACD Strategy
104 stars

This overlay strategy combines a machine-learning distance model with a MACD oscillator to open trades on the price chart. It compares recent history using cosine similarity or Euclidean and Lorentzian distance, then filters direction with selectable moving-av

Strategy v5 AI / machine learningOscillators & momentum
Updated 3 years ago · MIT GitHub repository of MLCEL and MACD Strategy

SMA RSI Strategy

by PythonForForex
64 stars

This strategy evaluates simple moving averages and the Relative Strength Index to generate trading signals. It calculates a 10-period SMA, a 30-period SMA, and a 14-period RSI. Long positions are entered when the fast SMA crosses above the slow SMA while RSI i

Strategy v5 TrendOscillators & momentum
Updated 4 years ago · None stated GitHub repository of SMA RSI Strategy

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers