input : StartTime(213000),EndTime(55000);
input : 익절틱수(400),손절틱수(0);
var : Tcond(False);
var : entry(0);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
entry = 0;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if Tcond == true Then
{
if MarketPosition <= 0 and entry < 1 Then
buy("b",atlimit,dayhigh-PriceScale*400);
if MarketPosition == 1 Then
exitlong("bx",atlimit,lowest(L,BarsSinceEntry)+PriceScale*400);
if MarketPosition >= 0 and entry < 1 Then
sell("s",atlimit,daylow+PriceScale*700);
if MarketPosition == -1 Then
ExitShort("sx",atlimit,Highest(H,BarsSinceEntry)-PriceScale*300);
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
위 수식의 청산은 주문싯점이 아닌 저점대비 올라온 폭의 청산입니다.
예를들어서 -100틱 매수후 +100틱 청산일때 -100틱에 매수가 되었으나
저점이 더 내려가서 반등시 그 저점에서 +100틱에 청산이 되는 경우 입니다.
주문싯점에서 +100틱에 청산 되는 수식어로 변경되었으면 합니다.
미리 감사드립니다.
답변 1
예스스탁
예스스탁 답변
2024-04-09 15:29:42
안녕하세요
예스스탁입니다.
올려주신 내용이면 진입가 대비 100틱 수익이면 청산입니다.
해당 내용이시면 이미 익절틱수로 수익청산하는 내용이 있으므로
기존 bx,sx청산은 삭제하고 익절청산만 있으면 됩니다.
input : StartTime(213000),EndTime(55000);
input : 익절틱수(400),손절틱수(0);
var : Tcond(False);
var : entry(0);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
entry = 0;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if Tcond == true Then
{
if MarketPosition <= 0 and entry < 1 Then
buy("b",atlimit,dayhigh-PriceScale*400);
if MarketPosition >= 0 and entry < 1 Then
sell("s",atlimit,daylow+PriceScale*700);
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
즐거운 하루되세요
> 푸른 님이 쓴 글입니다.
> 제목 : 문의 드립니다
> input : StartTime(213000),EndTime(55000);
input : 익절틱수(400),손절틱수(0);
var : Tcond(False);
var : entry(0);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
entry = 0;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if Tcond == true Then
{
if MarketPosition <= 0 and entry < 1 Then
buy("b",atlimit,dayhigh-PriceScale*400);
if MarketPosition == 1 Then
exitlong("bx",atlimit,lowest(L,BarsSinceEntry)+PriceScale*400);
if MarketPosition >= 0 and entry < 1 Then
sell("s",atlimit,daylow+PriceScale*700);
if MarketPosition == -1 Then
ExitShort("sx",atlimit,Highest(H,BarsSinceEntry)-PriceScale*300);
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
위 수식의 청산은 주문싯점이 아닌 저점대비 올라온 폭의 청산입니다.
예를들어서 -100틱 매수후 +100틱 청산일때 -100틱에 매수가 되었으나
저점이 더 내려가서 반등시 그 저점에서 +100틱에 청산이 되는 경우 입니다.
주문싯점에서 +100틱에 청산 되는 수식어로 변경되었으면 합니다.
미리 감사드립니다.