·Î±×ÀÎ
|
ȸ¿ø°¡ÀÔ
|
ȸ»ç¼Ò°³
|
»çÀÌÆ®¸Ê
Ä¿¹Â´ÏƼ | ¼ö½ÄÀÛ¼º Q&A
ÀÛ¼ºÀÚ :
¿¹½º½ºÅ¹
ÀÛ¼ºÀÏ : 2025-05-09 ¿ÀÈÄ 5:46:51 Á¶È¸¼ö : 45
Re : ¹®Àǵ帳´Ï´Ù.
¾È³çÇϼ¼¿ä
¿¹½º½ºÅ¹ÀÔ´Ï´Ù.
input : nATRPeriod(5);
input : nATRMultip(3.5);
var : alpha(0),xATR(0),nLoss(0),xATRTrailingStop(0),ps(0),nz(0),color(0);
alpha = 1 / nATRPeriod ;
xATR = IFf(IsNan(xATR[1]) == true, ma(TrueRange,nATRPeriod) , alpha * TrueRange + (1 - alpha) * IFf(isnan(xATR[1])==true,0,xATR[1]));
nLoss = nATRMultip * xATR;
var1 = IFF(IsNan(xATRTrailingStop[1]) == true,0,xATRTrailingStop[1]);
xATRTrailingStop = iff(close > var1 and close[1] > var1, max(var1, close - nLoss),
iff(close < var1 and close[1] < var1, min(var1, close + nLoss),
iff(close > var1, close - nLoss, close + nLoss)));
ps = iff(close[1] < var1 and close > var1, 1,
iff(close[1] > var1 and close < var1, -1, IFf(IsNaN(ps[1])==true,0,ps[1])));
color = iff(ps == -1 , red ,IFf(ps == 1 , green , blue));
plot1(xATRTrailingStop, "ATR Trailing Stop",color);
Áñ°Å¿î ÇÏ·çµÇ¼¼¿ä
> ÇØ¾Ï ´ÔÀÌ ¾´ ±ÛÀÔ´Ï´Ù.
> Á¦¸ñ : ¹®Àǵ帳´Ï´Ù.
> ÀÌÀü ¹®Àǵ帰 ¼ö½ÄÁß ¾Æ·¡ÀÇ ¼ö½ÄÀ» Àû¿ëÇß´õ´Ï ¼±ÀÇ »ö»óÀÌ ÆÄ¶õ»öÀ¸·Î¸¸ ³ª¿À°í
green°ú red´Â ±¸ÇöµÇÁö ¾Ê½À´Ï´Ù. ¶ÇÇÑ ¼±ÀÌ Á÷¼±Ã³·³ ³ª¿Í¾ß Çϴµ¥ ÈÛ¼Òó·³ ³ª¿É´Ï´Ù.
´Ù½ÃÇѹøºÎʵ右´Ï´Ù.
==========================
study(title="Average True Range Trailing Stops Strategy, by Sylvain Vervoort", overlay = true)
nATRPeriod = input(5)
nATRMultip = input(3.5)
xATR = atr(nATRPeriod)
nLoss = nATRMultip * xATR
xATRTrailingStop = iff(close > nz(xATRTrailingStop[1], 0) and close[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), close - nLoss),
iff(close < nz(xATRTrailingStop[1], 0) and close[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), close + nLoss),
iff(close > nz(xATRTrailingStop[1], 0), close - nLoss, close + nLoss)))
pos = iff(close[1] < nz(xATRTrailingStop[1], 0) and close > nz(xATRTrailingStop[1], 0), 1,
iff(close[1] > nz(xATRTrailingStop[1], 0) and close < nz(xATRTrailingStop[1], 0), -1, nz(pos[1], 0)))
color = pos == -1 ? red: pos == 1 ? green : blue
plot(xATRTrailingStop, color=color, title="ATR Trailing Stop")
===============================================
ÀÛ¼ºÇØÁֽмö½Ä
input : nATRPeriod(5);
input : nATRMultip(3.5);
var : xATR(0),nLoss(0),xATRTrailingStop(0),ps(0),nz(0),color(0);
xATR = atr(nATRPeriod);
nLoss = nATRMultip * xATR;
nz = iff(xATRTrailingStop[1] == true,0,xATRTrailingStop[1]);
xATRTrailingStop = iff(close > nz and close[1] > nz, max(nz, close - nLoss),
iff(close < nz and close[1] < nz, min(nz, close + nLoss),
iff(close > nz, close - nLoss, close + nLoss)));
ps = iff(close[1] < nz and close > nz, 1,
iff(close[1] > nz and close < nz, -1, iff(isnan(ps[1]) ==true, 0,ps[1]))) ;
color = iff(ps == -1 , red, iff(ps == 1 , green , blue));
plot1(xATRTrailingStop, "ATR Trailing Stop",color);
==================
Ç×»ó °¨»çµå¸³´Ï´Ù. ¼ö°íÇϼ¼¿ä!!!
Á¶°Ç½ÄÀ¸·Î º¯ÇüºÎʵ右´Ï´Ù
¾È³çÇϼ¼¿ä
°ü·Ã ±Û ¸®½ºÆ®
92635
¹®Àǵ帳´Ï´Ù.
ÇØ¾Ï
2025.05.09
41
ÇöÀç±Û
Re : ¹®Àǵ帳´Ï´Ù.
¿¹½º½ºÅ¹
2025.05.09
45