PROTECTED SOURCE SCRIPT

xujie 策略

30
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org/MPL/2.0/
// © kaustime

//version=6
strategy("xujie 策略", overlay=true, fill_orders_on_standard_ohlc = true)


// my_ma(src,length,my_type="sma")=>
// ma = 0.0
// if my_type == 'sma'
// ma := ta.sma(src, length)
// if my_type == 'ema'
// ma := ta.ema(src, length)
// if my_type == 'wma'
// ma := ta.wma(src, length)
// if my_type == 'hma'
// ma := ta.hma(src, length)
// if my_type == 'rma'
// ma := ta.rma(src, length)
// if my_type == 'vwma'
// ma := ta.vwma(src, length)
// ma
// myt_type1 = input.string("sma",
// "fastma",options =["sma","ema","wma","hma","rma","vwma"],inline = "ma",group = "ma setting")
// int length1 = input.int(20,"fastma length",group = "ma setting")
// myt_type2 = input.string("sma",
// "slowma",options =["sma","ema","wma","hma","rma","vwma"],inline = "ma",group = "ma setting")
// int length2 = input.int(200,"slowma length",group = "ma setting")
// ma1 = my_ma(close,length1,myt_type1)
// ma2 = my_ma(close,length2,myt_type2)
// long_ma = ta.crossover(ma1,ma2)
// short_ma = ta.crossunder(ma1,ma2)
// plot(ma1,color=color.white,linewidth = 3)
// plot(ma2,color=color.red,linewidth = 3)

//----------------------------------------------------------------------------------------------------rsi지표


alertcondition(3 >= 2, title='Alert on Green Bar', message='Green Bar!')


rsilength = input.int(14,"data",group = "rsi")
sx = input.int(70,"우선",group = "rsi")
xx = input.int(30,"아래선",group = "rsi")
zx = input.int(50,"중선",group = "rsi")


rsi=ta.rsi(close,rsilength)
plot(rsi,"rsi")
hline(sx,"우선")
hline(xx,"아래선")
hline(zx,"중선")



//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
long_rsi = ta.crossover(rsi,xx)//아래선
long_close = ta.crossover(rsi,sx)//우선

short_rsi = ta.crossunder(rsi,sx)
short_close = ta.crossunder(rsi,xx)




//-------------------------------------------------------------------------- 윌리암스 지표
length = input.int(14, minval=1, title="길이",group = "williams'")
overbought = input.int(-20, title="Overbought Level",group = "williams'")// -20
oversold = input.int(-80, title="Oversold Level",group = "williams'") //-80

highestHigh = ta.highest(high, length)
lowestLow = ta.lowest(low, length)
percentR = -100 * (highestHigh - close) / (highestHigh - lowestLow)

// plot(percentR, title="Williams %R", color=color.blue, linewidth=2)
// hline(overbought, title="Overbought", color=color.red, linestyle=hline.style_dashed)
// hline(oversold, title="Oversold", color=color.green, linestyle=hline.style_dashed)
// hline(-50, title="Midpoint", color=color.gray, linestyle=hline.style_dotted)


//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
long_percentR = ta.crossover(percentR,oversold)//아래선
long_percentR_close = ta.crossover(percentR,overbought)//우선

short_percentR = ta.crossunder(percentR,overbought) //우선 -20
short_percentR_close = ta.crossunder(percentR,oversold)//아래선 -80


//----------------------------------------------------------------------------------------볼린저 밴드 지표

int bb1 = input.int(20,'길이',group = "bb")
int bb2 = input.int(2,'멀티',group = "bb")
bb_type = input.string("sma",'출처',options =["sma","ema","wma","hma","rma","vwma"],group = "bb")
f_bb(src, length, mult,bb_type='sma') =>
float basis = na
if bb_type == 'sma'
basis := ta.sma(src, length)
if bb_type == 'ema'
basis := ta.ema(src, length)
if bb_type == 'wma'
basis := ta.wma(src, length)
if bb_type == 'hma'
basis := ta.hma(src, length)
if bb_type == 'rma'
basis := ta.rma(src, length)
if bb_type == 'vwma'
basis := ta.vwma(src, length)

float dev = mult * ta.stdev(src, length)
[basis, basis + dev, basis - dev]

[pineMiddle, pineUpper, pineLower] = f_bb(close, bb1, bb2,bb_type)

// plot(pineMiddle,color=color.red) // 중선
// plot(pineUpper)//웃선
// plot(pineLower,color=color.white)//밎선
// plot(close,color = color.rgb(228, 243, 11))

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
bb_long = ta.crossover(close,pineLower)//웃선
bb_close = ta.crossunder(close,pineUpper)//웃선

short_bb = ta.crossunder(close,pineUpper) //우선
short_bb_close = ta.crossunder(close,pineLower)//아래선

if long_rsi and bb_long and long_percentR//and long_percentR and bb_long
alert("매수신호",alert.freq_all)
strategy.entry('long',strategy.long,alert_message = "매수신호")

if long_close and bb_close and long_percentR_close//and long_percentR and bb_long
strategy.close('long')



if short_rsi and short_bb and short_percentR//and long_percentR and bb_long
alert("매도신호",alert.freq_all)
strategy.entry('short',strategy.short,alert_message = "매도신호")

if short_close and short_bb_close //and long_percentR and bb_long
strategy.close('short')

//alert("매도",alert.freq_all)




Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.