예스스탁
예스스탁 답변
2023-08-16 16:48:58
안녕하세요
예스스탁입니다.
Input : af(0.02), maxAF(0.2);
var1 = CSar(af,maxAF);
input : lookbackLength(10), coeff(4);
var : count1(0), diff1(0), totalCount1(0), totalSum1(0), penAvg1(0), Safety1(0), finalSafety1(0);
var : count2(0), diff2(0), totalCount2(0), totalSum2(0), penAvg2(0), Safety2(0), finalSafety2(0);
//DownTrend Stop
if high > high[1] then
count1 = 1;
else
count1 = 0;
if high > high[1] then
diff1 = high - high[1];
else
diff1 = 0;
totalCount1 = accumN(count1, lookbackLength);
totalSum1 = accumN(diff1, lookbackLength);
penAvg1 = (totalSum1 / totalCount1);
safety1 = high[1] + (penAvg1[1] * coeff);
finalSafety1 = Min(safety1, safety1[1], safety1[2], safety1[3], safety1[4], safety1[5]);
//UpTrend Stop
if low < low[1] then
count2 = 1;
else
count2 = 0;
if low < low[1] then
diff2 = low[1] - low;
else
diff2 = 0;
totalCount2 = accumN(count2, lookbackLength);
totalSum2 = accumN(diff2, lookbackLength);
penAvg2 = (totalSum2 / totalCount2);
safety2 = low[1] - (penAvg2[1] * coeff);
finalSafety2 = Max(safety2, safety2[1], safety2[2], safety2[3], safety2[4], safety2[5]);
if MarketPosition <= 0 and CrossUp(C,var1) Then
Buy("b");
if MarketPosition == 1 Then
{
if CrossDown(C,finalSafety1) Then
ExitLong("bx1");
if CrossDown(C,finalSafety2) Then
ExitLong("bx2");
}
if MarketPosition == 0 and MarketPosition(1) == 1 and
IsExitName("bx1",1) == true and
CountIf(C < finalSafety2,BarsSinceExit(1)) < 1 and
C > H[BarsSinceExit(1)] Then
Buy("reB");
if MarketPosition >= 0 and CrossDown(C,var1) Then
Sell("s");
if MarketPosition == -1 Then
{
if CrossUp(C,finalSafety1) Then
ExitShort("sx1");
if CrossUp(C,finalSafety2) Then
ExitShort("sx2");
}
if MarketPosition == 0 and MarketPosition(1) == -1 and
IsExitName("sx2",1) == true and
CountIf(C > finalSafety1,BarsSinceExit(1)) < 1 and
C < L[BarsSinceExit(1)] Then
Sell("reS");
즐거운 하루되세요
> theogo66 님이 쓴 글입니다.
> 제목 : 수식 부탁드립니다.
> 파라볼릭지표와 엘더박사의 safe zone을 이용한 수식을 부탁드립니다.
#.진입 기준 ; 파라볼릭 종가 지표의 추세 반전.
#.청산 기준 ; 엘더박사의 safe zone
1.매수진입01; 종가기준의 파라볼릭지표가 하락하다가 상승 추세로 전환하면 그때 종가로 매수진입.
1)매수분 청산01; safe zone의 plot1을 상회한 후,하락반전하여 종가가 plot1선을 뚫고 내려오면 그때 종가에 청산.
2)매수분 청산02; plot1선을 넘지 못한 상태에서 plot2선을 뚫고 내려가면 그때 종가에 청산.
3)매수 재진입02 ; 청산01을 한 후, 청산2조건(plot2선 뚫고 하락)이 오지 않은 상태에서 청산01조건에 해당되는 봉의 고가를 넘으면 long 재진입.
2.매도진입01 ; 종가기준인 파라볼릭지표가 상승하다가 하락 추세로 전환하면 그때 종가로 매도진입.
1)매도분 청산01; safe zone의 plot2을 하회한 후,상승반전하여 종가가 plot2선을 뚫고 올라오면 그때 종가에 청산.
2)매도분 청산02; plot2선을 넘지 못한 상태에서 plot1선을 뚫고 올라가면 그때 종가에 청산.
3)매도 재진입02 ; 청산01을 한 후, 청산2조건(plot선 뚫고 상승)이 오지 않은 상태에서 청산01조건에 해당되는 봉의 저가를 하회하여 하락하면 short 재진입.
*혹시라도 매수재진입이나 매도재진입 수식이 불가하면 재진입부분의 수식은 제외해도 되고요.
- 아래 -
#. 지표 내역
1)파라볼릭 (종가기준)
Input : af(0.02), maxAF(0.2);
var1 = CSar(af,maxAF);
if var1 > C Then
Plot1(var1, "CSAR",BLACK);
Else
Plot1(var1, "CSAR",rgb(205, 92 ,92));
---------------------------------------------
2)엘더박사의 safe zone 내역 (gambler님 것)
input : lookbackLength(10), coeff(4);
var : count1(0), diff1(0), totalCount1(0), totalSum1(0), penAvg1(0), Safety1(0), finalSafety1(0);
var : count2(0), diff2(0), totalCount2(0), totalSum2(0), penAvg2(0), Safety2(0), finalSafety2(0);
//DownTrend Stop
if high > high[1] then
count1 = 1;
else
count1 = 0;
if high > high[1] then
diff1 = high - high[1];
else
diff1 = 0;
totalCount1 = accumN(count1, lookbackLength);
totalSum1 = accumN(diff1, lookbackLength);
penAvg1 = (totalSum1 / totalCount1);
safety1 = high[1] + (penAvg1[1] * coeff);
finalSafety1 = Min(safety1, safety1[1], safety1[2], safety1[3], safety1[4], safety1[5]);
//UpTrend Stop
if low < low[1] then
count2 = 1;
else
count2 = 0;
if low < low[1] then
diff2 = low[1] - low;
else
diff2 = 0;
totalCount2 = accumN(count2, lookbackLength);
totalSum2 = accumN(diff2, lookbackLength);
penAvg2 = (totalSum2 / totalCount2);
safety2 = low[1] - (penAvg2[1] * coeff);
finalSafety2 = Max(safety2, safety2[1], safety2[2], safety2[3], safety2[4], safety2[5]);
plot1(finalsafety1);
plot2(finalsafety2);
감사합니다.