커뮤니티
수식문의
2026-02-22 10:32:14
68
글번호 230680
지표 수식 문의합니다.
파라볼릭(종가) 기본값으로 지표를 만드려고 하는데..
종가를 var1로 대체해서 다른 값을 넣는 수식을 만드려고 합니다.
항상 감사드립니다.
답변 1
예스스탁 예스스탁 답변
2026-02-23 12:44:07
안녕하세요
예스스탁입니다.
Input : AF(0.02), AFMAX(0.2);
Var : Price(0),Direction(0), SAR_Value(Price), AF_Value(.02);
var : HighValue(0), LowValue(0), EP(0),CSarv(0);
var1 = ma(C,20);
if CurrentBar >= 1 Then
{
Price = var1;
if CurrentBar == 1 Then
{
HighValue = Price;
LowValue = Price;
}
if EP != 0 Then
{
if Direction == 1 then
{
EP = HighValue;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if Price > HighValue then
{
HighValue = Price;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
if Price < SAR_Value then
{
Direction = -1;
SAR_Value = EP;
AF_Value = 0;
EP = 0;
LowValue = Price;
}
}
else
{
EP = LowValue;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if Price < LowValue then
{
LowValue = Price;
AF_Value = AF_Value + Af;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
if Price > SAR_Value then
{
Direction = 1;
SAR_Value = EP;
AF_Value = 0;
EP = 0;
HighValue = Price;
}
}
CSarv = SAR_Value;
}
else
{
if SAR_Value != 0 && EP == 0 then
{
if Direction == 1 then
{
EP = HighValue;
AF_Value = AF;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if Price > HighValue then
{
HighValue = Price;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
}
else
{
EP = LowValue;
AF_Value = Af;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if Price < LowValue then
{
LowValue = Price;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
}
CSarv = SAR_Value;
}
else
{
if Direction == 0 then
{
if Price > Price[1] then Direction = 1;
else
if Price < Price[1] then Direction = -1;
}
else
{
if Direction == 1 then
{
if Price < Price[1] then
{
Direction = -1;
SAR_Value = HighValue;
CSarv = SAR_Value;
}
}
if Direction == -1 then
{
if Price > Price[1] then
{
Direction = 1;
SAR_Value = LowValue;
CSarv = SAR_Value;
}
}
}
LowValue = min(Price, LowValue);
HighValue = max(Price, HighValue);
}
}
Plot1(CSarv,"CSar",IFF(Price>CSarv,Red,Blue));
}
즐거운 하루되세요