(Req) Translation of codes for TS

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

(Req) Translation of codes for TS

Postby daniel.kovacik » Fri May 08, 2015 6:27 am

Hello,

could you please translate these codes for TS?

Trend entry indicator
Code: Select all
study("Trend entry", overlay=true)
sae = input(true, title="Show Aggressive Entry?, Or Use as Alert To Potential Conservative Entry?")
sce = input(true, title="Show Conservative Entry?")
st = input(true, title="Show Trend Arrows at Top and Bottom of Screen?")
def = input(false, title="Only Choose 1 - Either Conservative Entry Arrows or 'B'-'S' Letters")
pa = input(true, title="Show Conservative Entry Arrows?")
sl = input(false, title="Show 'B'-'S' Letters?")

//EMA Definitions
emaSlow = ema(close, 62)
emaFast = ema(close, 38)
//Aggressive Entry or Alert To Potential Trade
pullbackUpT() => emaFast > emaSlow and close < emaFast
pullbackDnT() => emaFast < emaSlow and close > emaFast
//Conservative Entry Code For Highlight Bars
entryUpT() => emaFast > emaSlow and close[1] < emaFast and close > emaFast
entryDnT() => emaFast < emaSlow and close[1] > emaFast and close < emaFast
//Conservative Entry True/False Condition
entryUpTrend = emaFast > emaSlow and close[1] < emaFast and close > emaFast ? 1 : 0
entryDnTrend = emaFast < emaSlow and close[1] > emaFast and close < emaFast ? 1 : 0
//Define Up and Down Trend for Trend Arrows at Top and Bottom of Screen
upTrend = emaFast >= emaSlow
downTrend = emaFast < emaSlow
//Definition for Conseervative Entry Up and Down PlotArrows
codiff = entryUpTrend == 1 ? entryUpTrend : 0
codiff2 = entryDnTrend == 1 ? entryDnTrend : 0
//Color definition for Moving Averages
col = emaFast > emaSlow ? lime : emaFast < emaSlow ? red : yellow
//Moving Average Plots and Fill
p1 = plot(emaSlow, title="Slow MA", style=linebr, linewidth=4, color=col)
p2 = plot(emaFast, title="Slow MA", style=linebr, linewidth=2, color=col)
fill(p1, p2, color=silver, transp=50)
//Aggressive Entry, Conservative Entry Highlight Bars
barcolor(sae and pullbackUpT() ? yellow : sae and pullbackDnT() ? yellow : na)
barcolor(sce and entryUpT() ? aqua : sce and entryDnT() ? aqua : na)
//Trend Triangles at Top and Bottom of Screen
plotshape(st and upTrend ? upTrend : na, title="Conservative Buy Entry Triangle",style=shape.triangleup, location=location.bottom, color=lime, transp=0, offset=0)
plotshape(st and downTrend ? downTrend : na, title="Conservative Short Entry Triangle",style=shape.triangledown, location=location.top, color=red, transp=0, offset=0)
//Plot Arrows OR Letters B and S for Buy Sell Signals
plotarrow(pa and codiff ? codiff : na, title="Up Entry Arrow", colorup=lime, maxheight=30, minheight=30, transp=0)
plotarrow(pa and codiff2*-1 ? codiff2*-1 : na, title="Down Entry Arrow", colordown=red, maxheight=30, minheight=30, transp=0)
plotchar(sl and codiff ? low - tr : na, title="Buy Entry", offset=0, char='B', location=location.absolute, color=lime, transp=0)
plotchar(sl and codiff2 ? high + tr : na, title="Short Entry", offset=0, char='S', location=location.absolute, color=red, transp=0)


Transient zones
Code: Select all
study("Transient Zones v1.1", "TZ", overlay=true)

//inputs
h_left = input(title="H left", type=integer, defval=10)
h_right = input(title="H right", type=integer, defval=10)
sample_period = input(title="Sample bars for % TZ", type=integer, defval=5000)
show_ptz = input(title="Show PTZ", type=bool, defval=true)
show_channel = input(title="Show channel", type=bool, defval=true)

