0% found this document useful (0 votes)
6 views4 pages

Python Code

The document outlines a trading script that includes settings for enabling stop-loss and take-profit areas, as well as plotting various exponential moving averages (EMAs) and channels. It incorporates features for trend detection, reversal signals, and channel breakouts, allowing users to customize parameters such as amplitude and channel deviation. Additionally, it provides visual signals for upward and downward reversals based on specific thresholds.

Uploaded by

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

Python Code

The document outlines a trading script that includes settings for enabling stop-loss and take-profit areas, as well as plotting various exponential moving averages (EMAs) and channels. It incorporates features for trend detection, reversal signals, and channel breakouts, allowing users to customize parameters such as amplitude and channel deviation. Additionally, it provides visual signals for upward and downward reversals based on specific thresholds.

Uploaded by

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

riskmanage = input.

bool(false, "On/Off -Strength ",inline = '1', group="Enable


Stop-loss/take-profit areas")
tpstrength = input.float(1,"",tooltip = "" ,inline = '1',group="Enable Stop-
loss/take-profit areas",display = display.none)
TP1 = input.bool(true, "TP 1 ",inline = '2', group="Enable Stop-loss/take-
profit areas")
TP2 = input.bool(true, "TP 2 ",inline = '2', group="Enable Stop-loss/take-
profit areas") 2, editable=false)
k2 = plot(ta.ema(upperKC2, 50), "", na, editable=false)
k3 = plot(ta.ema(upperKC3, 50), "", na, editable=false)
k4 = plot(ta.ema(upperKC4, 50), "", na, editable=false)
k5 = plot(ta.ema(lowerKC4, 50), "", na, editable=false)
k6 = plot(ta.ema(lowerKC3, 50), "", na, editable=false)
k7 = plot(ta.ema(lowerKC2, 50), "", na, editable=false)
k8 = plot(ta.ema(lowerKC1, 50), "", color = upTier,
style=plot.style_circles,linewidth = 2, editable=false)
fill(k1, k2, uphighColor , editable=false)
fill(k2, k3, uplowColor , editable=false)
//fill(k3, k4, color.new(red2, 90) , editable=false)
//fill(k5, k6, color.new(green2, 90) , editable=false)
fill(k6, k7, downlowColor , editable=false)
fill(k7, k8, downhighColor, editable=false)

//Tralling Step

amplitude = 3//input(title='Amplitude', defval=2)


channelDeviation = 2//input(title='Channel Deviation', defval=2)
showArrows = false//input(title='Show Arrows', defval=true)
showChannels = false//input(title='Show Channels', defval=true)
src5 = close
len_a = 14

up_a = ta.rma(math.max(ta.change(src5), 0), len_a)

var int trend = 0


var int nextTrend = 0
var float maxLowPrice = nz(low[1], low)
var float minHighPrice = nz(high[1], high)

var float up1 = 0.0


var float down1 = 0.0
float atrHigh = 0.0
float atrLow = 0.0
float arrowUp = na
float arrowDown = na

atr2 = ta.atr(100) / 2
dev = channelDeviation * atr2

highPrice1 = high[math.abs(ta.highestbars(amplitude))]
lowPrice1 = low[math.abs(ta.lowestbars(amplitude))]
highma = ta.sma(high, amplitude)
lowma = ta.sma(low, amplitude)

if nextTrend == 1
maxLowPrice := math.max(lowPrice1, maxLowPrice)

if highma < maxLowPrice and close < nz(low[1], low)


trend := 1
nextTrend := 0
minHighPrice := highPrice1
minHighPrice
else
minHighPrice := math.min(highPrice1, minHighPrice)

if lowma > minHighPrice and close > nz(high[1], high)


trend := 0
nextTrend := 1
maxLowPrice := lowPrice1
maxLowPrice

if trend == 0
lineTpSl(cond, y, color, style) =>
line lineTpSl = enableTpSlAreas and cond ? line.new(bar_index - (trigger ?
countBull : countBear), y, bar_index + 1, y, xloc.bar_index, extend.none, color,
style) : na
line.delete(lineTpSl[1])
lineTpSl(none, entry_y, color.orange, line.style_dashed)
lineTpSl(none, stop_y , color.red , line.style_solid )
lineTpSl(useTP1 and multTP1 != 0, tp1_y, color.green, line.style_dotted)
lineTpSl(useTP2 and multTP2 != 0, tp2_y, color.green, line.style_dotted)
lineTpSl(useTP3 and multTP3 != 0, tp3_y, color.green, line.style_dotted)

// Reversal Signals
enableReversal = true
ReversalInputs = 25//input.int(14, minval=1, title="Reversals Sensitivity",
group="Reversal Settings")
overbought = 75//input(75, 'Reversal Down Level', group='Reversal Settings')
oversold = 25//input(25, 'Reversal Up Level', group='Reversal Settings')

upwardd = ta.rma(math.max(ta.change(close), 0), ReversalInputs)


dnwardd = ta.rma(-math.min(ta.change(close), 0), ReversalInputs)
source = dnwardd == 0 ? 100 : upwardd == 0 ? 0 : 100 - (100 / (1 + upwardd /
dnwardd))

revdn = ta.crossunder(source, overbought) and enableReversal


revup = ta.crossover(source, oversold) and enableReversal

plotshape(revup, 'Reversal Up Signal', shape.labelup, location.belowbar, #b300ff4f,


text='', size=size.small, textcolor=color.white)
plotshape(revdn, 'Reversal Down Signal', shape.labeldown, location.abovebar,
#ca009e79, text='', size=size.small, textcolor=color.white)

//Channel Breakouts
bars = 3//input(3)
checkbox = true//input.bool(title= "color chenging by trend", defval=true)

ph = ta.pivothigh(high, bars, bars)


pl = ta.pivotlow(low, bars, bars)

//INIT VARIABLES
var int ph_uptrend_flag = 0
var float ph_valid1 = 0
var float ph_valid2 = 0
var float ph_valid3 = 0
var float ph_valid4 = 0
var float ph_valid5 = 0S

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy