커뮤니티

Trading view 수식 변환 부탁드립니다.

프로필 이미지
doublnim
2020-11-19 17:54:23
610
글번호 144052
답변완료
안녕하세요. 아래의 수식 변환을 부탁드립니다. 지표식인 것 같은데 시스템식도 가능하시다면 둘 다 작성 부탁드리겠습니다. 식은 아래와 같습니다. //@version=4 study(title="Beep Boop", shorttitle="Beep Boop", resolution="") fast_length = input(title="Fast Length", type=input.integer, defval=12) slow_length = input(title="Slow Length", type=input.integer, defval=26) EMATrend = input(title="EMA Trend", type=input.integer, defval=50) src = input(title="Source", type=input.source, defval=close) signal_length = input(title="Signal Smoothing", type=input.integer, minval = 1, maxval = 50, defval = 9) sma_source = input(title="Simple MA(Oscillator)", type=input.bool, defval=false) sma_signal = input(title="Simple MA(Signal Line)", type=input.bool, defval=false) col_grow_above = #26A69A col_grow_below = #FF0000 col_fall_above = #FFFFFF col_fall_below = #FFFFFF col_macd = #0094ff col_signal = #ff6a00 fast_ma = sma_source ? sma(src, fast_length) : ema(src, fast_length) slow_ma = sma_source ? sma(src, slow_length) : ema(src, slow_length) macd = fast_ma - slow_ma signal = sma_signal ? sma(macd, signal_length) : ema(macd, signal_length) hist = macd - signal if (hist > 0) hist := 0.1 if (hist < 0) hist := 0.09 fastMA = ema(close, EMATrend) //fastMA = 0 plot(hist, title="Histogram", style=plot.style_columns, color=(hist == 0.1 ? ((hist == 0.1) and (close > fastMA) and (open > fastMA) and (low > fastMA) ? col_grow_above : col_fall_above) : ((hist == 0.09) and (close < fastMA) and (open < fastMA) and (high < fastMA)? col_grow_below : col_fall_below) ), transp=0 )
지표
답변 3
프로필 이미지

예스스탁 예스스탁 답변

2020-11-20 15:44:01

안녕하세요 예스스탁입니다. 1 지표 input : fast_length(12),slow_length(26),EMATrend(50),signal_length(9),sma_source(false),sma_signal(false); var : src(0),fast_ma(0),slow_ma(0),macdv(0),signal(0),hist(0),fastMA(0),col(0); src = close; fast_ma = iff(sma_source , ma(src, fast_length) , ema(src, fast_length)); slow_ma = iff(sma_source , ma(src, slow_length) , ema(src, slow_length)); macdv = fast_ma - slow_ma; signal = iff(sma_signal , ma(macdv, signal_length) , ema(macdv, signal_length)); hist = macdv - signal; if hist > 0 Then hist = 0.1; if hist < 0 Then hist = 0.09; fastMA = ema(close, EMATrend); col = Iff(hist == 0.1 , IFf((hist == 0.1) and (close > fastMA) and (open > fastMA) and (low > fastMA) , RED , MAGENTA) , IFf((hist == 0.09) and (close < fastMA) and (open < fastMA) and (high < fastMA) , BLUE,CYAN)); plot1(hist,"Histogram",col); 2 시스템 input : fast_length(12),slow_length(26),EMATrend(50),signal_length(9),sma_source(false),sma_signal(false); var : src(0),fast_ma(0),slow_ma(0),macdv(0),signal(0),hist(0),fastMA(0),col(0); src = close; fast_ma = iff(sma_source , ma(src, fast_length) , ema(src, fast_length)); slow_ma = iff(sma_source , ma(src, slow_length) , ema(src, slow_length)); macdv = fast_ma - slow_ma; signal = iff(sma_signal , ma(macdv, signal_length) , ema(macdv, signal_length)); hist = macdv - signal; if hist > 0 Then hist = 0.1; if hist < 0 Then hist = 0.09; fastMA = ema(close, EMATrend); col = Iff(hist == 0.1 , IFf((hist == 0.1) and (close > fastMA) and (open > fastMA) and (low > fastMA) , RED , MAGENTA) , IFf((hist == 0.09) and (close < fastMA) and (open < fastMA) and (high < fastMA) , BLUE,CYAN)); if Col !=col[1] and col == RED Then Buy("B"); if Col !=col[1] and col == BLUE Then Sell("S"); 즐거운 하루되세요 > doublnim 님이 쓴 글입니다. > 제목 : Trading view 수식 변환 부탁드립니다. > 안녕하세요. 아래의 수식 변환을 부탁드립니다. 지표식인 것 같은데 시스템식도 가능하시다면 둘 다 작성 부탁드리겠습니다. 식은 아래와 같습니다. //@version=4 study(title="Beep Boop", shorttitle="Beep Boop", resolution="") fast_length = input(title="Fast Length", type=input.integer, defval=12) slow_length = input(title="Slow Length", type=input.integer, defval=26) EMATrend = input(title="EMA Trend", type=input.integer, defval=50) src = input(title="Source", type=input.source, defval=close) signal_length = input(title="Signal Smoothing", type=input.integer, minval = 1, maxval = 50, defval = 9) sma_source = input(title="Simple MA(Oscillator)", type=input.bool, defval=false) sma_signal = input(title="Simple MA(Signal Line)", type=input.bool, defval=false) col_grow_above = #26A69A col_grow_below = #FF0000 col_fall_above = #FFFFFF col_fall_below = #FFFFFF col_macd = #0094ff col_signal = #ff6a00 fast_ma = sma_source ? sma(src, fast_length) : ema(src, fast_length) slow_ma = sma_source ? sma(src, slow_length) : ema(src, slow_length) macd = fast_ma - slow_ma signal = sma_signal ? sma(macd, signal_length) : ema(macd, signal_length) hist = macd - signal if (hist > 0) hist := 0.1 if (hist < 0) hist := 0.09 fastMA = ema(close, EMATrend) //fastMA = 0 plot(hist, title="Histogram", style=plot.style_columns, color=(hist == 0.1 ? ((hist == 0.1) and (close > fastMA) and (open > fastMA) and (low > fastMA) ? col_grow_above : col_fall_above) : ((hist == 0.09) and (close < fastMA) and (open < fastMA) and (high < fastMA)? col_grow_below : col_fall_below) ), transp=0 )
프로필 이미지