//barCount = nz(barCount[1]) + 1
//check history and realtime PTZ
h_left_low = lowest(h_left)
h_left_high = highest(h_left)
newlow = low <= h_left_low
newhigh = high >= h_left_high
plotshape(newlow and show_ptz, style=shape.triangledown, location=location.belowbar, color=red)
plotshape(newhigh and show_ptz, style=shape.triangleup, location=location.abovebar, color=green)
channel_high = plot(show_channel ? h_left_low : 0, color=silver)
channel_low = plot (show_channel ? h_left_high : 0, color=silver)

//check true TZ back in history
central_bar_low = low[h_right + 1]
central_bar_high = high[h_right + 1]
full_zone_low = lowest(h_left + h_right + 1)
full_zone_high = highest(h_left + h_right + 1)
central_bar_is_highest = central_bar_high >= full_zone_high
central_bar_is_lowest = central_bar_low <= full_zone_low
plotarrow(central_bar_is_highest ? -1 : 0, offset=-h_right-1)
plotarrow(central_bar_is_lowest ? 1 : 0, offset=-h_right-1)

//TZ probability calc
x = central_bar_is_highest ? 1 : 0
high_bar_tz_count = cum(x)

y = central_bar_is_lowest ? 1 : 0
low_bar_tz_count = cum(y)

total_tz = high_bar_tz_count + low_bar_tz_count
percent_tz_high = (high_bar_tz_count / sample_period) * 100
//plot(percent_tz_high, color = lime, transp=100)
percent_tz_low = (low_bar_tz_count / sample_period) * 100
//plot(low_bar_tz_count, color=red, transp=100)
percent_total_tz = (percent_tz_high + percent_tz_low)
plot(percent_total_tz, color=black, transp=100)

//PTZ probability calc
i = newhigh ? 1 : 0
high_bar_ptz_count = cum(i)

j = newlow ? 1 : 0
low_bar_ptz_count = cum(j)

total_ptz = high_bar_ptz_count + low_bar_ptz_count
percent_ptz_high = (high_bar_ptz_count / sample_period) * 100
//plot(percent_ptz_high, color=green, transp=100)
percent_ptz_low = (low_bar_ptz_count / sample_period) * 100
//plot(percent_ptz_low, color=maroon, transp=100)
percent_total_ptz = (percent_ptz_high + percent_ptz_low)
plot(percent_total_ptz, color=navy,  transp=100)

//PTZ resolving probability calc
percent_ptz_resolved = (1 - (total_tz / total_ptz)) * 100
plot(percent_ptz_resolved, color=gray,  transp=100)


Renko stop
Code: Select all
study("Renko Stop", shorttitle="RS&G", overlay=true)
decay = input(250, type=float) * syminfo.mintick
detection = input(1)
smooth = input(2)
hh = highest(detection)
ll = lowest(detection)

rprice = round(close/decay)*decay
predosc = nz(dosc[1], rprice)
dosc = hh > predosc + decay and hh+decay < predosc + decay ? predosc + decay :
        hh > predosc + decay and hh+decay > predosc + decay ? rprice :
        ll < predosc - decay and ll-decay > predosc - decay ? predosc - decay :
        ll < predosc - decay and ll-decay < predosc - decay ? rprice : predosc

///////////////
//bricksize = input(100) * syminfo.mintick
smoothprice = sma(close, smooth)

ropen = dosc

direction = ropen > ropen[1] ? 1 : ropen < ropen[1] ? -1 : nz(direction[1])

//rc = direction == 1 ? green : direction == -1 ? maroon : na

//plot(signal, style=circles, color=rc, linewidth=3, join=true)
//p00 = plot(ropen, style=cross, color=rc, linewidth=3)

rma = sma(ropen, input(12))
p0 = plot(rma, color=black, linewidth=2)

