예스스탁
예스스탁 답변
2021-11-23 13:42:46
안녕하세요
예스스탁입니다.
죄송합니다. 수식답변이 잘못 붙여넣기 되었습니다.
아래 수정한 식입니다.
Input : AF(0.02), AFMAX(0.2),진입횟수(4);
Var : Direction(0), SAR_Value(Close), AF_Value(.02), HighValue(High), LowValue(Low);
var : EP(0),csarv(0),idx(0),entry(0);
if Index == 0 or Bdate != Bdate[1] Then
{
Direction = 0;
SAR_Value = c;
AF_Value = 0.02;
HighValue = c;
LowValue = c;
EP = 0;
idx = 0;
entry = 0;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
idx = idx+1;
if EP != 0 Then
{
if Direction == 1 then
{
EP = HighValue;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if High > HighValue then
{
HighValue = High;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
if Close < SAR_Value then
{
Direction = -1;
SAR_Value = EP;
AF_Value = 0;
EP = 0;
LowValue = low;
}
}
else
{
EP = LowValue;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if Low < LowValue then
{
LowValue = Low;
AF_Value = AF_Value + Af;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
if Close > SAR_Value then
{
Direction = 1;
SAR_Value = EP;
AF_Value = 0;
EP = 0;
HighValue = High;
}
}
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 High > HighValue then
{
HighValue = High;
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 Low < LowValue then
{
LowValue = Low;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
}
CSarv = SAR_Value;
}
else
{
if Direction == 0 then
{
if Close > Close[1] then Direction = 1;
else
if Close < Close[1] then Direction = -1;
}
else
{
if Direction == 1 then
{
if Close < Close[1] then
{
Direction = -1;
SAR_Value = HighValue;
CSarv = SAR_Value;
}
}
if Direction == -1 then
{
if Close > Close[1] then
{
Direction = 1;
SAR_Value = LowValue;
CSarv = SAR_Value;
}
}
}
LowValue = min(Low, LowValue);
HighValue = max(High, HighValue);
}
}
if idx == 3 and entry < 진입횟수 Then
{
if C < O and C < Csarv Then
Sell();
if C > O and C > Csarv Then
Buy();
}
if idx > 3 and entry < 진입횟수 Then
{
if CrossUp(C,Csarv) Then
Buy();
if CrossDown(c,Csarv) Then
Sell();
}
if entry == 진입횟수 Then
{
if MarketPosition == -1 and CrossUp(C,Csarv) Then
ExitShort();
if MarketPosition == 1 and CrossDown(c,Csarv) Then
ExitLong();
}
즐거운 하루되세요
> 유튜버 님이 쓴 글입니다.
> 제목 : 74738 수식 확인 부탁드립니다
> 74712 시스템 수식 수정 부탁드렸는데 시스템 수식에 plot 수식이 기재되어있습니다
수정 부탁드립니다.
감사합니다
--------------------------------
요청드린 수식은 매수,매도,매도,매수 4회 또는 매도,매수,매도,매수 4회 거래 후 당일 거래를 종료하는 것인데 4회 이후 계속 거래가 되고 있습니다. 수정 부탁 드립니다.
감사합니다
----------
안녕하세요
예스스탁입니다.
Input : AF(0.02), AFMAX(0.2);
Var : Direction(0), SAR_Value(Close), AF_Value(.02), HighValue(High), LowValue(Low), EP(0),csarv(0),idx(0);
if Index == 0 or Bdate != Bdate[1] Then
{
Direction = 0;
SAR_Value = c;
AF_Value = 0.02;
HighValue = c;
LowValue = c;
EP = 0;
idx = 0;
}
idx = idx+1;
if EP != 0 Then
{
if Direction == 1 then
{
EP = HighValue;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if High > HighValue then
{
HighValue = High;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
if Close < SAR_Value then
{
Direction = -1;
SAR_Value = EP;
AF_Value = 0;
EP = 0;
LowValue = low;
}
}
else
{
EP = LowValue;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if Low < LowValue then
{
LowValue = Low;
AF_Value = AF_Value + Af;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
if Close > SAR_Value then
{
Direction = 1;
SAR_Value = EP;
AF_Value = 0;
EP = 0;
HighValue = High;
}
}
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 High > HighValue then
{
HighValue = High;
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 Low < LowValue then
{
LowValue = Low;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
}
CSarv = SAR_Value;
}
else
{
if Direction == 0 then
{
if Close > Close[1] then Direction = 1;
else
if Close < Close[1] then Direction = -1;
}
else
{
if Direction == 1 then
{
if Close < Close[1] then
{
Direction = -1;
SAR_Value = HighValue;
CSarv = SAR_Value;
}
}
if Direction == -1 then
{
if Close > Close[1] then
{
Direction = 1;
SAR_Value = LowValue;
CSarv = SAR_Value;
}
}
}
LowValue = min(Low, LowValue);
HighValue = max(High, HighValue);
}
}
if idx == 3 Then
{
if C < O and C < Csarv Then
Sell();
if C > O and C > Csarv Then
Buy();
}
if idx > 3 Then
{
if CrossUp(C,Csarv) Then
Buy();
if CrossDown(c,Csarv) Then
Sell();
}
즐거운 하루되세요
> 유튜버 님이 쓴 글입니다.
> 제목 : 시스템 질문입니다
> 전일과 분리되어 당일부터 실행되는 종가 파라볼릭 기준
동시호가 캔들 포함 3번째 캔들이 음봉이고 종가가 파라볼릭보다 낮으면 매도하여
종가 파라볼릭 음양 전환에 따라 매도,매수,매도,매수 4번 거래로 당일 거래 종료.
동시호가 캔들 포함 3번째 캔들이 양봉이고 종가가 파라볼릭보다 높으면 매수하여
종가 파라볼릭 양,음 전환에 따라 매수,매도,매수,매도 4번 거래로 당일 거래 종료.
감사합니다
-------------------------------------
안녕하세요
예스스탁입니다.
당일진입횟수가 빠져있어 추가했습니다.
Input : 분(30), Length(14),Period(7);
var : cnt(0),S1(0),D1(0),TM(0),TF1(0);
var : SigSum(0),count2(0),RSIsig(0);
Var : Counter(0), DownAmt(0), UpAmt(0), UpSum(0), DownSum(0), UpAvg(0), DownAvg(0);
var : idx(0), PreUpAvg(0), preDownAvg(0),HH(0),LL(0),StoRsi(0);
Array : C1[100](0),RSIV[100](-1);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF1 = TimeToMinutes(stime)%분;
if Bdate != Bdate[1] or (bdate == bdate[1] and TF1 < TF1[1]) Then
{
for cnt = 1 to 99
{
C1[cnt] = C1[cnt-1][1];
RSIV[cnt] = RSIV[cnt-1][1];
}
PreUpAvg = UpAvg[1];
preDownAvg = DownAvg[1];
idx = idx + 1;
}
C1[0] = C;
If idx == Length+2 Then {
UpSum = 0;
DownSum = 0;
For Counter = 0 To Length - 1 {
UpAmt = C1[Counter] - C1[Counter+1];
If UpAmt >= 0 Then
DownAmt = 0;
Else{
DownAmt = -UpAmt;
UpAmt = 0;
}
UpSum = UpSum + UpAmt;
DownSum = DownSum + DownAmt;
}
UpAvg = UpSum / Length;
DownAvg = DownSum / Length;
}
If idx > Length+2 Then
{
UpAmt = C1[0] - C1[1];
If UpAmt >= 0 Then
DownAmt = 0;
Else {
DownAmt = -UpAmt;
UpAmt = 0;
}
UpAvg = (PreUpAvg * (Length - 1) + UpAmt) / Length;
DownAvg = (preDownAvg * (Length - 1) + DownAmt) / Length;
}
If UpAvg + DownAvg <> 0 Then
RSIv[0] = 100 * UpAvg / (UpAvg + DownAvg);
Else
RSIv[0] = 0;
if RSIv[Period] > 0 Then
{
HH = RSIv[0];
LL = RSIv[0];
For cnt = 0 to period-1
{
if RSIV[cnt] > HH Then
HH = RSIV[cnt];
if RSIV[cnt] < LL Then
LL = RSIV[cnt];
}
StoRsi = (RSIv[0]-LL)/(HH-LL)*-1;
plot1(StoRsi,"StoRsi");
}
}
즐거운 하루되세요