0% found this document useful (0 votes)
1K views6 pages

Pine Editor Scripts

The document contains Pine Script code for three technical indicators: the Trend Trader Strategy, Schaff Trend Cycle (STC), and Moving Average Ribbon. Each indicator includes user-defined inputs for customization and alerts for trading signals based on specific conditions. The scripts are intended for educational purposes and visualize market trends through color-coded bars and moving averages.

Uploaded by

keveyif784
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views6 pages

Pine Editor Scripts

The document contains Pine Script code for three technical indicators: the Trend Trader Strategy, Schaff Trend Cycle (STC), and Moving Average Ribbon. Each indicator includes user-defined inputs for customization and alerts for trading signals based on specific conditions. The scripts are intended for educational purposes and visualize market trends through color-coded bars and moving averages.

Uploaded by

keveyif784
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

pine editor scripts

//@version=5

////////////////////////////////////////////////////////////

// Copyright by HPotter v1.0 21/01/2021

// This is plots the indicator developed by Andrew Abraham

// in the Trading the Trend article of TASC September 1998

//

// WARNING:

// - For purpose educate only

// - This script to change bars colors.

////////////////////////////////////////////////////////////

indicator(title='Trend Trader Strategy', overlay=true)

Length = input.int(21, minval=1)

Multiplier = input.float(3, minval=0.000001)

avgTR = ta.wma(ta.atr(1), Length)

highestC = ta.highest(Length)

lowestC = ta.lowest(Length)

hiLimit = highestC[1] - avgTR[1] * Multiplier

loLimit = lowestC[1] + avgTR[1] * Multiplier

ret = 0.0

pos = 0.0

ret:= close > hiLimit and close > loLimit ? hiLimit :

close < loLimit and close < hiLimit ? loLimit : nz(ret[1], close)
pos:= close > ret ? 1 :close < ret ? -1 : nz(pos[1], 0)

if pos != pos[1] and pos == 1

alert("Color changed - Buy", alert.freq_once_per_bar_close)

if pos != pos[1] and pos == -1

alert("Color changed - Sell", alert.freq_once_per_bar_close)

barcolor(pos == -1 ? color.red : pos == 1 ? color.green : color.blue)

plot(ret, color=color.new(color.blue, 0), title='Trend Trader Strategy')

//@version=5

//[SHK] STC colored indicator

//https://www.tradingview.com/u/shayankm/

indicator(title='[SHK] Schaff Trend Cycle (STC)', shorttitle='STC',


overlay=false)

EEEEEE = input(12, 'Length')

BBBB = input(26, 'FastLength')

BBBBB = input(50, 'SlowLength')

AAAA(BBB, BBBB, BBBBB) =>

fastMA = ta.ema(BBB, BBBB)

slowMA = ta.ema(BBB, BBBBB)

AAAA = fastMA - slowMA

AAAA

AAAAA(EEEEEE, BBBB, BBBBB) =>

AAA = input(0.5)
var CCCCC = 0.0

var DDD = 0.0

var DDDDDD = 0.0

var EEEEE = 0.0

BBBBBB = AAAA(close, BBBB, BBBBB)

CCC = ta.lowest(BBBBBB, EEEEEE)

CCCC = ta.highest(BBBBBB, EEEEEE) - CCC

CCCCC := CCCC > 0 ? (BBBBBB - CCC) / CCCC * 100 : nz(CCCCC[1])

DDD := na(DDD[1]) ? CCCCC : DDD[1] + AAA * (CCCCC - DDD[1])

DDDD = ta.lowest(DDD, EEEEEE)

DDDDD = ta.highest(DDD, EEEEEE) - DDDD

DDDDDD := DDDDD > 0 ? (DDD - DDDD) / DDDDD * 100 : nz(DDDDDD[1])

EEEEE := na(EEEEE[1]) ? DDDDDD : EEEEE[1] + AAA * (DDDDDD - EEEEE[1])

EEEEE

mAAAAA = AAAAA(EEEEEE, BBBB, BBBBB)

mColor = mAAAAA > mAAAAA[1] ? color.new(color.green, 20) :


color.new(color.red, 20)

if mAAAAA[3] <= mAAAAA[2] and mAAAAA[2] > mAAAAA[1] and mAAAAA > 75

alert("Red", alert.freq_once_per_bar)

if mAAAAA[3] >= mAAAAA[2] and mAAAAA[2] < mAAAAA[1] and mAAAAA < 25

alert("Green", alert.freq_once_per_bar)
plot(mAAAAA, color=mColor, title='STC', linewidth=2)

ul = plot(25, color=color.new(color.gray, 70))

ll = plot(75, color=color.new(color.gray, 70))

fill(ul, ll, color=color.new(color.gray, 96))

//@version=5

indicator("Moving Average Ribbon", shorttitle="MA Ribbon", overlay=true,


timeframe="", timeframe_gaps=true)

ma(source, length, type) =>

type == "SMA" ? ta.sma(source, length) :

type == "EMA" ? ta.ema(source, length) :

type == "SMMA (RMA)" ? ta.rma(source, length) :

type == "WMA" ? ta.wma(source, length) :

type == "VWMA" ? ta.vwma(source, length) :

na

show_ma1 = input(true , "MA №1", inline="MA #1")

ma1_type = input.string("SMA" , "" , inline="MA #1", options=["SMA",


"EMA", "SMMA (RMA)", "WMA", "VWMA"])

ma1_source = input(close , "" , inline="MA #1")

ma1_length = input.int(20 , "" , inline="MA #1", minval=1)

ma1_color = input(#f6c309, "" , inline="MA #1")

ma1 = ma(ma1_source, ma1_length, ma1_type)

plot(show_ma1 ? ma1 : na, color = ma1_color, title="MA №1")


show_ma2 = input(true , "MA №2", inline="MA #2")

ma2_type = input.string("SMA" , "" , inline="MA #2", options=["SMA",


"EMA", "SMMA (RMA)", "WMA", "VWMA"])

ma2_source = input(close , "" , inline="MA #2")

ma2_length = input.int(50 , "" , inline="MA #2", minval=1)

ma2_color = input(#fb9800, "" , inline="MA #2")

ma2 = ma(ma2_source, ma2_length, ma2_type)

plot(show_ma2 ? ma2 : na, color = ma2_color, title="MA №2")

show_ma3 = input(true , "MA №3", inline="MA #3")

ma3_type = input.string("SMA" , "" , inline="MA #3", options=["SMA",


"EMA", "SMMA (RMA)", "WMA", "VWMA"])

ma3_source = input(close , "" , inline="MA #3")

ma3_length = input.int(100 , "" , inline="MA #3", minval=1)

ma3_color = input(#fb6500, "" , inline="MA #3")

ma3 = ma(ma3_source, ma3_length, ma3_type)

plot(show_ma3 ? ma3 : na, color = ma3_color, title="MA №3")

show_ma4 = input(true , "MA №4", inline="MA #4")

ma4_type = input.string("SMA" , "" , inline="MA #4", options=["SMA",


"EMA", "SMMA (RMA)", "WMA", "VWMA"])

ma4_source = input(close , "" , inline="MA #4")

ma4_length = input.int(200 , "" , inline="MA #4", minval=1)

ma4_color = input(#f60c0c, "" , inline="MA #4")

ma4 = ma(ma4_source, ma4_length, ma4_type)


plot(show_ma4 ? ma4 : na, color = ma4_color, title="MA №4")

You might also like