Strategy · Pine Script v4 · Own pane

10PreBuyer

by hasnocool

10PreBuyer is a dip-buying strategy that submits limit orders below recent price action using a discounted Hull Moving Average (HMA).

View on GitHub

GitHub stars106on the repository
Pine versionv4older, still runs
Lines of code18
Settings5inputs
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

18 lines of Pine Script v4 from 10PreBuyer.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

10PreBuyer.pine
//@version=4
// >> 3D 1.2 target, .9 loss
strategy("10PreBuyer", "", 1)
length              = input(10)
multiplier          = input(0.90, step=0.01)
highest             = input(2) 
prof_trg_perc       = input(1.2, "Prof TRG %",  step=0.05)
loss_trg_perc       = input(0.9, "Loss TRG %",  step=0.05)
teemo               = highest(hma(high, length), highest) * multiplier // teemo
strategy.entry("enter", true, limit=teemo, alert_message = "Enter > DONE >> V3.5 Perc Buyer") // Pre-Place ENTER WITH LIMIT ORDERS and wait for them to fill !!! If they don't fill, then move the order limit price up in line with previous candle's teemo amount
prof_line           = strategy.position_avg_price * prof_trg_perc // if no new trade, these numbers will just be the previous trades numbers
loss_line           = strategy.position_avg_price * loss_trg_perc
strategy.exit("exit", "enter", limit=prof_line, stop=loss_line, alert_message = "Exit > DONE >> V3.5 Perc Buyer")
plot(teemo,         "Place Limit orders and hope 4 Fill",        color.blue, 2) // blue
plot(prof_line,     "ProfLine",    #00ff00, 2) // green
plot(loss_line,     "LossLine",    #ff0000, 2) // red
barcolor(strategy.opentrades > 0 ? color.yellow : na)
Expand (30 lines)

Overview

10PreBuyer calculates the highest HMA value of high prices over a selected period, multiplied by a percentage discount factor, and places a pending buy limit order at that level. Once filled, it exits using fixed percentage take-profit and stop-loss targets calculated from the average execution price. The script plots the limit entry, target, and stop lines directly on the chart.

Details

Published by

hasnocool on GitHub

Type

Strategy, Pine Script v4

Draws

Separate pane below the chart

Category

Moving averages, Mean reversion

Markets

Crypto

Timeframes

M1-M5

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
lengthint10length
multiplierfloat0.90multiplier
highestint2highest
Prof TRG %float1.2prof_trg_perc
Loss TRG %float0.9loss_trg_perc
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

Greeffer BB Strategy

by SammyEnigma
18 stars

This strategy combines Bollinger Bands, Bollinger Band Width, and the Relative Strength Index (RSI) for mean-reversion trades. It enters long when price crosses below the lower band with oversold RSI, or when band width contracts under low volatility. Short en

Strategy v4 Mean reversionOscillators & momentum
Updated 6 years ago · None stated GitHub repository of Greeffer BB Strategy

VT-Lite

by algoboy-kevin
4 stars

VT-Lite is a Pine Script v5 mean-reversion strategy that draws in a separate pane. It sizes equity-percent entries from a short-term EMA and ATR band distance, with a volatility EMA threshold and a choice of close, low, or ATR-band source. It can add reentries

Strategy v5 Mean reversionVolatility & bands
Updated 2 years ago · None stated GitHub repository of VT-Lite

Alpy VIX

by avatar-lavventura
2 stars

This strategy combines the Williams Vix Fix oscillator with volume-weighted moving average (VWMA) bands to identify reversal entries. It plots the VIX Fix histogram and optional Bollinger and percentile bands in a separate pane. Long entries trigger when the o

Strategy v4 Volatility & bandsMoving averages Repaints
Updated 7 months ago · None stated GitHub repository of Alpy VIX
2 stars

This strategy plots in a separate pane and tests a selected oscillator with one of six entry logics: moving average, moving-average crossover, zero cross, extremes, mean reversion, or take profit. Users scale and time-adjust one of three oscillators and can li

Strategy v4 Oscillators & momentumMoving averages
Updated 8 months ago · None stated GitHub repository of Oscillator Evaluator (Analysis tool)

Oversold

by kat3samsin
2 stars

The oversold strategy identifies oversold conditions using the relative strength index with a 14 period. It applies an arithmetic linear moving average with a 20 period for trend filtering and requires the price to stay within 15 percent of this average. Stoch

Strategy v4 Mean reversionOscillators & momentum
Updated 5 years ago · MIT GitHub repository of Oversold

Eth Strategy

by samliu0206
1 stars

This script aggregates spot and perpetual futures price data across multiple cryptocurrency exchanges to calculate a volume-weighted futures premium index. It computes the log ratio between perpetual futures and spot prices, applies a user-selected moving aver

Strategy v4 Moving averagesMean reversion
Updated 4 years ago · None stated GitHub repository of Eth 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