예스스탁
예스스탁 답변
2023-07-18 13:48:48
안녕하세요
예스스탁입니다.
예스랭귀지에서 봉색을 변경하는 내용은 강조식으로 적성해야 합니다.
분리해 지표와 강조 따로 올려드립니다.
1 지표
input :src(close),i_fastEMA(12),i_slowEMA(25),i_defEMA(25),i_bothEMAs(true);
var : ok(0),countBuy(0),countSell(0);
var : v_fastEMA(0),v_slowEMA(0),v_biasEMA(0),emaColor(0);
var : buycond(False),Sellcond(False);
var : buysignal(False),Sellsignal(False);
var : bull(False),bear(False),tx(0);
v_fastEMA = ema(src, i_fastEMA);
v_slowEMA = ema(src, i_slowEMA);
v_biasEMA = ema(src, i_defEMA);
emaColor = iff(v_fastEMA > v_slowEMA ,green , iff(v_fastEMA < v_slowEMA , red ,Orange));
// Plot EMAs
if i_bothEMAs == False Then
plot1(v_biasEMA,"Consolidated EMA",emaColor);
Else
NoPlot(1);
if i_bothEMAs == true Then
{
plot2(v_fastEMA , "Fast EMA",emaColor);
plot3(v_slowEMA , "Slow EMA",emaColor);
}
Else
{
NoPlot(2);
NoPlot(3);
}
// Colour the bars
buycond = v_fastEMA > v_slowEMA;
sellcond = v_fastEMA < v_slowEMA;
if buycond Then
{
countBuy = countBuy+1;
countSell = 0;
}
if sellcond Then
{
countSell = countSell+ 1;
countBuy = 0;
}
buysignal = countBuy < 2 and countBuy > 0 and countSell < 1 and buycond and buycond[1] == False;
sellsignal = countSell > 0 and countSell < 2 and countBuy < 1 and sellcond and sellcond[1] == False;
// Plot Bull/Bear
if buysignal Then
{
tx = Text_New(sDate,sTime,L,"▲");
Text_SetColor(tx,Green);
Text_SetStyle(tx,2,0);
}
if sellsignal Then
{
tx = Text_New(sDate,sTime,H,"▼");
Text_SetColor(tx,Red);
Text_SetStyle(tx,2,1);
}
2 강조
input :src(close),i_fastEMA(12),i_slowEMA(25),i_defEMA(25),i_bothEMAs(true);
var : ok(0),countBuy(0),countSell(0);
var : v_fastEMA(0),v_slowEMA(0),v_biasEMA(0),emaColor(0);
var : buycond(False),Sellcond(False);
var : buysignal(False),Sellsignal(False);
var : bull(False),bear(False),tx(0);
v_fastEMA = ema(src, i_fastEMA);
v_slowEMA = ema(src, i_slowEMA);
v_biasEMA = ema(src, i_defEMA);
emaColor = iff(v_fastEMA > v_slowEMA ,green , iff(v_fastEMA < v_slowEMA , red ,Orange));
// Colour the bars
buycond = v_fastEMA > v_slowEMA;
sellcond = v_fastEMA < v_slowEMA;
if buycond Then
{
countBuy = countBuy+1;
countSell = 0;
}
if sellcond Then
{
countSell = countSell+ 1;
countBuy = 0;
}
buysignal = countBuy < 2 and countBuy > 0 and countSell < 1 and buycond and buycond[1] == False;
sellsignal = countSell > 0 and countSell < 2 and countBuy < 1 and sellcond and sellcond[1] == False;
if buysignal Then
PlotPaintBar(h,l,"강조",Green);
if sellsignal Then
PlotPaintBar(h,l,"강조",red);
bull = countBuy > 1;
bear = countSell > 1;
if bull Then
PlotPaintBar(h,l,"강조",Green);
if bear Then
PlotPaintBar(h,l,"강조",red);
즐거운 하루되세요
> 다올 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> 수식 변형 부탁 드립니다.
indicator('[@btc_charlie] Trader XO Macro Trend Scanner', overlay=true)
// Variables
var ok = 0
var countBuy = 0
var countSell = 0
src = input(close, title='OHLC Type')
i_fastEMA = input(12, title='Fast EMA')
i_slowEMA = input(25, title='Slow EMA')
i_defEMA = input(25, title='Consolidated EMA')
// Allow the option to show single or double EMA
i_bothEMAs = input(title='Show Both EMAs', defval=true)
// Define EMAs
v_fastEMA = ta.ema(src, i_fastEMA)
v_slowEMA = ta.ema(src, i_slowEMA)
v_biasEMA = ta.ema(src, i_defEMA)
// Color the EMAs
emaColor = v_fastEMA > v_slowEMA ? color.green : v_fastEMA < v_slowEMA ? color.red : #FF530D
// Plot EMAs
plot(i_bothEMAs ? na : v_biasEMA, color=emaColor, linewidth=3, title='Consolidated EMA')
plot(i_bothEMAs ? v_fastEMA : na, title='Fast EMA', color=emaColor)
plot(i_bothEMAs ? v_slowEMA : na, title='Slow EMA', color=emaColor)
// Colour the bars
buy = v_fastEMA > v_slowEMA
sell = v_fastEMA < v_slowEMA
if buy
countBuy += 1
countBuy
if buy
countSell := 0
countSell
if sell
countSell += 1
countSell
if sell
countBuy := 0
countBuy
buysignal = countBuy < 2 and countBuy > 0 and countSell < 1 and buy and not buy[1]
sellsignal = countSell > 0 and countSell < 2 and countBuy < 1 and sell and not sell[1]
barcolor(buysignal ? color.green : na)
barcolor(sellsignal ? color.red : na)
// Plot Bull/Bear
plotshape(buysignal, title='Bull', text='Bull', style=shape.triangleup, location=location.belowbar, color=color.new(color.green, 0), textcolor=color.new(color.black, 0), size=size.tiny)
plotshape(sellsignal, title='Bear', text='Bear', style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 0), textcolor=color.new(color.black, 0), size=size.tiny)
bull = countBuy > 1
bear = countSell > 1
barcolor(bull ? color.green : na)
barcolor(bear ? color.red : na)