예스스탁
예스스탁 답변
2023-10-24 11:09:57
안녕하세요
예스스탁입니다.
1
input : StartTime(150000),EndTime(50000);
input : 익절틱수(800),손절틱수(0);
var : Tcond(False),entry(0),count(0);
Variables: Mom(0);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
count = 0;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = False;
}
if TotalTrades > TotalTrades[1] and IsExitName("StopProfitTarget",1) == true Then
count = count+1;
if Tcond == true and count < 1 Then
{
if MarketPosition <= 0 and L ==lowest(L,2) and highest(H,2) >= lowest(L,2)+PriceScale*1 Then
{
Buy("b",AtStop,(highest(H,2)+lowest(L,2))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 8 Then
ExitLong();
if MarketPosition >= 0 and H == highest(H,2) and lowest(L,2) <= highest(H,2)+PriceScale*1 Then
{
Sell("s",AtStop,(lowest(L,2)+highest(H,2))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 8 Then
Exitshort();
if MarketPosition <= 0 and L ==lowest(L,1) and highest(H,3) >= lowest(L,2)+PriceScale*10 Then
{
Buy("b1",AtStop,(highest(H,3)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 4 Then
Exitlong();
if MarketPosition >= 0 and H == highest(H,1) and lowest(L,3) <= highest(H,2)+PriceScale*10 Then
{
Sell("s1",AtStop,(lowest(L,3)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 4 Then
Exitshort();
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
2
input : StartTime(150000),EndTime(50000),midtime(210000);
input : 익절틱수1(800),손절틱수1(0);
input : 익절틱수2(300),손절틱수2(0);
var : Tcond(False),entry(0),T(0),count(0);
Variables: Mom(0);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
count = 0;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
T = 1;
}
if (sdate != sdate[1] and stime >= midtime) or
(sdate == sdate[1] and stime >= midtime and stime[1] < midtime) Then
{
Tcond = False;
T = 2;
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = False;
T = 0;
}
if TotalTrades > TotalTrades[1] and IsExitName("StopProfitTarget",1) == true Then
count = count+1;
if Tcond == true and count < 2 Then
{
if MarketPosition <= 0 and L ==lowest(L,2) and highest(H,2) >= lowest(L,2)+PriceScale*1 Then
{
Buy("b",AtStop,(highest(H,2)+lowest(L,2))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 4 Then
ExitLong();
if MarketPosition >= 0 and H == highest(H,2) and lowest(L,2) <= highest(H,2)+PriceScale*1 Then
{
Sell("s",AtStop,(lowest(L,2)+highest(H,2))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 4 Then
ExitShort();
if MarketPosition <= 0 and L ==lowest(L,1) and highest(H,3) >= lowest(L,2)+PriceScale*10 Then
{
Buy("b1",AtStop,(highest(H,3)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 4 Then
ExitLong();
if MarketPosition >= 0 and H == highest(H,1) and lowest(L,3) <= highest(H,2)+PriceScale*10 Then
{
Sell("s1",AtStop,(lowest(L,3)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 4 Then
ExitShort();
if MarketPosition <= 0 and L ==lowest(L,1) and highest(H,3) >= lowest(L,2)+PriceScale*10 Then
{
Buy("b2",AtStop,(highest(H,3)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 4 Then
ExitLong();
if MarketPosition >= 0 and H == highest(H,1) and lowest(L,3) <= highest(H,2)+PriceScale*10 Then
{
Sell("s2",AtStop,(lowest(L,3)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 4 Then
ExitShort();
}
if T == 1 Then
{
SetStopProfittarget(PriceScale*익절틱수2,PointStop);
SetStopLoss(PriceScale*손절틱수2,PointStop);
}
Else
{
SetStopProfittarget(PriceScale*익절틱수1,PointStop);
SetStopLoss(PriceScale*손절틱수1,PointStop);
}
즐거운 하루되세요
> 푸른 님이 쓴 글입니다.
> 제목 : 문의 드립니다.
> 1.
input : StartTime(150000),EndTime(50000);
input : 익절틱수(800),손절틱수(0);
var : Tcond(False),entry(0);
Variables: Mom(0);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = False;
}
if Tcond == true Then
{
if L ==lowest(L,2) and highest(H,2) >= lowest(L,2)+PriceScale*1 Then
{
Buy("b",AtStop,(highest(H,2)+lowest(L,2))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 8 Then
ExitShort();
}
if H == highest(H,2) and lowest(L,2) <= highest(H,2)+PriceScale*1 Then
{
Sell("s",AtStop,(lowest(L,2)+highest(H,2))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 8 Then
ExitLong();
if L ==lowest(L,1) and highest(H,3) >= lowest(L,2)+PriceScale*10 Then
{
Buy("b1",AtStop,(highest(H,3)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 4 Then
ExitShort();
if H == highest(H,1) and lowest(L,3) <= highest(H,2)+PriceScale*10 Then
{
Sell("s1",AtStop,(lowest(L,3)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 4 Then
ExitLong();
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
2.
input : StartTime(150000),EndTime(50000),midtime(210000);
input : 익절틱수1(800),손절틱수1(0);
input : 익절틱수2(300),손절틱수2(0);
var : Tcond(False),entry(0),T(0);
Variables: Mom(0);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
T = 1;
}
if (sdate != sdate[1] and stime >= midtime) or
(sdate == sdate[1] and stime >= midtime and stime[1] < midtime) Then
{
Tcond = False;
T = 2;
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = False;
T = 0;
}
if Tcond == true Then
{
if L ==lowest(L,2) and highest(H,2) >= lowest(L,2)+PriceScale*1 Then
{
Buy("b",AtStop,(highest(H,2)+lowest(L,2))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 4 Then
ExitShort();
}
if H == highest(H,2) and lowest(L,2) <= highest(H,2)+PriceScale*1 Then
{
Sell("s",AtStop,(lowest(L,2)+highest(H,2))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 4 Then
ExitLong();
if L ==lowest(L,1) and highest(H,3) >= lowest(L,2)+PriceScale*10 Then
{
Buy("b1",AtStop,(highest(H,3)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 4 Then
ExitShort();
if H == highest(H,1) and lowest(L,3) <= highest(H,2)+PriceScale*10 Then
{
Sell("s1",AtStop,(lowest(L,3)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 4 Then
ExitLong();
if L ==lowest(L,1) and highest(H,3) >= lowest(L,2)+PriceScale*10 Then
{
Buy("b2",AtStop,(highest(H,3)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 4 Then
ExitShort();
if H == highest(H,1) and lowest(L,3) <= highest(H,2)+PriceScale*10 Then
{
Sell("s2",AtStop,(lowest(L,3)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 4 Then
ExitLong();
if T == 1 Then
{
SetStopProfittarget(PriceScale*익절틱수2,PointStop);
SetStopLoss(PriceScale*손절틱수2,PointStop);
}
Else
{
SetStopProfittarget(PriceScale*익절틱수1,PointStop);
SetStopLoss(PriceScale*손절틱수1,PointStop);
}
위 2가지 수식어에서
1번 한번의 익절후 매매정지
2번 두번의 익절후 매매정지가 되는 수식어를 추가로 부탁드립니다.
실제로 매매정지가 되지 않아서 재차 문의 드립니다.