Indicator · Pine Script v5 · Own pane

My Script SMA 100

by nosscafe66· code credited to hozumihukuda1112

A very small personal test script that plots a 100-period simple moving average of the close in a separate pane.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code57
Settings0inputs
LicenceNone statedfile: MPL-2.0
Last update4 years ago30 Jun 2022

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 indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

57 lines of Pine Script v5 from match.txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

match.txt
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © hozumihukuda1112

//@version=5
indicator("マイスクリプト")
//plot(close)
plot(ta.sma(close,100))
float sma00 = ta.sma(close,100)
plot(sma00, color = #FF6D00)
indicator("if")
if close[1] < sma00
    plot()
else if close[1] > sma00
    plot(sma00)
else
    plot(sma00)

//double MA00 = 0
//double MA01 = 0
//int up_flag = 0
//int down_flag = 0

//extern int ma_period = 20
//extern bool alert_push = true

// 初期化関数
//int init()
//{
//   return(0)
//}

// 指標計算関数
//int start()
//{
//plot( ema (close ,20) ,color=red ) 
   //MA00 = iMA(NULL, 0, ma_period, 0, MODE_EMA, PRICE_CLOSE, 0)
   //MA01 = iMA(NULL, 0, ma_period, 0, MODE_EMA, PRICE_CLOSE, 1)
   
   //if(MA01 > Close[1] && MA00 <= Close[0]){
   //    if(alert_push == true && up_flag == 0){
   //        Alert("MAタッチ(下から上):アラート通知");
   //        SendNotification("MAタッチ(下から上):プッシュ通知")
   //        up_flag = 1;
   //    down_flag = 0;
   //    }
   //}
   
   //if(MA01 < Close[1] && MA00 >= Close[0]){
   //    if(alert_push == true && down_flag == 0){
   //        Alert("MAタッチ(上から下):アラート通知")
   //        SendNotification("MAタッチ(上から下):プッシュ通知")
   //        down_flag = 1
   //        up_flag = 0
   //    }
   //}
   //      return(0)
//}

Overview

The code contains a second indicator declaration and a basic condition comparing the previous close with that average, but no inputs, signals or risk logic. It is best read as an experiment and not a finished tool.

Details

Published by

nosscafe66 on GitHub

Code credit

hozumihukuda1112, as written in the script's header

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Moving averages

Markets

Any symbol

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.

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

948 stars

The Derivative Oscillator calculates a double-exponentially smoothed Relative Strength Index (RSI) and subtracts its Simple Moving Average (SMA) to form the main oscillator line. A secondary signal line is plotted using an SMA of the main oscillator values. Th

Indicator v4 Oscillators & momentumMoving averages
Updated 11 days ago · GPL-3.0 GitHub repository of Derivative Oscillator

Beep Boop

by magic8bot
409 stars

This indicator calculates a modified MACD oscillator and signal line alongside a trend EMA filter, plotting the output as a stylized column histogram in a separate pane. Instead of plotting true MACD distance, it quantifies positive and negative histogram mome

Indicator v4 Oscillators & momentumTrend
Updated 3 years ago · MIT GitHub repository of Beep Boop

MACD

by Alorse
330 stars

This indicator calculates and plots the standard Moving Average Convergence Divergence oscillator in a separate pane. It computes the difference between a fast and slow moving average, derives a signal line through smoothing, and plots a histogram representing

Indicator v4 Oscillators & momentumMoving averages
Updated 2 months ago · None stated GitHub repository of MACD
318 stars

Calculates and plots moving averages on selected VIX volatility terms (VIX9D, VIX, VIX3M, or VIX6M) in a separate pane. The script computes user-defined short and long moving averages using EMA or SMA. It shades the background red when the short-term moving av

Indicator v5 Volatility & bandsMoving averages
Updated 2 months ago · MIT GitHub repository of [TVT] VIX Short Term Danger

f_push()

by ricardosantos79
261 stars

This demonstration script implements a custom FIFO array push function in Pine Script v4. It maintains a fixed-length array of closing prices by popping the oldest value and inserting the newest close at the front index. The script plots the newest price eleme

Indicator v4 Moving averages
Updated 4 years ago · None stated GitHub repository of f_push()
257 stars

Donald SPX - Options Trading is an indicator designed to assist SPX index option traders by tracking session benchmarks and multi-timeframe moving average data. It calculates a 200-period weighted moving average (WMA) and requests multi-timeframe bar data from

Indicator v5 Moving averagesScreeners & dashboards Repaints
Updated 6 weeks ago · None stated GitHub repository of Donald SPX - Options Trading

More indicators

Trade Your Charts With a Regulated Broker

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

Compare brokers