답변완료
문의드립니다
항상 수고하십니다
예시를 바탕으로 수식수정 부탁드려요
예시 : {mfi(기간3)(가 상승하면 +1 아니면 -1}
Mav = mfi(3);
Mav1 =Accum(iff(mav>mav[1],1,-1);
라는 지표가 있는데, 기존 위의 mav1조건에서 아래조건으로 변경하고 싶습니다
-----------------------------------------------
{Mav[1]<mav이면 1, mav[1]>mav이면 -1, mav[1]가 100일때 mav==mav[1]이면 1,
mav[1]이 0일때 mav==mav [1]이면 -1}
-----------------------------------------------
즉 mav1은 일반적으로 mfi(3)이 상승하면 1,하락하면 -1이고,
직전봉 mfi(3)이 0일때 보합하면 -1, 직전봉 mfi(3)이 100일때 보합하면 1을 할당하는 조건을 동시에 적용하고 싶습니다
Mfi(3)의 수치가 1~99 범위내에서의 보합조건은 필요하지 않습니다
수식 부탁드려요
2023-06-25
1334
글번호 170064
지표
답변완료
변형 부탁 드립니다.
트레이딩뷰에서 사용되는 시스템입니다.
적용가능하도록 부탁드립니다.
// Inputs
a = input(1, title = "Key Vaule. 'This changes the sensitivity'")
c = input(10, title = "ATR Period")
h = input(false, title = "Signals from Heikin Ashi Candles")
xATR = atr(c)
nLoss = a * xATR
src = h ? security(heikinashi(syminfo.tickerid), timeframe.period, close, lookahead = false) : close
xATRTrailingStop = 0.0
xATRTrailingStop := iff(src > nz(xATRTrailingStop[1], 0) and src[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), src - nLoss),
iff(src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), src + nLoss),
iff(src > nz(xATRTrailingStop[1], 0), src - nLoss, src + nLoss)))
pos = 0
pos := iff(src[1] < nz(xATRTrailingStop[1], 0) and src > nz(xATRTrailingStop[1], 0), 1,
iff(src[1] > nz(xATRTrailingStop[1], 0) and src < nz(xATRTrailingStop[1], 0), -1, nz(pos[1], 0)))
xcolor = pos == -1 ? color.red: pos == 1 ? color.green : color.blue
ema = ema(src,1)
above = crossover(ema, xATRTrailingStop)
below = crossover(xATRTrailingStop, ema)
buy = src > xATRTrailingStop and above
sell = src < xATRTrailingStop and below
barbuy = src > xATRTrailingStop
barsell = src < xATRTrailingStop
plotshape(buy, title = "Buy", text = 'Buy', style = shape.labelup, location = location.belowbar, color= color.green, textcolor = color.white, transp = 0, size = size.tiny)
plotshape(sell, title = "Sell", text = 'Sell', style = shape.labeldown, location = location.abovebar, color= color.red, textcolor = color.white, transp = 0, size = size.tiny)
barcolor(barbuy ? color.green : na)
barcolor(barsell ? color.red : na)
alertcondition(buy, "UT Long", "UT Long")
alertcondition(sell, "UT Short", "UT Short")
2023-06-24
753
글번호 170057
시스템
답변완료
스탑로스가 실행되면 이후 매매금지
아래와 같은 조건에서 데이트레이딩으로 매매를 계속지속하다가 스탑로스가 실행되면 당일은 매매를 금지하고 싶습니다. 다음날부터는조건이 되면 다시 매매하고 싶습니다.
다음날도 매매를 계속하다가 스탑로스로 청산이 되면 그 이후로는 매매하지 않도록 부탁드립니다
nput : shortPeriod(5), longPeriod(20),스탑로스(1.5);
value1 = ma(C, shortPeriod);
value2 = ma(C, longPeriod);
# 매수
If CrossUP(value1, value2) Then
{
Buy();
}
# 청산
If CrossDown(value1, value2) Then
{
ExitLong();
}
SetStopLoss(스탑로스,PointStop);
2023-06-24
738
글번호 170056
시스템