답변완료
수식 문의 드립니다.
안녕하세요.
수식 문의 드립니다.
A. 상단_(가중)선택적_그물망
1.
M = ma(C, 기간, 종류);
if(중심 < M, M, 중심)
기간 = 1
중심 = ma(C, 20)
종류 = 가중
2
M = ma(C, 기간+1, 종류);
if(중심 < M, M, 중심)
3
M = ma(C, 기간+2, 종류);
if(중심 < M, M, 중심)
4.
M = ma(C, 기간+3, 종류);
if(중심 < M, M, 중심)
5
M = ma(C, 기간+4, 종류);
if(중심 < M, M, 중심)
--------------------------------------------
B_. 하단__(가중)선택적_그물망
1.
M = ma(C, 기간, 종류);
if(중심 > M, M, 중심)
기간 = 1
중심 = ma(C, 20)
종류 = 가중
2
M = ma(C, 기간+1, 종류);
if(중심 > M, M, 중심)
3
M = ma(C, 기간+2, 종류);
if(중심 > M, M, 중심)
4.
M = ma(C, 기간+3, 종류);
if(중심 > M, M, 중심)
5
M = ma(C, 기간+4, 종류);
if(중심 > M, M, 중심)
--------------------------------------------
C_. 5 가중이평+ 20 가중이평-G/C
1. ma(C, 기간1, 종류) // 가중
2. ma(C, 기간2, 종류) // 가중
3. G/C
A = MA(C, 기간1, 종류);
B = MA(C, 기간2, 종류);
조건 = CrossUp(A, B) or CrossDown(A, B);
S = Valuewhen(1, 조건, 위치); // 위치=B
----------------------------------------
D. 강조+20 가중이평
1
M = ma(C, 기간, 종류);
2.강조
M(두께) // 두께 = 2
==========================
부탁드립니다.
감사 합니다
2025-07-19
243
글번호 192598
지표
답변완료
변환 부탁드립니다
다음의 pine editor용 코드를
1. supertrend 함수
2. kalman Filter 함수
3. 이 함수들을 사용한 지표로 변환 부탁 드립니다. 감사합니다.
(색깔은 Green, Red, Gray로만 표시하고 입력 변수 설명 등 불요)
//@version=6
indicator("Range Filtered Trend Signals [AlgoAlpha]", "AlgoAlpha - Range Filtered", true)
groupKalman = "Kalman Filter"
kalmanAlpha = input.float(0.01, title="Kalman Alpha", tooltip="The Alpha parameter controls the smoothing factor of the Kalman filter. A smaller value results in more smoothing, while a larger value makes the filter more responsive to price changes.", group=groupKalman)
kalmanBeta = input.float(0.1, title="Kalman Beta", tooltip="The Beta parameter influences the rate of change in the Kalman filter. It adjusts the filter's sensitivity to trend changes.", group=groupKalman)
kalmanPeriod = input.int(77, title="Kalman Period", tooltip="The Period defines the number of bars used in the Kalman filter calculation, affecting the filter's responsiveness to market movements.", group=groupKalman)
dev = input.float(1.2, title="Deviation", tooltip="The Deviation parameter sets the multiplier for the deviation from the trend line, affecting the width of the trend band.", group=groupKalman)
groupSupertrend = "Supertrend"
supertrendFactor = input.float(0.7, title="Supertrend Factor", tooltip="This Factor determines the multiplier for the ATR in the Supertrend calculation, affecting the distance of the trend line from the price.", group=groupSupertrend)
supertrendAtrPeriod = input.int(7, title="ATR Period", tooltip="The ATR Period specifies the number of bars used to calculate the Average True Range, which is a component of the Supertrend indicator.", group=groupSupertrend)
groupColors = "Colors"
green = input.color(#00ffbb, title="Bullish Color", tooltip="This color is used to indicate a bullish trend in the chart.", group=groupColors)
red = input.color(#ff1100, title="Bearish Color", tooltip="This color is used to indicate a bearish trend in the chart.", group=groupColors)
kalman(a, b, alpha, beta) =>
var float v1 = na
var float v2 = 1.0
var float v3 = alpha * b
var float v4 = 0.0
var float v5 = na
if na(v1)
v1 := a[1]
v5 := v1
v4 := v2 / (v2 + v3)
v1 := v5 + v4 * (a - v5)
v2 := (1 - v4) * v2 + beta / b
v1
pine_supertrend(k, factor, atrPeriod) =>
src = k
atr = ta.atr(atrPeriod)
upperBand = src + factor * atr
lowerBand = src - factor * atr
prevLowerBand = nz(lowerBand[1])
prevUpperBand = nz(upperBand[1])
lowerBand := lowerBand > prevLowerBand or k[1] < prevLowerBand ? lowerBand : prevLowerBand
upperBand := upperBand < prevUpperBand or k[1] > prevUpperBand ? upperBand : prevUpperBand
int _direction = na
float superTrend = na
prevSuperTrend = superTrend[1]
if na(atr[1])
_direction := 1
else if prevSuperTrend == prevUpperBand
_direction := k > upperBand ? -1 : 1
else
_direction := k < lowerBand ? 1 : -1
superTrend := _direction == -1 ? lowerBand : upperBand
[superTrend, _direction]
k = kalman(close, kalmanPeriod, kalmanAlpha, kalmanBeta)
[supertrend, direction] = pine_supertrend(k, supertrendFactor, supertrendAtrPeriod)
vola = ta.wma(high-low, 200)
upper = k+vola*dev
lower = k-vola*dev
midbody = math.avg(close, open)
var trend = 0
if close > upper
trend := 1
else if close < lower
trend := -1
ktrend = 0
if direction < 0
ktrend := 1
else if direction > 0
ktrend := -1
t = 70
t_ = 20
p1 = plot(ktrend * trend == 1 ? k : na, color=color.gray, style = plot.style_linebr, linewidth = 3)
m = plot(midbody, color=color.gray, display = display.none)
up = plot(trend == -1 or ktrend * trend == -1 ? upper : na, color=ktrend * trend == -1 ? color.gray : ktrend == -1 ? color.new(red, t) : color.gray, style = plot.style_circles)
lo = plot(trend == 1 or ktrend * trend == -1 ? lower : na, color=ktrend * trend == -1 ? color.gray : ktrend == 1 ? color.new(green, t) : color.gray, style = plot.style_circles)
2025-07-19
280
글번호 192596
지표
답변완료
문의
아래 답변 수식을 검토했더니
요청대로 b1 익절 이후 b2 진입은 막았으나,
익절이 발생하지 않은 경우의 b2 진입도 막는 결과가 발생하였습니다
(b1 익절이 없는 경우, b2 진입이 20번 발생했다면 답변수식으로는 10번 정도 진입함)
다시 부탁드립니다.
항상 고맙습니다.
***************************************************************************************
안녕하세요
예스스탁입니다.
Input : 최대(99999),최소(0),거래횟수(2);
input : lock1(103000),b1(9),진입눌림1(4),진입돌파1(2);
input : lock2(113000),b2(18),진입눌림2(3),진입돌파2(1);
input : als(50),atr1(0),atr2(32),agl(128);
input : bls(38),btr1(0),btr2(90),bgl(108);
var : T1(0,data1),entry(0,data1);
var : LL(0,data2),EH(0,data2),E1(0,data2),H1(0,data2);
var : i1(0,data2),S1(0,data2),L1(0,data2);
var : DH2(0,data2),DL2(0,data2);
var : Trade(true,Data1);
if data1(Bdate != Bdate[1]) Then
{
T1 = TotalTrades;
E1 = 0;
DH2 = data2(H);
DL2 = data2(L);
Trade = true;
}
if data2(H > DH2) Then
DH2 = data2(H);
if data2(L < DL2) Then
DL2 = data2(L);
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if TotalTrades > TotalTrades[1] and
IsEntryName("b1",1) == true and
IsExitName("StopProfitTarget",1) == true Then
Trade = False;
if MarketPosition == 0 and entry == 0 Then
{
if data2(E1 == 0 and C >= DL2+PriceScale*B1) Then
{
E1 = 1;
H1 = data2(H);
i1 = data2(index);
}
if data2(E1 == 1 and index > i1) then
{
if data2(H > H1) Then
H1 = data2(H);
if data2(L <= H1-PriceScale*진입눌림1) Then
{
E1 = 2;
i1 = data2(index);
S1 = H1;
}
}
if stime<lock1 and 최대 >= C and C >= 최소 and data2(E1 == 2 and index > i1 and C >= S1+PriceScale*진입돌파1) and Trade == true Then
{
buy("b1");
}
}
if TotalTrades > TotalTrades[1] Then
LL = data2(L);
if data2(L < LL) Then
LL = data2(L);
if MarketPosition == 0 and entry >= 1 and entry < 거래횟수 Then
{
if data2(E1 == 0 and C >= LL+PriceScale*B2 and C[1] < LL+PriceScale*B2) Then
{
E1 = 1;
H1 = data2(H);
i1 = data2(index);
}
if data2(E1 == 1 and index > i1) then
{
if data2(H > H1) Then
H1 = data2(H);
if data2(L <= H1-PriceScale*진입눌림2) Then
{
E1 = 2;
i1 = data2(index);
S1 = H1;
}
}
if stime<lock2 and data2(E1 == 2 and index > i1 and C >= S1+PriceScale*진입돌파2) and Trade == true Then
{
buy("b2");
}
}
if MarketPosition== 1 Then
{
if IsEntryName("b1") == true Then
{
SetStopLoss(PriceScale*als,PointStop);
SetStopTrailing(PriceScale*atr2,PriceScale*atr1,PointStop,1);
SetStopProfittarget(PriceScale*agl,PointStop);
}
Else if IsEntryName("b2") == true Then
{
SetStopLoss(PriceScale*bls,PointStop);
SetStopTrailing(PriceScale*btr2,PriceScale*btr1,PointStop,1);
SetStopProfittarget(PriceScale*bgl,PointStop);
}
Else
{
SetStopLoss(0);
SetStopTrailing(0,0);
SetStopProfittarget(0);
}
}
즐거운 하루되세요
> 목마와숙녀 님이 쓴 글입니다.
> 제목 : 문의
> 아래 수식은
국내 데이트레이딩
하루 2회 거래하는 수식입니다.
첫번째 진입(b1)에서 익절로 포지션을 청산했을 경우
거래를 중지하는 수식을 추가해주십시요.
b1 익절 이후 b2 진입은 성공율이 낮기 때문입니다.
항상 고맙습니다.
**************************************************************************************
Input : 최대(99999),최소(0),거래횟수(2);
input : lock1(103000),b1(9),진입눌림1(4),진입돌파1(2);
input : lock2(113000),b2(18),진입눌림2(3),진입돌파2(1);
input : als(50),atr1(0),atr2(32),agl(128);
input : bls(38),btr1(0),btr2(90),bgl(108);
var : T1(0,data1),entry(0,data1);
var : LL(0,data2),EH(0,data2),E1(0,data2),H1(0,data2);
var : i1(0,data2),S1(0,data2),L1(0,data2);
var : DH2(0,data2),DL2(0,data2);
if data1(Bdate != Bdate[1]) Then
T1 = TotalTrades;
if data2(Bdate != Bdate[1]) Then{
E1 = 0;
DH2 = data2(H);
DL2 = data2(L);
}
if data2(H > DH2) Then
DH2 = data2(H);
if data2(L < DL2) Then
DL2 = data2(L);
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if MarketPosition == 0 and entry == 0 Then{
if data2(E1 == 0 and C >= DL2+PriceScale*B1) Then{
E1 = 1;
H1 = data2(H);
i1 = data2(index);
}
if data2(E1 == 1 and index > i1) then{
if data2(H > H1) Then
H1 = data2(H);
if data2(L <= H1-PriceScale*진입눌림1) Then{
E1 = 2;
i1 = data2(index);
S1 = H1;
}
}
if stime<lock1 and 최대 >= C and C >= 최소 and data2(E1 == 2 and index > i1 and C >= S1+PriceScale*진입돌파1) Then{
buy("b1");
}
}
if TotalTrades > TotalTrades[1] Then
LL = data2(L);
if data2(L < LL) Then
LL = data2(L);
if MarketPosition == 0 and entry >= 1 and entry < 거래횟수 Then{
if data2(E1 == 0 and C >= LL+PriceScale*B2 and C[1] < LL+PriceScale*B2) Then{
E1 = 1;
H1 = data2(H);
i1 = data2(index);
}
if data2(E1 == 1 and index > i1) then{
if data2(H > H1) Then
H1 = data2(H);
if data2(L <= H1-PriceScale*진입눌림2) Then{
E1 = 2;
i1 = data2(index);
S1 = H1;
}
}
if stime<lock2 and data2(E1 == 2 and index > i1 and C >= S1+PriceScale*진입돌파2) Then{
buy("b2");
}
}
if MarketPosition== 1 Then
{
if IsEntryName("b1") == true Then
{
SetStopLoss(PriceScale*als,PointStop);
SetStopTrailing(PriceScale*atr2,PriceScale*atr1,PointStop,1);
SetStopProfittarget(PriceScale*agl,PointStop);
}
Else if IsEntryName("b2") == true Then
{
SetStopLoss(PriceScale*bls,PointStop);
SetStopTrailing(PriceScale*btr2,PriceScale*btr1,PointStop,1);
SetStopProfittarget(PriceScale*bgl,PointStop);
}
Else
{
SetStopLoss(0);
SetStopTrailing(0,0);
SetStopProfittarget(0);
}
}
2025-07-18
201
글번호 192587
시스템