답변완료
매수매도 수식 재질문
"작성하신 수식이 지정한 날짜와 시간이후에 1회만 진입되게 작성이 되어 있습니다.
외부변수 N이 1이고 count < N으로 첫진입조건이 되어 있습니다.
지정한 날짜와 시간이후에 별도의 횟수제한이 없으시면 "b1"진입에 count < N 조건을 삭제하시면 되고
몇회로 제한하고자 하시면 N값을 늘리시면 됩니다." 이렇게 답변을 해주셨는데
count < N 조건을 삭제하고 돌렸더니
1차 2차 매수 진행 후에 매도신호가 나와 모두 매도가 되고 나면 다시 매수가 진행되긴 하지만 1차 2차부터 다시 매수하는게 아니라 3차부터 이어서 매수를 하더라구요. 저는 올매도 진행후에는 다시 1차매수로 돌아가게 하고 싶은데 어떻게 하면 될까요?
그리고 한가지 더 궁금한게 있는데, 코인별로 RSI하락에도 매수신호가 발생하는게 있고 발생하지 않는경우가 있는데 원인을 잘 모르겠습니다.(첨부파일 참조)
Input : 투자금액(1000000),Period(14), N(1), LPercent(30), S7Percent(70), S8Percent(80), S9Percent(90),시작일(20210315),시작시간(090000);
var : value(0), e(0),x(0),count(0),Vma(0), Tcond(false);
var : HH(0),Bxcond1(false),Bxcond2(false),Bxcond3(false);
var : LL(0),Sxcond1(false),Sxcond2(false),Sxcond3(false);
Array : VV[5](0),XX[5](0);
value = RSI(Period);
vv[0] = floor((투자금액*0.1)/NextBarOpen);
vv[1] = floor((투자금액*0.1)/NextBarOpen);
vv[2] = floor((투자금액*0.1)/NextBarOpen);
vv[3] = floor((투자금액*0.2)/NextBarOpen);
vv[4] = floor((투자금액*0.2)/NextBarOpen);
vv[5] = floor((투자금액*0.3)/NextBarOpen);
if NextBarSdate >= 시작일 and NextBarStime >= 시작시간 Then
Tcond = true;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
count = count+1;
if sdate >= 시작일 and stime >= 시작시간 Then
Tcond = true;
if Tcond == true then
{
#첫번째 매수
if (TotalTrades == 0 or MarketPosition == 0) then
{
if MarketPosition == 0 and count < N and CrossDown(value, LPercent) Then
{
buy("b1",onclose,def,vv[MaxEntries]);
}
}
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
e = e +1;
if e == 0 then
XX[e] = CurrentContracts;
Else
XX[e] = CurrentContracts-CurrentContracts[1];
}
#두번째 매수
If MarketPosition == 1 and e == 1 and CrossDown(value, LPercent) and NextBarSdate == sdate Then
{
buy("b2",onclose,def,vv[MaxEntries]);
}
#세번재매수
If MarketPosition == 1 and e == 2 and CrossDown(value, LPercent) and NextBarSdate == sdate Then
{
buy("b3",onclose,def,vv[MaxEntries]);
}
#네번재매수
If MarketPosition == 1 and e == 3 and CrossDown(value, LPercent) and NextBarSdate == sdate Then
{
buy("b4",onclose,def,vv[MaxEntries]);
}
#다섯번재매수
If MarketPosition == 1 and e == 4 and CrossDown(value, LPercent) and NextBarSdate == sdate Then
{
buy("b5",onclose,def,vv[MaxEntries]);
}
if condition1 == false and crossup(value,S7Percent) then
{
condition1 = true;
exitlong("bx1",onclose,def,"",floor(maxcontracts*0.2),1);
}
if condition2 == true and crossup(value,S8Percent) then
{
condition2 = true;
exitlong("bx2",onclose,def,"",floor(maxcontracts*0.4),1);
}
if condition3 == true and crossup(value,S9Percent) then
{
condition3 = true;
exitlong("bx3");
}
if crossdown(value,S7Percent) then
exitlong("bx");
}
else
{
condition1 = false;
condition2 = false;
condition3 = false;
condition4 = false;
}
}
2021-03-18
1262
글번호 147200
시스템
답변완료
수식어 부탁드립니다
input : StartTime(160000),EndTime(055000);
var : 전환선(0),기준선(0),선행스팬1(0),선행스팬2(0);
var : Tcond(false);
if sDate != sDate[1] then
SetStopEndofday(Endtime);
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
SetStopEndofday(0);
}
전환선 = (highest(H,9)+lowest(L,9))/2;
기준선 = (highest(H,26)+lowest(L,26))/2;
선행스팬1 = (전환선[25]+기준선[25])/2;
선행스팬2 = (highest(H,52)[25]+lowest(L,52)[25])/2;
var1 = Disparity(60);
if Tcond == true Then
{
if 전환선 > 기준선 and crossup(전환선,선행스팬1) and var1 >= 99 Then
buy("b");
if MarketPosition == 1 then
{
if 전환선 < 기준선 and CrossDown(전환선,선행스팬2) and var1 >= 99 Then
exitlong();
}
if 전환선 < 기준선 and CrossDown(전환선,선행스팬1) and var1 <= 101 Then
sell("s");
if MarketPosition == -1 then
{
if 전환선 > 기준선 and CrossUp(전환선,선행스팬2) and var1 <= 101 Then
ExitShort();
}
}
---------------------------------------------
위의 수식어를 대비했을때
1번은 한국투자증권의 결과값이고
2번은 브이아이금융투자의 결과값 입니다.
동일 수식어인데 성능보고서의 손익이 차이가 나는 이유가 뭘까요 ?
참고로 각각이 하단에 시간설정이 다르고 2번의 노란색은 매수신호후 청산시 손실로 나타납니다,
2번이 1번과 같은 결과값이 나올 수 있는 방법은 없을까요 ?
수고 하세요~
2021-03-18
909
글번호 147192
시스템
답변완료
재문의 드립니다
올려주신 수식이 매수기준가 매도기준가 진입 다 정확히 맞습니다
그런데 청산이 종가청산으로만 되어있어
보내주신 수식 맨밑에
if MarketPosition==1 and h==매도기준가 Then ExitLong("매수청산");
if MarketPosition==-1 and l==매수기준가 Then ExitShort("매도청산");
요것만 추가를 했는데요
매도기준가 가격에 청산을 하고 싶은데, 봉이 완성된 가격에 체결이 되네요
atstop,atlimit 이리저리 해보았는데 다음봉에서 신호가 뜨네요.
진입가는 수식에 맞게 정확하게 진입이 되는데
청산은 자꾸 오차가 생겨서..
청산을 매수기준가나 매도기준가에 터치하는 즉시 청산하는 방법이 있을런지요?
어제 유선전화로 친절히 설명해주셔서 다시한번 감사드립니다.
----------------------------------------------------------
안녕하세요
예스스탁입니다.
매수기준가와 매도기준가 그리는 지표식도 같이 올려드립니다
1
input : 비율(5),진입횟수(1);
var : 매수기준가(0),매도기준가(0);
input : StartTime(70000),EndTime(065000);
var : Tcond(false),entry(0);
var : Year(0),V1(0),V2(0),V3(0),V4(0),Summer(False),ST(0),ET(0);
if sDate != sDate[1] Then
{
SetStopEndofday(Endtime);
//썸머타임체크
Year = Floor(sdate/10000);
V1 = (10000 * Year) + (100 * 3) + 1;
V2 = 15 - dayofweek(v1); // 3월 두번째 일요일 날짜
v3 = (10000 * Year) + (100 * 11) + 1;
v4 = 8 - dayofweek(v3); // 11월 첫번째 일요일 날짜
Summer = bdate > (10000 * Year) + (100 * 3) + v2
And bdate < (10000 * Year) + (100 * 11) + v4;
if summer == true Then
{
ST = StartTime;
ET = EndTime;
}
Else
{
ST = StartTime+10000;
ET = EndTime+10000;
}
}
if (sdate != sdate[1] and stime >= ET) or
(sdate == sdate[1] and stime >= ET and stime[1] < ET) Then
Tcond = False;
if (sdate != sdate[1] and stime >= ST) or
(sdate == sdate[1] and stime >= ST and stime[1] < ST) Then
{
Tcond = true;
SetStopEndofday(0);
entry = 0;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if NextBarStime >= ST and sTime < ST Then
{
var1 = Floor(NextBarOpen*(1-비율/100)*10)/10;
Var2 = Ceiling(NextBarOpen*(1+비율/100)*10)/10;
Buy("b1",AtLimit,var1);
Sell("s1",AtLimit,var2);
}
else
{
if Tcond == true and entry < 진입횟수 Then
{
매수기준가 = Floor(DayOpen*(1-비율/100)*10)/10;
매도기준가 = Ceiling(DayOpen*(1+비율/100)*10)/10;
if MarketPosition <= 0 and L > 매수기준가 Then
Buy("b",AtLimit,매수기준가);
if MarketPosition >= 0 and H < 매도기준가 Then
Sell("s",AtLimit,매도기준가);
}
}
2021-03-18
985
글번호 147191
시스템
답변완료
문의
아래의 식에서 TL3가 무엇을 말하는지 설명좀 부탁드립니다.
또한 지금의 지표에서 종가가 TL3를 돌파할때 매수시그널 나올수있도록 부탁합니다.
그리고 각선들의 두께를 좀 굵게 해주시면 고맙겠습니다. 그럼 오늘도 화이팅하셔요~
input : Left(5),right(5);
var : T(0),TL(0),TL1(0),TL2(0),TL3(0);
var : HD1(0),HT1(0),HH1(0);
var : HD2(0),HT2(0),HH2(0);
var : LD1(0),LT1(0),LL1(0);
var : LD2(0),LT2(0),LL2(0);
#고점발생
if SwingHigh(1,H,Left,right,left+right+1) != -1 Then
{
#현재 고점봉 날짜/시간/가격(추세선의 출력지점설정용도)
HD1 = sdate[right];
HT1 = sTime[right];
HH1 = H[right];
#현재 고점발생후 최저가 초기값
LL1 = L;
#직전 고점봉 날짜/시간/가격
HD2 = HD1[1];
HT2 = HT1[1];
HH2 = HH1[1];
#직전 고점이후 최저가
LL2 = LL1[1];
TL_Delete(TL1);
TL_Delete(TL2);
TL_Delete(TL3);
if HD2 > 0 Then
{
#직전고점과 현재고점 연결 추세선
TL1 = TL_New(HD2,HT2,HH2,HD1,HT1,HH1);
#하락이면 (위로 추가 추세선 출력)
if HH1 < HH2 Then
{
#추세선과 각도의 상단
TL2 = TL_New(HD2,HT2,HH2+abs(HH1-LL1),HD1,HT1,HH1+abs(HH1-LL1));
#수평선
TL3 = TL_New(Hd2,HT2,HH1+abs(HH1-LL1),HD1,HT1,HH1+abs(HH1-LL1));
TL_SetColor(TL1,BLUE);
TL_SetColor(TL2,BLACK);
TL_SetColor(TL3,MAGENTA);
TL_SetExtRight(TL3,true);
}
Else #상승이면(아래로 추가 추세선 출력)
{
#추세선과 각도의 하단
TL2 = TL_New(HD2,HT2,HH2-abs(HH1-LL1),HD1,HT1,HH1-abs(HH1-LL1));
#수평선
TL3 = TL_New(Hd2,HT2,HH1-abs(HH1-LL1),HD1,HT1,HH1-abs(HH1-LL1));
TL_SetColor(TL1,BLUE);
TL_SetColor(TL2,BLACK);
TL_SetColor(TL3,MAGENTA);
TL_SetExtRight(TL3,true);
}
}
}
#고점 발생 후 최저가
if L < LL1 Then
LL1 = L;
이 식에서 TL3가 무엇을 말하는지 설명좀 부탁드립니다.
또한 지금의 지표에서 종가가 TL3를 돌파할때 매수시그널 나올수있도록 부탁합니다.
2021-03-18
973
글번호 147190
시스템
답변완료
문의
오류가 뜨네요. 정정부탁드립니다.
var : 상한가(0), UpLimit(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0);
if date >= 19981207 then {
if date < 20050328 && CodeCategory() == 2 then
UpLimit = (BP[0] * 1.12);
Else if date >= 20050328 and date < 20150615 Then
UpLimit = (BP[0] * 1.15);
Else
UpLimit = (BP[0] * 1.30);
if CodeCategory() == 2 then {
if date >= 20030721 then {
up1 = int(UpLimit/100+0.00001)*100;
up2 = int(UpLimit/100+0.00001)*100;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/5+0.00001)*5;
up7 = int(UpLimit/1+0.00001)*1;
}
else {
up1 = int(UpLimit/1000+0.00001)*1000;
up2 = int(UpLimit/500+0.00001)*500;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/10+0.00001)*10;
up7 = int(UpLimit/1+0.00001)*1;
}
}
Else {
up1 = int(UpLimit/1000+0.00001)*1000;
up2 = int(UpLimit/500+0.00001)*500;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/5+0.00001)*5;
up7 = int(UpLimit/1+0.00001)*1;
}
if CodeCategory() == 1 || CodeCategory() == 2 then {
if sdate < 20101004 Then{
If BP >= 500000 Then
상한가 = up1;
Else If BP >= 100000 Then
상한가 = iff(up2>=500000, up1, up2);
Else If BP >= 50000 Then
상한가 = iff(up3>=100000, up2, up3);
Else If BP >= 10000 Then
상한가 = iff(up4>=50000, up3, up4);
Else If BP >= 5000 Then
상한가 = iff(up5>=10000, up4, up5);
Else If BP >= 1000 Then
상한가 = iff(up5>=5000, up5, up6);
Else
상한가 = iff(up6>=1000, up6, up6);
}
Else{
If BP >= 500000 Then
상한가 = up1;
Else If BP >= 100000 Then
상한가 = iff(up2>=500000, up1, up2);
Else If BP >= 50000 Then
상한가 = iff(up3>=100000, up2, up3);
Else If BP >= 10000 Then
상한가 = iff(up4>=50000, up3, up4);
Else If BP >= 5000 Then
상한가 = iff(up5>=10000, up4, up5);
Else If BP >= 1000 Then
상한가 = iff(up5>=5000, up5, up6);
Else
상한가 = iff(up6>=1000, up6, up7);
}
}
else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF
상한가 = up6;
}
}
if C >= 상한가 Then
PlotPaintBar1(H,"상한가1",RED);
if H >= 상한가 and C < 상한가 Then
plot2(H,"상한가2",MAGENTA);
2021-03-17
703
글번호 147188
강조