답변완료
추세선
Input:length(3),선굵기(1);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),처리구분(""),
TL_Val1(0),TL_Val2(0);
var : T(0),LTL1(0);
var : HTL1(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);
}
if T[1] != 1 Then{
TL_SetExtRight(LTL1,False);
TL_Delete(LTL1);
LTL1 = TL_New(sDate[index-저점[2,2]],sTime[index-저점[2,2]],저점[2,1],sDate[index-저점[1,2]],sTime[index-저점[1,2]],저점[1,1]);
//
TL_SetExtRight(LTL1,true);
}
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);
}
if T[1] != -1 then{
TL_SetExtRight(HTL1,false);
TL_Delete(HTL1);
HTL1 = TL_New(sDate[index-고점[2,2]],sTime[index-고점[2,2]],고점[2,1],sDate[index-고점[1,2]],sTime[index-고점[1,2]],고점[1,1]);
TL_SetExtRight(HTL1,true);
}
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,선굵기);
TL_SetColor(TL1,BLACK);
TL_SetColor(LTL1,green);
TL_SetColor(HTL1,red);
TL_SetSize(LTL1,선굵기);
TL_SetSize(HTL1,선굵기);
Input:blength(20);
Var:bj(0),blastHiVal(0),blasbTLoVal(0),sbBar(0),ebBar(0),bTL1(0),b처리구분(""),
bTL_Val1(0),bTL_Val2(0);
var : bT(0),LbTL1(0);
var : HbTL1(0);
Array:b고점[10,2](0),b저점[10,2](0);
b처리구분 = "";
If Highest(H,blength) == H and blastHiVal <> H and Lowest(L,blength) == L and blasbTLoVal <> L Then
{ If b저점[1,1] > L Then b처리구분 = "b저점처리";
If b고점[1,1] < H Then b처리구분 = "b고점처리";
}
Else If Highest(H,blength) == H and blastHiVal <> H Then b처리구분 = "b고점처리";
Else If Lowest(L,blength) == L and blasbTLoVal <> L Then b처리구분 = "b저점처리";
If b처리구분 == "b고점처리" Then
{
bT = 1;
blastHiVal = H;
If b고점[1,2] < b저점[1,2] Then
{
For bj = 10 DownTo 2
{
b고점[bj,1] = b고점[bj-1,1];
b고점[bj,2] = b고점[bj-1,2];
}
}
If b고점[1,2] < b저점[1,2] or b고점[1,1] < H Then
{
b고점[1,1] = H;
b고점[1,2] = Index;
sbBar = Index - b저점[1,2];
ebBar = 0;
If TL_GetBeginDate(bTL1) == sDate[sbBar] and TL_GetBeginTime(bTL1) == sTime[sbBar] Then
{
TL_Delete(bTL1);
}
if bT[1] != 1 Then{
TL_SetExtRight(LbTL1,False);
TL_Delete(LbTL1);
LbTL1 = TL_New(sDate[index-b저점[2,2]],sTime[index-b저점[2,2]],b저점[2,1],sDate[index-b저점[1,2]],sTime[index-b저점[1,2]],b저점[1,1]);
//
TL_SetExtRight(LbTL1,true);
}
If b고점[3,1] < b고점[2,1] and b고점[2,1] > b고점[1,1] and b저점[2,1] < b저점[1,1] Then
{
sbBar = Index - b저점[2,2];
ebBar = Index - b저점[1,2];
}
}
}
If b처리구분 == "b저점처리" Then
{
bT = -1;
blasbTLoVal = L;
If b저점[1,2] < b고점[1,2] Then
{
For bj = 10 DownTo 2
{
b저점[bj,1] = b저점[bj-1,1];
b저점[bj,2] = b저점[bj-1,2];
}
}
If b저점[1,2] < b고점[1,2] or b저점[1,1] > L Then
{
b저점[1,1] = L;
b저점[1,2] = Index;
sbBar = Index - b고점[1,2];
ebBar = 0;
If TL_GetBeginDate(bTL1) == sDate[sbBar] and TL_GetBeginTime(bTL1) == sTime[sbBar] Then
{
TL_Delete(bTL1);
}
if bT[1] != -1 then{
TL_SetExtRight(HbTL1,false);
TL_Delete(HbTL1);
HbTL1 = TL_New(sDate[index-b고점[2,2]],sTime[index-b고점[2,2]],b고점[2,1],sDate[index-b고점[1,2]],sTime[index-b고점[1,2]],b고점[1,1]);
TL_SetExtRight(HbTL1,true);
}
If b저점[2,1] < b저점[1,1] and b저점[2,1] < b저점[3,1] and b고점[2,1] > b고점[1,1] Then
{
sbBar = Index - b고점[2,2];
ebBar = Index - b고점[1,2];
}
}
}
TL_SetSize(bTL1,선굵기);
TL_SetColor(bTL1,BLACK);
TL_SetColor(LbTL1,darkgreen);
TL_SetColor(HbTL1,darkred);
TL_SetSize(LbTL1,선굵기);
TL_SetSize(HbTL1,선굵기);
2022-09-17
1437
글번호 162264
지표
답변완료
문의 드립니다.
1.
input : 익절틱수(150),손절틱수(30);
var : DD(0),Year(0),V1(0),V2(0),V3(0),V4(0),summer(False);
var : ST(0),ET(0),entry(0);
if NextBarSdate != sDate Then
{
DD = DayOfWeek(NextBarSdate);
Year = Floor(NextBarSdate/10000);
V1 = (10000 * Year) + (100 * 3) + 1;
V2 = 15 - dayofweek(v1);
v3 = (10000 * Year) + (100 * 11) + 1;
v4 = 8 - dayofweek(v3);
Summer = NextBarSdate > (10000 * Year) + (100 * 3) + v2
And NextBarSdate < (10000 * Year) + (100 * 11) + v4;
if summer == true Then
{
ST = 70000;
ET = 55000;
}
Else
{
ST = 80000;
ET = 65000;
}
}
if Year > 0 Then
{
IF ET > ST Then
SetStopEndofday(ET);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(ET);
}
if Bdate != Bdate[1] Then
{
entry = 0;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if ((NextBarSdate != sDate and NextBarStime >= ST) or
(NextBarSdate == sDate and NextBarStime >= ST and sTime < ST)) Then
{
IF ET <= ST Then
{
SetStopEndofday(0);
}
if NextBarOpen > C Then
{
Buy("b1",AtStop,NextBarOpen+PriceScale*1);
Sell("s1",AtStop,NextBarOpen-PriceScale*1);
}
if NextBarOpen < C Then
{
ExitLong("bx1",AtStop,NextBarOpen-PriceScale*1);
ExitShort("sx1",AtStop,NextBarOpen+PriceScale*1);
}
}
Else
{
if DayHigh < DayOpen+PriceScale*1 and DayOpen > DayClose(1) and entry < 1 Then
Buy("b2",AtStop,DayOpen+PriceScale*1);
if DayLow > DayOpen-PriceScale*1 and DayOpen > DayClose(1) and entry < 1 Then
Sell("s2",AtStop,DayOpen-PriceScale*1);
if DayOpen < DayClose(1) Then
{
if DayLow > DayOpen-PriceScale*1 Then
ExitLong("bx2",AtStop,DayOpen-PriceScale*1);
if DayHigh < DayOpen+PriceScale*1 Then
ExitShort("sx2",AtStop,DayOpen+PriceScale*1);
}
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
2.
input : 익절틱수(160),손절틱수(30);
if NextBarSdate != sDate Then
{
if NextBarOpen < C Then
{
Buy("b",AtStop,NextBarOpen+PriceScale*1);
Sell("s",AtStop,NextBarOpen-PriceScale*1);
}
if NextBarOpen > C Then
{
ExitLong("bx",AtStop,NextBarOpen-PriceScale*1);
ExitShort("sx",AtStop,NextBarOpen+PriceScale*1);
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
if MarketPosition == 1 Then
Sell("s1",AtStop,EntryPrice-2);
if MarketPosition == -1 Then
Buy("b1",AtStop,EntryPrice+2);
if MarketPosition == 1 Then
Sell("s2",AtStop,EntryPrice-4);
if MarketPosition == -1 Then
Buy("b2",AtStop,EntryPrice+4);
3.
input : 익절틱수(160),손절틱수(30);
if NextBarSdate != sDate Then
{
if NextBarOpen > C Then
{
Buy("b",AtStop,NextBarOpen+PriceScale*1);
ExitLong("bx",AtLimit, NextBarOpen+PriceScale*1+(H-L)*0.7);
}
if NextBarOpen < C Then
{
Sell("s",AtStop,NextBarOpen-PriceScale*1);
ExitShort("sx",AtLimit,NextBarOpen-PriceScale*1-(H-L)*0.7);
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
위 3가지 수식은 일봉매매 수식어입니다.
당일 익절이 장종료 5분전까지 없을때 그 5분의 싯점에
자동청산되는 수식어를 추가하고자 합니다.
2022-09-18
1430
글번호 162261
시스템