답변완료
수식 변환 부탁드립니다
다음 TradingView 수식 중
O1= barssince(buySignal)
O2= barssince(sellSignal)
O3= barssince(buyExit)
O4= barssince(sellExit)
E1= barssince(buySignal[1])
E2= barssince(sellSignal[1])
E3= barssince(buyExit[1])
E4= barssince(sellExit[1])
부분을 예스트레이더로 변환하는 데 어려움이 있습니다. barssince(조건식)을 예스트레이더로 수행하는 함수를 부탁합니다.
================================================================================
study(title="Turtle Trade Channels Indicator", shorttitle="TuTCI@q", overlay=true, resolution="")
length = input(20,"Entry Length", minval=1)
len2=input(10, "Exit Length", minval=1)
showsignals = input(title="Show Entry/Exit Signals ?", type=input.bool, defval=true)
highlighting = input(title="Highlighter On/Off ?", type=input.bool, defval=true)
lower = lowest(low, length)
upper = highest(high, length)
u = plot(upper, "Upper", color=#0094FF)
l = plot(lower, "Lower", color=#ff0000)
up=highest(high,length)
down=lowest(low,length)
sup=highest(high,len2)
sdown=lowest(low,len2)
K1=barssince(high>=up[1])<=barssince(low<=down[1]) ? down : up
K2=iff(barssince(high>=up[1])<=barssince(low<=down[1]),sdown,sup)
K3=iff(close>K1,down,na)
K4=iff(close<K1,up,na)
plot(K1, title="Trend Line", color=color.red, linewidth=2)
e=plot(K2, title="Exit Line", color=color.blue, linewidth=1, style=6)
buySignal=high==upper[1] or crossover(high,upper[1])
sellSignal = low==lower[1] or crossover(lower[1],low)
buyExit=low==sdown[1] or crossover(sdown[1],low)
sellExit = high==sup[1] or crossover(high,sup[1])
O1= barssince(buySignal)
O2= barssince(sellSignal)
O3= barssince(buyExit)
O4= barssince(sellExit)
E1= barssince(buySignal[1])
E2= barssince(sellSignal[1])
E3= barssince(buyExit[1])
E4= barssince(sellExit[1])
plotshape(buySignal and O3<O1[1] ? down : na, title="Long Entry", location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(color.red, 0))
plotshape(buySignal and showsignals and O3<O1[1] ? down : na, title="Long", text="Long Entry", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.new(color.white,0))
plotshape(sellSignal and O4<O2[1] ? up : na, title="Short Entry", location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(color.green, 0))
plotshape(sellSignal and showsignals and O4<O2[1] ? up : na, title="Short", text="Short Entry", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.new(color.white,0))
plotshape(buyExit and O1<O3[1] ? up : na, title="Long Exit", location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(color.blue,0))
plotshape(buyExit and showsignals and O1<O3[1] ? up : na, title="Long Exit", text="Exit Long", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.blue, textcolor=color.new(color.white,0))
plotshape(sellExit and O2<O4[1] ? down : na, title="Short Exit", location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(color.blue,0))
plotshape(sellExit and showsignals and O2<O4[1] ? down : na, title="Short", text="Exit Short", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.blue, textcolor=color.new(color.white,0))
color1= highlighting and min(O1,O2,O3)==O1 ? color.green : na
color2= highlighting and min(O1,O2,O4)==O2 ? color.red : na
fill(u, e, color=color1, title="Background")
fill(l, e, color=color2, title="Background")
2025-03-04
378
글번호 188707
지표
답변완료
수식문의드립니다.
안녕하세요,
아래 분할 청산 수식에 더해서
if marketposition == 1 and c > DayOpen and c > o Then {
if Value6 > 0.02 Then Buy("S1_upb");
}
이걸 추가하고 싶은데, 이때 Buy 수량을 분할청산으로 나간 수량 만큼만 매수하고 싶습니다.
수식 부탁드립니다.
input : txratio(0.3),txa(3),txam(5),txb(8),txn(2);
var : trXcond1(false),trXcond2(false),trXcond3(false),ii(0);
if MarketPosition == 1 Then
{
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "trx1" Then
trXcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "trx2" Then
trXcond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "trx3" Then
trXcond3 = true;
var1 = highest(H,BarsSinceEntry);
if trXcond1 == false and var1 >= EntryPrice*(txa/100+1) and var1 < EntryPrice*(((txa+txam)/100)+1) Then
{
ExitLong("trx1",AtStop,var1*(1-txn/100),"",currentContracts*txratio,1);
}
if trXcond2 == false and var1 >= EntryPrice*(txb/100+1) and var1 < EntryPrice*(((txb+txam)/100)+1) Then
ExitLong("trx2",AtStop,var1*(1-txn/100),"",currentContracts*txratio,1);
#청산발생하면 ii는 0
if CurrentContracts < CurrentContracts[1] Then
ii = 0;
else
{ #청산발생 후 1씩 증가
if ii >= 0 Then
ii = ii +1;
}
if (ii > 96) and trXcond3 == false and var1 >= EntryPrice*(txa/100+1) and var1 < EntryPrice*(((txa+txam)/100)+1) Then
{
ExitLong("trx3",AtStop,var1*(1-(txn+1)/100),"",currentContracts*txratio,1);
}
}
Else
{
#매수포지션이 아니면 -1로 초기화
ii = -1;
trXcond1 = false;
trXcond2 = false;
trXcond3 = false;
}
2025-03-03
293
글번호 188706
시스템
답변완료
TradingView의 수식을 yestrader로 변환을 했는데 수정을 부탁합니다
첨부와 같이 변환을 했는데 만족스럽지 못합니다.
수정을 부탁합니다.
// © BigBeluga
//@version=6
indicator('Range Breakout [BigBeluga]', overlay = true, max_lines_count = 4, max_labels_count = 500)
// INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
int length = 100 // Length of the line extension
float multi = input.float(4, 'Channel Width', step = 0.1) // Multiplier for channel width
bool show_x = input.bool(false, "Show X signals")
bool filter_sig = input.bool(false, "Filter Signals by Trends", "If True indicator filters ▲▼ based on channels breakout condition. If channel is bullish with green circle only ▲ displayed if bearish with red only ▼ signals displayed")
color color1 = input.color(#ffff00, "", inline = "col", group = "OB/OS")
color color3 = input.color(color.lime, "", inline = "col", group = "OB/OS")
bool gradient = input.bool(true, "Gradient", inline = "ll", group = "OB/OS")
int transp = input.int(80, "", inline = "ll", group = "OB/OS")
color color2 = chart.fg_color // Mid line color
// Initialize Variables
var float value = na
var float value_upper = na
var float value_lower = na
var float value_upper_mid = na
var float value_lower_mid = na
var bool trend = false
var count = 0
// }
// CALCULATIONS――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
float atr = ta.sma(ta.atr(200), 100) * multi // ATR-based channel width
// Initialize channel values
if bar_index == 301
value := hl2
value_upper := hl2 + atr
value_lower := hl2 - atr
value_upper_mid := math.avg(value, value_upper)
value_lower_mid := math.avg(value, value_lower)
value_lower_mid
// Check for crossovers
bool cross_upper = ta.crossover(low, value_upper) and barstate.isconfirmed
bool cross_lower = ta.crossunder(high, value_lower) and barstate.isconfirmed
// Count bars outside the channel
if low > value_upper or high < value_lower
count := count + 1
count
// Reset channel values on crossover or after 100 bars
if cross_upper or cross_lower or count == 100
count := 0
value := hl2
value_upper := hl2 + atr
value_lower := hl2 - atr
value_upper_mid := math.avg(value, value_upper)
value_lower_mid := math.avg(value, value_lower)
value_lower_mid
bool chage = not(value != value[1])
bool buy_ = ta.crossover(low, value_lower_mid) and low[10] > value_lower_mid and barstate.isconfirmed and chage
bool sell_ = ta.crossunder(high, value_upper_mid) and high[10] < value_upper_mid and barstate.isconfirmed and chage
bool fakeout_up = ta.crossunder(high, value_upper) and barstate.isconfirmed and chage
bool fakeout_dn = ta.crossover(low, value_lower) and barstate.isconfirmed and chage
// }
// PLOT ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
// Plot and fill lines
p1 = plot(value_upper != value_upper[1] ? na : value_upper, color = color1, linewidth = 1, style = plot.style_linebr)
p0 = plot(bar_index % 2 == 0 ? value : na, color = color2, style = plot.style_linebr)
p2 = plot(value_lower != value_lower[1] ? na : value_lower, color = color3, linewidth = 1, style = plot.style_linebr)
upper_mid = math.avg(value_upper, value)
lower_mid = math.avg(value_lower, value)
p01 = plot(upper_mid != upper_mid[1] ? na : upper_mid, color = color.new(color2, 50), style = plot.style_linebr)
p02 = plot(lower_mid != lower_mid[1] ? na : lower_mid, color = color.new(color2, 50), style = plot.style_linebr)
fill(p1, p01, value_upper, value, color.new(value_upper != value_upper[1] ? na : color1, transp), color.new(value_upper != value_upper[1] ? na : color1, gradient ? 100 : transp))
fill(p2, p02, value, value_lower, color.new(value_upper != value_upper[1] ? na : color3, gradient ? 100 : transp), color.new(value_upper != value_upper[1] ? na : color3, transp))
// Plot cross signals
if cross_upper
trend := true
label.new(bar_index - 1, value_upper[1], text = '▲', textcolor = color1, style = label.style_label_center, color = color(na), size = size.large, tooltip = "Bullish Break")
if cross_lower
trend := false
label.new(bar_index - 1, value_lower[1], text = '▼', textcolor = color3, style = label.style_label_center, color = color(na), size = size.large, tooltip = "Bearish Break")
if buy_ and (filter_sig ? trend : true)
label.new(bar_index - 1, low[1], text = '▲', textcolor = color1, style = label.style_label_up, color = color(na), size = size.normal)
if sell_ and (filter_sig ? not trend : true)
label.new(bar_index - 1, high[1], text = '▼', textcolor = color3, style = label.style_label_down, color = color(na), size = size.normal)
if fakeout_up and show_x
label.new(bar_index - 1, high[1], text = 'X', textcolor = color3, style = label.style_label_down, color = color(na), size = size.normal)
if fakeout_dn and show_x
label.new(bar_index - 1, low[1], text = 'X', textcolor = color1, style = label.style_label_up, color = color(na), size = size.normal)
// }
2025-03-02
478
글번호 188704
지표
답변완료
수식좀 요청 드립니다.
* 항상 많은 도움에 고맙습니다.
* 아래 수식 중 다이버젼스 안나오는데 제가 잘못한부분이 어디죠?
(다이버젼스 안나오는부분이 더많음)
수식 수정 좀 요청 드립니다.
## 아래수식
input : sto1(20),sto2(20),sto3(9);
var : Stochasticsfast(0),Stochasticsslow(0),StochasticssOsc(0);
StochasticsFast = (C-lowest(L,sto1))/(highest(H,sto1)-lowest(L,sto1))*100;
Stochasticsslow = AccumN(C-lowest(L,sto1),sto2)/AccumN((highest(H,sto1)-lowest(L,sto1)),sto2)* 100;
StochasticssOsc = ema(Stochasticsfast,sto2)-ema(Stochasticsslow,sto3);
var99 = ma(StochasticssOsc,5) ;
if var99 > var99[1] and var99[1] < var99[2] and var99 < -10 then { //스토캐스틱 상승반전
Input : Period(20), Period1(20), Period2(9);
var : StoK(0),StoD(0), TL1(0), TL2(0), TLi1(0), TLi2(0), TX1(0), TX2(0), TX3(0), TX4(0), TX5(0), TX6(0);
var : TXi1(0),TXi2(0),TXi3(0),TXi4(0);
var1 = var99[1];
var2 = var1[1];
var3 = C[1];
var4 = var3[1];
var5 = sdate[1];
var6 = var5[1];
var7 = stime[1];
var8 = var7[1];
if var1 > var2 and var3 < var4 then //지표값은 높아지고 종가는 낮아지고
var9 = 1;
}
else
var9 = 0;
if var9 == 1 then
{
TL1 = TL_New(var6,var8,var4,var5,var7,var3);
TL_SetSize(TL1, 5);
TL_SetColor(TL1, Red);
}
if var99 < var99[1] and var99[1] > var99[2] and var99 > 40 then {//스토캐스틱 하락반전
var11 = var99[1];
var12 = var11[1];
var13 = C[1];
var14 = var13[1];
var15 = sdate[1];
var16 = var15[1];
var17 = stime[1];
var18 = var17[1];
if var11 < var12 and var13 > var14 then //지표값은 낮아지고 종가는 높아지고
var19 = 1;
}
else
var19 = 0;
if var19 == 1 then
{
TL2 = TL_New(var16,var18,var14,var15,var17,var13);
TL_SetSize(TL2, 5);
TL_SetColor(TL2, Black);
}
* 매번 많은 도움에 고맙습니다. 수고하십시요.
2025-03-03
359
글번호 188703
지표
답변완료
문의드립니다
안녕하세요?
아래수식에서
if src > lvl and src[1] < lvl Then
strength = strength + 1;
if src < lvl and src[1] > lvl Then
strength = strength + 1;
}
col2 = iff(src > level[1] , Red, Blue);
col3 = iff(src > level[2] , Red, Blue);
col4 = iff(src > level[3] , Red, Blue);
col5 = iff(src > level[4] , Red, Blue);
col6 = iff(src > level[5] , Red, Blue);
plot2(level[1],"2",col2);
plot3(level[2],"3",col3);
plot4(level[3],"4",col4);
plot5(level[4],"5",col5);
plot6(level[5],"6",col6);
모두양선인곳마다매수 모두음선인곳마다 매도부탁드립니다
감사합니다
2025-03-04
309
글번호 188702
시스템