doublnim

2020-11-20 20:05:08

선생님 답변 감사드립니다. 그런데 시스템 식 적어주신 걸로 시뮬레이션 차트를 실행하였는데 논리값(참/거짓)이나 논리표현식이 와야 합니다. 라는 오류창이 뜨네요. 이베스트 예스트레이더를 사용 중입니다. 혹시 어떻게 하면 오류를 없앨 수 있을지 알려주세요^^ > 예스스탁 님이 쓴 글입니다. > 제목 : Re : Trading view 수식 변환 부탁드립니다. > 안녕하세요 예스스탁입니다. 1 지표 input : fast_length(12),slow_length(26),EMATrend(50),signal_length(9),sma_source(false),sma_signal(false); var : src(0),fast_ma(0),slow_ma(0),macdv(0),signal(0),hist(0),fastMA(0),col(0); src = close; fast_ma = iff(sma_source , ma(src, fast_length) , ema(src, fast_length)); slow_ma = iff(sma_source , ma(src, slow_length) , ema(src, slow_length)); macdv = fast_ma - slow_ma; signal = iff(sma_signal , ma(macdv, signal_length) , ema(macdv, signal_length)); hist = macdv - signal; if hist > 0 Then hist = 0.1; if hist < 0 Then hist = 0.09; fastMA = ema(close, EMATrend); col = Iff(hist == 0.1 , IFf((hist == 0.1) and (close > fastMA) and (open > fastMA) and (low > fastMA) , RED , MAGENTA) , IFf((hist == 0.09) and (close < fastMA) and (open < fastMA) and (high < fastMA) , BLUE,CYAN)); plot1(hist,"Histogram",col); 2 시스템 input : fast_length(12),slow_length(26),EMATrend(50),signal_length(9),sma_source(false),sma_signal(false); var : src(0),fast_ma(0),slow_ma(0),macdv(0),signal(0),hist(0),fastMA(0),col(0); src = close; fast_ma = iff(sma_source , ma(src, fast_length) , ema(src, fast_length)); slow_ma = iff(sma_source , ma(src, slow_length) , ema(src, slow_length)); macdv = fast_ma - slow_ma; signal = iff(sma_signal , ma(macdv, signal_length) , ema(macdv, signal_length)); hist = macdv - signal; if hist > 0 Then hist = 0.1; if hist < 0 Then hist = 0.09; fastMA = ema(close, EMATrend); col = Iff(hist == 0.1 , IFf((hist == 0.1) and (close > fastMA) and (open > fastMA) and (low > fastMA) , RED , MAGENTA) , IFf((hist == 0.09) and (close < fastMA) and (open < fastMA) and (high < fastMA) , BLUE,CYAN)); if Col !=col[1] and col == RED Then Buy("B"); if Col !=col[1] and col == BLUE Then Sell("S"); 즐거운 하루되세요 > doublnim 님이 쓴 글입니다. > 제목 : Trading view 수식 변환 부탁드립니다. > 안녕하세요. 아래의 수식 변환을 부탁드립니다. 지표식인 것 같은데 시스템식도 가능하시다면 둘 다 작성 부탁드리겠습니다. 식은 아래와 같습니다. //@version=4 study(title="Beep Boop", shorttitle="Beep Boop", resolution="") fast_length = input(title="Fast Length", type=input.integer, defval=12) slow_length = input(title="Slow Length", type=input.integer, defval=26) EMATrend = input(title="EMA Trend", type=input.integer, defval=50) src = input(title="Source", type=input.source, defval=close) signal_length = input(title="Signal Smoothing", type=input.integer, minval = 1, maxval = 50, defval = 9) sma_source = input(title="Simple MA(Oscillator)", type=input.bool, defval=false) sma_signal = input(title="Simple MA(Signal Line)", type=input.bool, defval=false) col_grow_above = #26A69A col_grow_below = #FF0000 col_fall_above = #FFFFFF col_fall_below = #FFFFFF col_macd = #0094ff col_signal = #ff6a00 fast_ma = sma_source ? sma(src, fast_length) : ema(src, fast_length) slow_ma = sma_source ? sma(src, slow_length) : ema(src, slow_length) macd = fast_ma - slow_ma signal = sma_signal ? sma(macd, signal_length) : ema(macd, signal_length) hist = macd - signal if (hist > 0) hist := 0.1 if (hist < 0) hist := 0.09 fastMA = ema(close, EMATrend) //fastMA = 0 plot(hist, title="Histogram", style=plot.style_columns, color=(hist == 0.1 ? ((hist == 0.1) and (close > fastMA) and (open > fastMA) and (low > fastMA) ? col_grow_above : col_fall_above) : ((hist == 0.09) and (close < fastMA) and (open < fastMA) and (high < fastMA)? col_grow_below : col_fall_below) ), transp=0 )
프로필 이미지

