답변완료
재문의드립니다
1.
input : P1(10),P2(20);
var1 = ema(C,P1);
var2 = ema(c,P2);
if CrossUp(C,var1) and CrossUp(C,var2) and c >= var2+0.05 Then
{
Buy();
PlaySound("C:₩예스트레이더₩data₩Sound₩alert.wav");
}
if CrossDown(C,var1) and CrossDown(C,var2) and c <= var2-0.05 Then
{
Sell();
PlaySound("C:₩예스트레이더₩data₩Sound₩alert.wav");
}
...........................................................
먼저 답변 주신 89749번 수식은 피라미딩이 아예 안됩니다
상기수식은 피라미딩 허용 때문에 매순간 소리가 나는게 아닌것 같습니다
시스템 적용하면 아예 장시작부터 장끝날때까지 경보음이 울리기 때문입니다
분주기가 넘 짧아서 그러나 싶어 분주기를 30분이상으로 설정해도 마찬가지입니다
제가 정말 구현하고 싶은 시스템은
피라미딩을 허용해도 예비신호 발생 때만 경보음이 나는 시스템입니다
2.
input : P1(10),P2(20);
var1 = ema(C,P1);
var2 = ema(c,P2);
if CrossUp(C,var1) and CrossUp(C,var2) and c >= var2+0.05 Then
Buy();
if CrossDown(C,var1) and CrossDown(C,var2) and c <= var2-0.05 Then
Sell();
................................................
상기수식에 조건 하나를 더 추가하고자합니다
"10이평과 20이평값 차이가 절대값 0.05이상은 차이날때 신호발생"이라는 조건을 추가하고 싶습니다
감사합니다
2024-10-31
839
글번호 184821
시스템
답변완료
질문 몇가지 입니다.
input : P(20),mm(50000);
var : R(0),AA(0);
R = RSI(P);
if MarketPosition == 0 and CrossUp(R,20) Then
{
Buy("b",OnClose,Def,mm/C);
AA = mm*1.20;
}
if MarketPosition == 1 Then
{
if CrossUp(R,20) and MaxEntries < 7 Then
{
Buy("bb",OnClose,Def,aa/c);
AA = AA*1.20;
}
if R >= 70 Then
Condition1 = true;
if Condition1 == true Then
{
ExitLong("bx1",AtLimit,AvgEntryPrice*1.01);
}
}
Else
Condition1 = False;
코인이고 피라미딩을 사용합니다.
원래는 이코드를 기초로 이래저래 수정해서 쓰고 있는데 무슨문제 인지 코드가 안올라 갑니다.
그래도 질문엔 크게 문제가 없을꺼 같아. 그냥 올려주신 이전 코드를 올려요.
q1. 원하는 코드 수정안은... 구매시 구매출력문이 ①②③④⑤⑥ 이렇게 나왔으면 합니다. 이게 너무 어려우면 b1,b2,b3,b4 이렇게 나왔으면 합니다.
if문을 구매횟수많큼 쓰면 가능할것도 같은데.. 배우고 있는 만큼 좀더 세련된 코드였음 합니다.
하강율(0.5) 퍼센트를 입력받아. 신호가 나왔을때 이전구매가격 보다 하강율 퍼센트 보다 낮으면 구매를 하게 하고 싶습니다. (제가 뭘 잘못했는지 몰라도 이전구매가격 = c; 이런식으로 코드를 만드니 안되더라구요)
그리고 구매시 구매횟수 배열의 순번 (1,3,5,7,9,12,14,16,19,20)의 순서에만 구매를 했으면 합니다.
q2. 현재 수익율을 알수 있는 방법은 뭘까요?
q3. 코드의 피라미딩 횟수는 현재 12인데 자동 실행시 피라미딩 횟수와 어떻게 영향을 받는지 궁금하고, 또 설정의 구매액도 영향을 받는지 궁금 합니다.
q4. 실제 구매액이 5000원 이렇게 정확히 안되던데.. 원래 그런건가요?
(5번 항목 글만 쓰면... 500 - 서버오류... 찾고 있는 리소스에 문제가 있어 표시할 수 없습니다.라는 메세지가 나오면서 글이 수정이 안되네요. 코드 문제인줄 알았더니 5번 항목 글이 문제네요...뭔가 금칙어가 있나 싶어 글을 별으별수단으로 바꿔도 안올라 갑니다.)
q6. 구매신호가 나왔는데 계좌에 돈이 모자르면 어떻게 되는거죠???
q7. 자동매매가 실행중 코드를 수정하게 되면 어떻게 되죠?
시스템하고 상관없는 질문이 많네요. 죄송합니다. ㅎㅎ
코인은 주식과 또 다른것 같네요...
2024-10-31
749
글번호 184820
시스템
답변완료
수식 부탁드립니다
지표식 부탁드립니다.
1.
study(title="Range", shorttitle="Range", overlay=true)
up30on = input(true, title="30 Minute Range High")
down30on = input(true, title="30 Minute Range Low")
is_newbar(res) => change(time(res)) != 0
adopt(r, s) => security(tickerid, r, s)
high_range = valuewhen(is_newbar('D'),high,0)
low_range = valuewhen(is_newbar('D'),low,0)
up = plot(up30on ? adopt('30', high_range):na, color = lime, style=circles, linewidth=4)
down = plot(down30on ? adopt('30', low_range): na, color = #DC143C, style=circles, linewidth=4)
2.
//@version=4
study("Oikawa Ema", overlay=true)
oikawa0 = security(syminfo.tickerid, "15", ema(close, 15))
plot(oikawa0, color=color.lime, offset=0, linewidth=2)
oikawa1 = security(syminfo.tickerid, "60", ema(close, 15))
plot(oikawa1, color=color.blue, offset=0, linewidth=2)
oikawa2 = security(syminfo.tickerid, "240", ema(close, 15))
plot(oikawa2, color=color.white, offset=0, linewidth=4)
oikawa3 = security(syminfo.tickerid, "15", ema(close, 85))
plot(oikawa3, color=color.gray, offset=0, linewidth=4)
2024-10-31
884
글번호 184819
지표
답변완료
수고하십니다
항상 노고에 감사하며
변환 부탁드립니다
indicator("Zero-Lag MA Trend Levels [ChartPrime]", overlay = true)
// --------------------------------------------------------------------------------------------------------------------}
// 𝙐𝙎𝙀𝙍 𝙄𝙉𝙋𝙐𝙏𝙎
// --------------------------------------------------------------------------------------------------------------------{
int length = input.int(15, title="Length") // Length for the moving average calculations
bool show_levl = input.bool(true, "Trend Levels") // Toggle to show trend levels
// Colors for the trend levels
color up = input.color(#30d453, "+", group = "Colors", inline = "i")
color dn = input.color(#4043f1, "-", group = "Colors", inline = "i")
var box1 = box(na) // Variable to store the box
series float atr = ta.atr(200) // Average True Range (ATR) for trend levels
// --------------------------------------------------------------------------------------------------------------------}
// 𝙄𝙉𝘿𝙄𝘾𝘼𝙏𝙊𝙍 𝘾𝘼𝙇𝘾𝙐𝙇𝘼𝙏𝙄𝙊𝙉𝙎
// --------------------------------------------------------------------------------------------------------------------{
series float emaValue = ta.ema(close, length) // EMA of the closing price
series float correction = close + (close - emaValue) // Correction factor for zero-lag calculation
series float zlma = ta.ema(correction, length) // Zero-Lag Moving Average (ZLMA)
bool signalUp = ta.crossover(zlma, emaValue) // Signal for bullish crossover
bool signalDn = ta.crossunder(zlma, emaValue) // Signal for bearish crossunder
// Determine the color of ZLMA based on its direction
color zlma_color = zlma > zlma[3] ? up : zlma < zlma[3] ? dn : na
color ema_col = emaValue < zlma ? up : dn // Determine the EMA color
// --------------------------------------------------------------------------------------------------------------------}
// 𝙑𝙄𝙎𝙐𝘼𝙇𝙄𝙕𝘼𝙏𝙄𝙊𝙉
// --------------------------------------------------------------------------------------------------------------------{
// Plot the Zero-Lag Moving Average
p1 = plot(zlma, color = zlma_color, linewidth = 1) // Plot ZLMA
p2 = plot(emaValue, color = ema_col, linewidth = 1) // Plot EMA
fill(p1, p2, zlma, emaValue, color.new(zlma_color, 80), color.new(ema_col, 80)) // Fill between ZLMA and EMA
// Method to draw a box on the chart
method draw_box(color col, top, bot, price)=>
box.new(
bar_index, top, bar_index, bot, col, 1,
bgcolor = color.new(col, 90),
text = str.tostring(math.round(price, 2)),
text_size = size.tiny,
text_color = chart.fg_color,
text_halign = text.align_right
)
// Logic to draw trend levels as boxes on the chart
if show_levl
bool check_signals = signalUp or signalDn // Check if there is an up or down signal
switch
// Draw a box when a bullish signal is detected
signalUp => box1 := up.draw_box(zlma, zlma - atr, close)
// Draw a box when a bearish signal is detected
signalDn => box1 := dn.draw_box(zlma + atr, zlma, close)
switch
// Extend the right side of the box if no new signal is detected
not signalUp or not signalDn => box1.set_right(bar_index + 4)
=> box1 := box(na) // Otherwise, reset the box
switch
// Add a downward label when price crosses below the bottom of the box
ta.crossunder(high, box1.get_bottom()) and not check_signals[1] and not check_signals and emaValue > zlma=>
label.new(bar_index - 1, high[1], "▼", color = color(na), textcolor = dn, style = label.style_label_down)
// Add an upward label when price crosses above the top of the box
ta.crossover(low, box1.get_top()) and not check_signals and not check_signals[1] and emaValue < zlma=>
label.new(bar_index - 1, low[1], "▲", color = color(na), textcolor = up, style = label.style_label_up)
// Plot shapes for up and down signals
plotshape(signalUp ? zlma : na, "", shape.diamond, location.absolute, color = up, size = size.tiny)
plotshape(signalDn ? zlma : na, "", shape.diamond, location.absolute, color = dn, size = size.tiny)
// --------------------------------------------------------------------------------------------------------------------}
2024-10-30
939
글번호 184815
지표
답변완료
문의 드립니다
안녕하세요
트레이딩지표 전환 부탁드립니다
1.
res1 = input(title="Close Time Frame", type=resolution, defval="D")
cld=security(tickerid, res1, close[1])
opd=security(tickerid,res1, open[1])
tu=(cld +opd)/2
plot( tu, "Breakout",color=black ,style=line,linewidth=2,transp=0)
2.다음지표에 현재가을 추가해주세요
input : Periods(10);
input : Multiplier(3.0);
input : changeATR(1);#1:SMA 0:RMA
var : src(0),alpha(0),source(0),ATR1(0),ATR2(0),ATRV(0);
var : up(0),up1(0),dn(0),dn1(0),trend(0),tx(0);
src = (H+L)/2;
alpha = 1 / Periods;
atr1 = IFf(IsNan(atr1[1]) == true , ma(TrueRange, Periods) , alpha * TrueRange + (1 - alpha) * atr1[1]);
atr2 = ATR(Periods);
atrv = IFf(changeATR == 1 , atr1 , atr2);
up=src-(Multiplier*atrv);
up1 = IFf(IsNan(up[1]) == False,up[1],up);
up = iff(close[1] > up1 , max(up,up1) , up);
dn=src+(Multiplier*atrv);
dn1 = IFf(IsNan(dn[1]) == False,dn[1], dn);
dn = iff(close[1] < dn1 , min(dn, dn1) , dn);
trend = 1;
trend = IFf(IsNan(trend[1]) == False,trend[1], trend);
trend = IFf(trend == -1 and close > dn1 , 1 , iff(trend == 1 and close < up1 , -1 , trend));
if trend == 1 Then
plot1(up,"UpTrend",green);
Else
NoPlot(1);
if trend == -1 then
Plot2(dn,"Down Trend",red);
Else
NoPlot(2);
if trend == 1 and trend[1] == -1 Then
{
tx =Text_New(sDate,sTime,up,"●");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,Green);
}
if trend == -1 and trend[1] == 1 Then
{
tx =Text_New(sDate,sTime,dn,"●");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,Red);
}
감사합니다
2024-10-31
687
글번호 184812
지표