답변완료
문의드립니다
재문의/
아래와 같이 문의드렸으나 답변이 어렵다 하시어 다시 문의드립니다.
아래 수식에는 손절 규칙이 없어 수많은 큰 변동성 장에서 나타나는 큰 금액의 손실을 예방하고자 손절을 하고 싶습니다.
아래 수식에 손절이 가능하도록 손절 틱수(예, 매수 및 매도에서 +50틱, -50틱 초과시 손절)를 지정할 수 있게 수정 부탁해요.
답변/
안녕하세요
예스스탁입니다.
문의하신 내용까지는 저희가 답변해 드리기 어렵습니다.
도움을 드리지 못해 죄송합니다.
즐거운 하루되세요
> 복둥이 님이 쓴 글입니다.
> 제목 : 문의드립니다
> 1. 아래 수식에서 추세선 꼭지점 마다 추세가 전환될 경우를 예상하여/ 추세 전환 후 첫 진입하려고 하는 첫진입 예상지수
(전고점+N틱, 혹은 전저점-N틱)를 알기 쉽게 추세 꼭지점 위,아래에 표시되게 수정 부탁합니다.
2. 현재 추세가 반대로 바뀌면 이미 진입된 매수, 매도 물량이 일괄 청산되도록 되어 있는데/
추세가 바뀔 때 바로 청산되는 것이 아니라 이미 진입된 매수 물량은 마지막 전고점+N틱에 청산되고, 매도 물량은 전저점-N틱에 청산될 수 있도록 수정 부탁해요.
감사합니다.
Input:length(12);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),TL2(0),TL3(0),Text1(0),처리구분(""),TL_Val1(0),TL_Val2(0),color(0);
var:T(0),B(0),Bx(0),S(0),Sx(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
{
T = 1;
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 TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
If 고점[3,1][1] < 고점[2,1][1] and 고점[2,1][1] > 고점[1,1][1] and 저점[2,1][1] < 저점[1,1][1] Then
TL_Delete(TL2);
}
if 고점[1,1] > 고점[2,1] or 고점[2,1] == 0 Then{
color = RED;
# buy("b");
}
TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL_SetColor(TL1,color);
Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(고점[1,1],2));
Text_SetStyle(Text1, 2, 1);
If 고점[3,1] < 고점[2,1] and 고점[2,1] > 고점[1,1] and 저점[2,1] < 저점[1,1] Then
{
sBar = Index - 저점[2,2];
eBar = Index - 저점[1,2];
}
}
}
If 처리구분 == "저점처리" Then
{
T = -1;
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 TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
If 저점[2,1][1] < 저점[1,1][1] and 저점[2,1][1] < 저점[3,1][1] and 고점[2,1][1] > 고점[1,1][1] Then
TL_Delete(TL3);
}
if 저점[1,1] < 저점[2,1] or 저점[2,1] == 0 Then{
color = blue;
# sell("s");
}
TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL_SetColor(TL1,color);
Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(저점[1,1],2));
Text_SetStyle(Text1, 2, 0);
If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] and 고점[2,1] > 고점[1,1] Then
{
sBar = Index - 고점[2,2];
eBar = Index - 고점[1,2];
}
}
}
TL_SetSize(TL1,3);
: 첫진입(),추가진입();
#상승구간의 마지막저점 저장
if Color == RED Then
{
var1 = 저점[2,1];
}
#하락구간의 마지막 고점 저장
if Color == BLUE Then
{
var2 = 고점[2,1];
}
if MarketPosition <= 0 Then
{
if color == BLUE and var1 > 0 and L > var1-PriceScale* Then
Buy("b",AtLimit,var1-PriceScale*,1);
}
if MarketPosition == 1 Then
{
value1 = Floor(MaxEntries/N)+1;
Buy("bb",AtLimit,(var1[BarsSinceEntry]-PriceScale*)-(PriceScale*)*MaxEntries,value1);
if T == -1 and 고점[1,1] > 0 Then
ExitLong("bx1",AtLimit,고점[1,1]+PriceScale*1);
if T == 1 and 고점[2,1] > 0 Then
ExitLong("bx2",AtLimit,고점[2,1]+PriceScale*1);
}
if MarketPosition >= 0 Then
{
if Color == RED and Var2 > 0 and H < var2+PriceScale* Then
Sell("s",AtLimit,Var2+PriceScale*,1);
}
if MarketPosition == -1 Then
{
value1 = Floor(MaxEntries/N)+1;
Sell("ss",AtLimit,(var2[BarsSinceEntry]+PriceScale*)+(PriceScale*)*MaxEntries,value1);
if T == 1 and 저점[1,1] > 0 Then
ExitShort("sx1",AtLimit,저점[1,1]-PriceScale*1);
if T == -1 and 저점[2,1] > 0 Then
ExitShort("sx2",AtLimit,저점[2,1]-PriceScale*1);
}
2022-04-14
1074
글번호 158021
시스템