예스스탁 예스스탁 답변

2020-11-23 14:15:47

안녕하세요 예스스탁입니다. 시뮬레이션 차트는 변수최적화 기능이 있어 모든 외부저장변수(input)가 숫자이어야 합니다. 해당 수식에 true나 false로 저장되는 값이 있어 해당 메세지가 발생했습니다. 전략실행차트는 관계가 없습니다. sma_source와 sma_signal변수를 숫자로 변경해 드립니다. 0으로 지정하면 지수이평, 1로 지정하면 단순이평으로 계산됩니다. 1 input : fast_length(12),slow_length(26),EMATrend(50),signal_length(9),sma_source(0),sma_signal(0); var : src(0),fast_ma(0),slow_ma(0),macdv(0),signal(0),hist(0),fastMA(0),col(0); src = close; fast_ma = iff(sma_source == 1 , ma(src, fast_length) , ema(src, fast_length)); slow_ma = iff(sma_source == 1 , ma(src, slow_length) , ema(src, slow_length)); macdv = fast_ma - slow_ma; signal = iff(sma_signal == 1 , ma(macdv, signal_length) , ema(macdv, signal_length)); hist = macdv - signal; if hist > 0 Then hist = 0.1; if hist < 0 Then hist = 0.09; fastMA = ema(close, EMATrend); col = Iff(hist == 0.1 , IFf((hist == 0.1) and (close > fastMA) and (open > fastMA) and (low > fastMA) , RED , MAGENTA) , IFf((hist == 0.09) and (close < fastMA) and (open < fastMA) and (high < fastMA) , BLUE,CYAN)); plot1(hist,"Histogram",col); 2 시스템 input : fast_length(12),slow_length(26),EMATrend(50),signal_length(9),sma_source(0),sma_signal(0); var : src(0),fast_ma(0),slow_ma(0),macdv(0),signal(0),hist(0),fastMA(0),col(0); src = close; fast_ma = iff(sma_source == 1 , ma(src, fast_length) , ema(src, fast_length)); slow_ma = iff(sma_source == 1 , ma(src, slow_length) , ema(src, slow_length)); macdv = fast_ma - slow_ma; signal = iff(sma_signal == 1 , ma(macdv, signal_length) , ema(macdv, signal_length)); hist = macdv - signal; if hist > 0 Then hist = 0.1; if hist < 0 Then hist = 0.09; fastMA = ema(close, EMATrend); col = Iff(hist == 0.1 , IFf((hist == 0.1) and (close > fastMA) and (open > fastMA) and (low > fastMA) , RED , MAGENTA) , IFf((hist == 0.09) and (close < fastMA) and (open < fastMA) and (high < fastMA) , BLUE,CYAN)); if Col !=col[1] and col == RED Then Buy("B"); if Col !=col[1] and col == BLUE Then Sell("S"); 즐거운 하루되세요 > doublnim 님이 쓴 글입니다. > 제목 : Re : Re : Trading view 수식 변환 부탁드립니다. > 선생님 답변 감사드립니다. 그런데 시스템 식 적어주신 걸로 시뮬레이션 차트를 실행하였는데 논리값(참/거짓)이나 논리표현식이 와야 합니다. 라는 오류창이 뜨네요. 이베스트 예스트레이더를 사용 중입니다. 혹시 어떻게 하면 오류를 없앨 수 있을지 알려주세요^^ > 예스스탁 님이 쓴 글입니다. > 제목 : Re : Trading view 수식 변환 부탁드립니다. > 안녕하세요 예스스탁입니다. 1 지표 input : fast_length(12),slow_length(26),EMATrend(50),signal_length(9),sma_source(false),sma_signal(false); var : src(0),fast_ma(0),slow_ma(0),macdv(0),signal(0),hist(0),fastMA(0),col(0); src = close; fast_ma = iff(sma_source , ma(src, fast_length) , ema(src, fast_length)); slow_ma = iff(sma_source , ma(src, slow_length) , ema(src, slow_length)); macdv = fast_ma - slow_ma; signal = iff(sma_signal , ma(macdv, signal_length) , ema(macdv, signal_length)); hist = macdv - signal; if hist > 0 Then hist = 0.1; if hist < 0 Then hist = 0.09; fastMA = ema(close, EMATrend); col = Iff(hist == 0.1 , IFf((hist == 0.1) and (close > fastMA) and (open > fastMA) and (low > fastMA) , RED , MAGENTA) , IFf((hist == 0.09) and (close < fastMA) and (open < fastMA) and (high < fastMA) , BLUE,CYAN)); plot1(hist,"Histogram",col); 2 시스템 input : fast_length(12),slow_length(26),EMATrend(50),signal_length(9),sma_source(false),sma_signal(false); var : src(0),fast_ma(0),slow_ma(0),macdv(0),signal(0),hist(0),fastMA(0),col(0); src = close; fast_ma = iff(sma_source , ma(src, fast_length) , ema(src, fast_length)); slow_ma = iff(sma_source , ma(src, slow_length) , ema(src, slow_length)); macdv = fast_ma - slow_ma; signal = iff(sma_signal , ma(macdv, signal_length) , ema(macdv, signal_length)); hist = macdv - signal; if hist > 0 Then hist = 0.1; if hist < 0 Then hist = 0.09; fastMA = ema(close, EMATrend); col = Iff(hist == 0.1 , IFf((hist == 0.1) and (close > fastMA) and (open > fastMA) and (low > fastMA) , RED , MAGENTA) , IFf((hist == 0.09) and (close < fastMA) and (open < fastMA) and (high < fastMA) , BLUE,CYAN)); if Col !=col[1] and col == RED Then Buy("B"); if Col !=col[1] and col == BLUE Then Sell("S"); 즐거운 하루되세요 > doublnim 님이 쓴 글입니다. > 제목 : Trading view 수식 변환 부탁드립니다. > 안녕하세요. 아래의 수식 변환을 부탁드립니다. 지표식인 것 같은데 시스템식도 가능하시다면 둘 다 작성 부탁드리겠습니다. 식은 아래와 같습니다. //@version=4 study(title="Beep Boop", shorttitle="Beep Boop", resolution="") fast_length = input(title="Fast Length", type=input.integer, defval=12) slow_length = input(title="Slow Length", type=input.integer, defval=26) EMATrend = input(title="EMA Trend", type=input.integer, defval=50) src = input(title="Source", type=input.source, defval=close) signal_length = input(title="Signal Smoothing", type=input.integer, minval = 1, maxval = 50, defval = 9) sma_source = input(title="Simple MA(Oscillator)", type=input.bool, defval=false) sma_signal = input(title="Simple MA(Signal Line)", type=input.bool, defval=false) col_grow_above = #26A69A col_grow_below = #FF0000 col_fall_above = #FFFFFF col_fall_below = #FFFFFF col_macd = #0094ff col_signal = #ff6a00 fast_ma = sma_source ? sma(src, fast_length) : ema(src, fast_length) slow_ma = sma_source ? sma(src, slow_length) : ema(src, slow_length) macd = fast_ma - slow_ma signal = sma_signal ? sma(macd, signal_length) : ema(macd, signal_length) hist = macd - signal if (hist > 0) hist := 0.1 if (hist < 0) hist := 0.09 fastMA = ema(close, EMATrend) //fastMA = 0 plot(hist, title="Histogram", style=plot.style_columns, color=(hist == 0.1 ? ((hist == 0.1) and (close > fastMA) and (open > fastMA) and (low > fastMA) ? col_grow_above : col_fall_above) : ((hist == 0.09) and (close < fastMA) and (open < fastMA) and (high < fastMA)? col_grow_below : col_fall_below) ), transp=0 )