Strategy · Pine Script v5 · Own pane

My Custom Strategy 2

by might-tree

This strategy calculates a 20-period volume-weighted moving average of the low, a 200-period Hull moving average of the high, and 25-period highest close values.

View on GitHub

GitHub stars4on the repository
Pine versionv5runs as is
Lines of code24
Settings0inputs
LicenceNone statedfile: MPL-2.0
Last update3 years ago2 Aug 2023

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

24 lines of Pine Script v5 from Custom_Strategies/My_Strategy_2.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

My_Strategy_2.pine
//Run the following Script on PINE EDITOR or any platform supporting Pine Script

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © might-tree

//@version=5
strategy("My Custom Strategy 2", overlay=false, margin_long=100, margin_short=100)

my_vwma=ta.vwma(low,20)
my_hma=ta.hma(high,200)

highestHigh = ta.highest(close, 25)[1]
lowestLow   = ta.lowest(close, 25)[1]
randomPoint    = (highestHigh + lowestLow)/5

if high > highestHigh and close>my_vwma and close>my_hma
    strategy.entry("Enter Long", strategy.long)

if ta.crossunder(low, close)
    strategy.close("Enter Long", comment="Exit Long")

plot(my_vwma, color=color.green)
plot(my_hma, color=color.red)
plot(close, color=color.blue)

Overview

My Custom Strategy 2 enters a long position when the high breaks above the previous highest close while the close remains above both moving averages. It exits positions when the low crosses under the close. The script draws the two moving averages and the close price in a separate pane below the chart. It contains no adjustable inputs, lacks predefined stop loss or take profit orders, and does not overlay directly on price bars.

Details

Published by

might-tree on GitHub

Draws

Separate pane below the chart

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • The strategy enters trades without a stop loss
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

257 stars

This strategy plots running pivot highs as red R circles and pivot lows as blue S circles directly on the price chart. It computes an EMA 3 and a Cto trend line from close prices, then generates long signals on upward EMA-Cto crossovers combined with price pos

Strategy v6 TrendMoving averages Repaints
Updated 7 weeks ago · None stated GitHub repository of Best Chart 1m Strategy Candle Bar

12/26-IT Strategy

by hasnocool
106 stars

This strategy executes trades based on crossovers between a 12-period and a 26-period exponential moving average (EMA). Long positions can be filtered by pivot resistance breakouts and RSI boundary ranges. For trade management, it provides two configurable par

Strategy v5 TrendMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of 12/26-IT Strategy

均线突破交易系统

by tangly1024
76 stars

This strategy trades long breakouts of a fast and a slow moving average on the price chart. It opens a long position when price crosses above either average, using a percentage of equity as size. It reduces the position by a set share when the high reaches the

Strategy v5 TrendMoving averages
Updated 5 months ago · None stated GitHub repository of 均线突破交易系统
43 stars

This strategy executes trades on short-term cryptocurrency charts using a combination of pivot support and resistance levels and a multi-pole smoothed trend filter. Entries trigger when price crosses the smoothed trend line and confirms above or below a short-

Strategy v5 TrendBreakout Repaints
Updated 2 years ago · None stated GitHub repository of SOL 1m - Strategy Candle Bar

ADA4H Optuna Strategy

by skywalker0803r
42 stars

This strategy trades longs and shorts on the price chart. Long entries require a close above the prior Donchian high, a close above a long-term SMA, and RSI above a threshold, with size set as a percentage of equity. Long exits use a stop at the prior Donchian

Strategy v5 TrendOscillators & momentum
Updated 2 months ago · None stated GitHub repository of ADA4H Optuna Strategy

More Trend scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers