답변완료
수식 부탁 드립니다
* 매번 많은 도움에 고맙습니다.
* 아래 수식에서 계단식 상승 또는 하락시 계단에 숫자좀 부여 부탁 드립니다.
* 위선이 계단식 상승하면 1,2,3,4....n 숫자 표시좀 하는데
한계단은 최소 5개봉 경과후 크면숫자 부여 좀 부탁 드립니다.
(5개봉 보다 작으면 계단상승이 아님)
* 아래선도 동일함 적용
## 아래 수식
Input:length(20);
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 = Magenta;
# 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 = Black;
# 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 T == 1 Then
var1 = 저점[1,1];
#하락추세선의 전고점
if T == -1 Then
var2 = 고점[1,1];
* 항상 도움에 고맙습니다. 수고하십시요.
2022-05-30
1067
글번호 159399
지표
답변완료
문의드립니다.
아래수식은 피라미딩으로 5계약씩 계속 진입이 되도록 한 것인데 제가 맞게 한 것인지요?
잘못 되었으면 수정 부탁드리고요.
또 많은 수의 수량이 축적이 되므로
청산시 많은 양을 시장가로 한번에 청산하기에는 버겁습니다.
청산 신호가 나오면 분할로 나누어서 청산을 해야할 것 같은데 어떻게
하면 좋겠습니까?
수식을 부탁드립니다.
if C > A Then{
t=1;
if MarketPosition() == 0 and t==1 Then
buy("매수", OnClose,def,5 );
}
if C < B Then {
t=-1 ;
if MarketPosition() ==0 and t==-1 Then
Sell("매도",OnClose,def,5);
}
if MarketPosition == 1 Then
{
buy("bb",AtStop,LatestEntryPrice(0)+PriceScale*매수간격,5 );
if MaxEntries == 1 Then
ExitLong("매수1손절",AtStop,C-PriceScale*손절변수);
if MaxEntries >= 2 Then
ExitLong("bx",AtStop,D);
ExitLong("매수이익x",AtLimit,D+PriceScale*이익변수 );
}
if MarketPosition == -1 Then
{
Sell("ss",AtStop,LatestEntryPrice(0)-PriceScale*매도간격,5);
if MaxEntries == 1 Then
ExitShort("매도1손절",AtStop,F+PriceScale*손절변수 );
if MaxEntries >= 2 Then
ExitShort("sx",AtStop,G);
ExitShort("매도이익",AtLimit,G-PriceScale*이익변수);
}
2022-05-30
1264
글번호 159396
시스템