signal = cross(smoothprice, rma) ? rma : na
signalcolor = close > rma ? green : close < rma ? maroon : na
plot(signal, color=signalcolor, style=circles, linewidth=4)

topfill = plot(max(smoothprice, rma))
botfill = plot(min(smoothprice, rma))
fill(p0, topfill, color=green, transp=75)
fill(p0, botfill, color=maroon, transp=75)
//fill(p00, p01, color=gray, transp=75)
//signal = cross(smoothprice, ropen) and direction == 1 ? green :
//        cross(smoothprice, ropen) and direction == -1 ? maroon : na
//bgcolor(signal ? signalcolor : na, transp=70)


Murrey's oscillator
Code: Select all
study(title="Murrey's Oscillator", shorttitle="MMLO", overlay=false, precision = 2)

// Inputs
length = input(100, minval = 10, title = "Look back Length")
mult = input(0.125, title = "Mutiplier; Only Supports 0.125 = 1/8")
lines = input(true, title= "Show Murrey Math Fractals")
bc = input(true, title = "Show Bar Colors Based On Oscillator")

// Donchanin Channel
hi = highest(high, length)
lo = lowest(low, length)
range = hi - lo
multiplier = (range) * mult
midline = lo + multiplier * 4

oscillator = (close - midline)/(range/2)

a = oscillator > 0 and oscillator < mult*2
b = oscillator > 0 and oscillator < mult*4
c = oscillator > 0 and oscillator < mult*6
d = oscillator > 0 and oscillator < mult*8

z = oscillator < 0 and oscillator > -mult*2
y = oscillator < 0 and oscillator > -mult*4
x = oscillator < 0 and oscillator > -mult*6
w = oscillator < 0 and oscillator > -mult*8

colordef = a ? #ADFF2F : b ? #32CD32 : c ? #3CB371 : d ? #008000 : z ? #CD5C5C : y ? #FA8072 : x ? #FFA07A : w ? #FF0000 : blue

plot (oscillator, color = colordef, title = "Murrey Math Oscillator", style = columns, transp = 60)
plot(0, title = "Zero Line", color = gray, linewidth = 4)

plot(lines == 1 ? mult*2 : na, title = "First Positive Quadrant", color = gray, linewidth = 1)
plot(lines == 1 ? mult*4 : na, title = "Second Positive Quadrant", color = gray, linewidth = 1)
p3 = plot(lines == 1 ? mult*6 : na, title = "Third Positive Quadrant", color = gray, linewidth = 2)
p4 = plot(lines == 1 ? mult*8 : na, title = "Fourth Positive Quadrant", color = gray, linewidth = 1)
plot(lines == 1 ? -mult*2 : na, title = "First Negative Quadrant", color = gray, linewidth = 1)
plot(lines == 1 ? -mult*4 : na, title = "Second Negative Quadrant", color = gray, linewidth = 1)
p2 = plot(lines == 1 ? -mult*6 : na, title = "Third Negative Quadrant", color = gray, linewidth = 2)
p1 = plot(lines == 1 ? -mult*8 : na, title = "Fourth Negative Quadrant", color = gray, linewidth = 1)

fill (p1,p2, color = orange)
fill (p3,p4, color = lime)

// Bar Color Oversold and Overbought
bcolor = bc == 1 ? colordef : na
barcolor(bcolor)


Thanks
Regards,
DK
Attachments
Trend entry.png
Trend entry
transient zone ok.png
Transient zones
renko stop ok.png
Renko stop
Murreys Oscillator.png
Murreys Oscillator
all 1 ok.png
Trendy entry, transient zones, Murreys Oscillator
all 2 ok.png
Trendy entry, transient zones, Murreys Oscillator, Trend stop
daniel.kovacik
FXCodeBase: Initiate
 
Posts: 163
Joined: Thu Jun 12, 2014 9:09 pm

Re: (Req) Translation of codes for TS

Postby Apprentice » Tue May 12, 2015 2:08 pm

Your request is added to the development list.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia





Return to Indicator and Signal Requests

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 14 guests