답변완료
수식
안녕하세요.
하기는 고점,저점을 인식하는 지표입니다.
하기지표를 기준으로.....
# 고점 인식 후 매도
# 저점 인식 후 매수
시스템 조건 ma5, ma20 골드데드 크로스 발생시 부탁드립니다.
감사합니다.
Input:length(20);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),Text1(0),처리구분("");
var:d1(0),t1(0);
Array:고점[10,2](0),저점[10,2](0); //가격,위치
처리구분 = "";
If Highest(H,length) == H and lastHiVal <> H and
Lowest(L,length) == L and lastLoVal <> L Then
{
If 저점[1,1] > L Then 처리구분 = "저점처리";
If 고점[1,1] < H Then 처리구분 = "고점처리";
}
Else If Highest(H,length) == H and lastHiVal <> H Then
처리구분 = "고점처리";
Else If Lowest(L,length) == L and lastLoVal <> L Then
처리구분 = "저점처리";
If 처리구분 == "고점처리" Then
{
lastHiVal = H;
If 고점[1,2] < 저점[1,2] Then
{
For j = 10 DownTo 2
{
고점[j,1] = 고점[j-1,1];
고점[j,2] = 고점[j-1,2];
}
}
If 고점[1,2] < 저점[1,2] or 고점[1,1] < H Then
{
고점[1,1] = H;
고점[1,2] = Index;
sBar = Index - 저점[1,2];
eBar = 0;
If d1 == sDate[sBar] and
t1 == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
}
#TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
d1 = sDate[sBar];
t1 = stime[sBar];
Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(고점[1,1],2));
Text_SetStyle(Text1, 2, 1);
}
}
If 처리구분 == "저점처리" Then
{
lastLoVal = L;
If 저점[1,2] < 고점[1,2] then
{
For j = 10 DownTo 2
{
저점[j,1] = 저점[j-1,1];
저점[j,2] = 저점[j-1,2];
}
}
If 저점[1,2] < 고점[1,2] or 저점[1,1] > L then
{
저점[1,1] = L;
저점[1,2] = Index;
sBar = Index - 고점[1,2];
eBar = 0;
If d1 == sDate[sBar] and
t1 == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
}
#TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
d1 = sDate[sBar];
t1 = stime[sBar];
Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(저점[1,1],2));
Text_SetStyle(Text1, 2, 0);
}
}
2021-02-24
743
글번호 146596
시스템
답변완료
문의
첨부파일은 아래 수식으로 시뮬레이션한 결과입니다.
3개까지 피라미딩
문제점
진입명 b1,b2,b3으로 exit를 주었는데
b1 매칭된 xb1 으로 b2,b3도 청산됩니다.
진입명에 따라 청산하게 변경바랍니다.
b1 xb1
b2 xb2
b3 xb3
진입명 s1,s2,s3으로 exit를 주었는데
s1 매칭된 xs1 으로 s2,s3도 청산됩니다.
진입명에 따라 청산하게 변경바랍니다.
s1 xs1
s2 xs2
s3 xs3
************************************************************************************
input : 일(0.50),이(0.30),삼(0.30);
input : 일x(0.30),이x(0.30),삼x(0.30);
var : b1(0,Data2),b2(0,data3),gap1(0,Data2);
b1 = Data2((C-CloseD(1))/CloseD(1)*100);
b2 = Data3((C-CloseD(1))/CloseD(1)*100);
gap1 = b1-b2;
if MarketPosition == 0 and gap1 > 일 then
buy("b1");
if MarketPosition == 1 and MaxEntries == 1 and gap1 > 이 then
buy("b2");
if MarketPosition == 1 and MaxEntries == 2 and gap1 > 삼 then
buy("b3");
if MarketPosition == 1 and IsEntryName("b1") == true Then
{
if gap1 < 일x then
ExitLong("xb1");
}
if MarketPosition == 1 and IsEntryName("b2") == true Then
{
if gap1 < 이x then
ExitLong("xb2");
}
if MarketPosition == 1 and IsEntryName("b3") == true Then
{
if gap1 < 삼x then
ExitLong("xb3");
}
input : 사(0.20),오(0.60),육(0.60);
input : 사x(0.10),오x(0.10),육x(0.10);
var : d1(0,Data2),d2(0,data3),gap2(0,Data2);
d1 = Data2((C-CloseD(1))/CloseD(1)*100);
d2 = Data3((C-CloseD(1))/CloseD(1)*100);
gap2 = d2-d1;
if MarketPosition == 0 and gap2 > 사 then
Sell("s1");
if MarketPosition == -1 and MaxEntries == 1 and gap2 > 오 then
Sell("s2");
if MarketPosition == -1 and MaxEntries == 2 and gap2 > 육 then
Sell("s3");
if MarketPosition == -1 and IsEntryName("s1") == true Then
{
if gap2 < 사x then
ExitShort("xs1");
}
if MarketPosition == -1 and IsEntryName("s2") == true Then
{
if gap2 < 오x then
ExitShort("xs2");
}
if MarketPosition == -1 and IsEntryName("s3") == true Then
{
if gap2 < 육x then
ExitShort("xs3");
}
2021-02-24
681
글번호 146577
시스템