답변완료
부탁드립니다
안녕하세요.
아래의 TV수식을 YS수식으로 바꿀 수 있을까요?
부탁드립니다.
수식명 : Gaussian Moving Average (GA)
//@version=5
indicator("GA", overlay = true)
// Define a function to calculate the Gaussian weight for a given 'k' and 'smooth_per'
gaussian_weight(k, smooth_per) =>
// Calculate the standard deviation (sigma) based on the smoothing period
sigma = smooth_per / 2.0
// Calculate the exponent part of the Gaussian function
exponent = -0.5 * math.pow(k / sigma, 2)
// Calculate and return the Gaussian weight
math.exp(exponent)
// Define a function that takes an array of values as input
// and returns the Gaussian moving average of the data
gaussianma(values, length) =>
// Create an array to store the Gaussian weights
weights_array = array.new_float(length)
for i = 0 to length - 1
array.set(weights_array, i, gaussian_weight(i, length))
// Create an array to store the values
values_array = array.new_float(length)
for i = 0 to length - 1
array.set(values_array, i, values[length - 1 - i])
// Calculate the weighted sum of the values and weights
sum = 0.0
sumw = 0.0
for i = 0 to length - 1
sum += array.get(values_array, i) * array.get(weights_array, i)
sumw += array.get(weights_array, i)
// Return the moving average
sum / sumw
source = input.source(close, "Source")
length = input.int(20, "Length", 1)
// Plot the Gaussian moving average on the chart
plot(gaussianma(source, length), color = color.orange)
2023-11-19
1239
글번호 174189
지표
답변완료
강조 부탁 드립니다.
* 매번 많은 도움에 고맙습니다.
* 아래 수식 에서 수식대로 분홍색/블랙선은 찍히면서
1. 분홍색선이 이전 분홍색선 3개(변수)의 고가 보다 값이 크면 점찍기 추가
2. 불랙선이 이전 불랙 선 3개(변수)의 저가 보다 값이 작으면 점찍기 추가
부탁 드립니다.
즉 이전 3개선보다 크면 점 을 별도로 찍어 주십시요.
## 아래 수식
input : P(10),n(8),틱(10);
input : 틱1(10),틱2(20),틱3(50);
var : TX(0);
var : cnt(0),LL(0),HH(0);
Array : LTL[10](0),HTL[10](0);
var : LTL1(0),LTL2(0),LTL3(0),LTL4(0),LTL5(0),LTL6(0);
var : HTL1(0),HTL2(0),HTL3(0),HTL4(0),HTL5(0),HTL6(0);
if L < Lowest(L,P)[1] and (LL == 0 or (LL > 0 and abs(L-LL) >= PriceScale*틱)) Then
{
LL = L;
For cnt = 9 DownTo 1
{
LTL[cnt] = LTL[cnt-1];
}
LTL[0] = TL_new(sDate,sTime,LL,NextBarSdate,NextBarStime,LL);
TL_SetColor(LTL[0],Black);
TL_SetSize(LTL[0],2);
TL_Delete(LTL[n]);
}
Else
{
TL_SetEnd(LTL[0],sDate,sTime,LL);
}
if H > highest(H,P)[1] and (HH == 0 or (HH > 0 and abs(H-HH) >= PriceScale*틱)) Then
{
HH = H;
For cnt = 9 DownTo 1
{
HTL[cnt] = HTL[cnt-1];
}
HTL[0] = TL_new(sDate,sTime,HH,NextBarSdate,NextBarStime,HH);
TL_SetColor(HTL[0],Magenta);
TL_SetSize(HTL[0],2);
TL_Delete(HTL[n]);
}
Else
{
TL_SetEnd(HTL[0],sDate,sTime,HH);
}
** 추운 날씨에 감기 조심하십시요^^
2023-11-19
1348
글번호 174188
지표
답변완료
문의드립니다...
아래 신호검색은 키움에서 작성된 것입니다..
이것을 예스트레이더 강조로 변환요청합니다.
항상 도움을 주셔서 감사합니다..
A1=MA(C,5);
A2=MA(C,10);
A3=MA(C,20);
A4=MA(C,40);
A5=MA(C,60);
A6=MA(C,120);
A=Lowest(L, 260, 1)*1.25;
B=sar(0.02,0.2);
조건=A1(1)<A1 && A2(1)>A2 && A3(1)>A3 &&
A4(1)>A4 && A5(1)>A5 && A6(1)>A6;
조건 && !조건(1) && B<=C && A>=A1 && C>O
2023-11-18
1054
글번호 174182
강조
답변완료
수식 검토 부탁합니다.
아래식의 의도는 기본 시장과 data2의 시장의 스프레드를 평균화한 지표를 만드는 것입니다.
input:shortp(5),longp(20),StartTime(90000),EndTime(152000);
Vars:CH(0),CL(0),spread(0),Tcond(false);
if (stime >= StartTime) and (stime <= endTime) Then
{
Tcond = true;
spread = (C/(H/L))/(data2(C)/(data2(H)/data2(L)));
}
if (stime < StartTime) or (stime > endTime) Then
{
Tcond = False;
}
if Tcond == true Then
{
spread = spread;
}
if Tcond == false Then
{
spread = 1;
}
CH =ma(spread,shortp);
CL =ma(spread,longp);
Var1=CH-CL;
Plot1(var1,"SPREAD");
특정시간대의 스프레드는 무의미하다고 보고 1로 고정시키고 그 외의 시간대의 평균을 구하고 싶으나 위의 식대로 하면 무의미한 직선의 형태로 고정되어 나타납니다. 수정 가능한지 여부와 ma(평균)에서 특정 시간대를 제외하는 방식으로 식이 가능한지 여부도 알고 싶습니다.
그리고 어제의 특정 시간대의 가격을 소환하는 지표수식 부탁드립니다.
감사합니다.
2023-11-18
1398
글번호 174181
지표