예스스탁
예스스탁 답변
2024-02-20 10:44:45
안녕하세요
예스스탁입니다.
1
올려주신 수식에는 손절이나 기타 청산이 없습니다.
항상 무포지션(MarketPosition == 0)에서만 진입하며
분할익절이 모두 완료 때까지 무조건 포지션을 끌고가는 내용입니다.
그러므로 모두 수익청산만 있습니다.
수식에 손절내용을 추가해 드립니다.
평단가 대비 LossTickCount 손실이면 모두 청산합니다.
또한 지정한 진입을 스위칭이 되게 수정해 드립니다.
스위칭이 되게 하면 익절전에 반대조건 만족하면
청산하고 반대진입으로 들어가게 되므로 손실거래를 보실 수 있습니다.
스위칭을 원하시지 않으시면 기존과 같이
각 진입식에 포지션 확인내용을 MarketPosition == 0으로 변경하시면 됩니다.
2
input : TradingTime(1),StartTime(160000),EndTime(045000);
input : ProfitTickCount1(20),ProfitTickCount2(40),ProfitTickCount3(60),LossTickCount (10);
input : P1(7),P2(14),P3(21);
input : ADXP(14),value(20);
input : af(0.02),maxaf(0.2);
input : Period(50);
input : CumulativeLossTicks(100);
var : R1(0),R2(0),R3(0),AA(0),MM(0),MS(0),SS(0),EE(0), HH(0), LL(0);
var : Xcond(false),N1(0),daypl(0),CumulativeLoss(0);
R1 = RSI(P1);
R2 = RSI(P2);
R3 = RSI(P3);
AA = ADX(ADXP);
SS = sar(af,maxaf);
EE = Ema(C,Period);
if TradingTime == 1 then
condition3 = (stime>=StartTime or stime<=EndTime );
Else if TradingTime == 2 then
condition3 = (stime>=StartTime and stime<=EndTime );
Else
condition3 = true;
if TradingTime == 1 or TradingTime == 2 then
{
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Xcond = false;
N1 = NetProfit;
}
}
else
{
if Bdate != Bdate[1] Then
{
Xcond = false;
N1 = NetProfit;
}
}
CumulativeLoss = PriceScale*CumulativeLossTicks;
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] and
(IsExitName("dbl",1) == true or IsExitName("dsl",1) == true) then
Xcond = true;
If MarketPosition <= 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and
R1 > R2 and R2 > R3 and R3 >= 50 and
AA > value and
C > SS and C > EE Then
Buy("b",OnClose,Def,3);
If MarketPosition >= 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and
R1 < R2 and R2 < R3 and R3 <= 50 and
AA < value and
C < SS and C < EE Then
Sell("s",OnClose,Def,3);
if MarketPosition == 1 Then
{
ExitLong("bp1",atlimit,EntryPrice+PriceScale*ProfitTickCount1,"",1,1);
ExitLong("bp2",atlimit,EntryPrice+PriceScale*ProfitTickCount2,"",1,1);
ExitLong("bp3",atlimit,EntryPrice+PriceScale*ProfitTickCount3);
ExitLong("bl",AtStop,avgEntryPrice-PriceScale*LossTickCount);
}
if MarketPosition == -1 Then
{
ExitShort("sp1",atlimit,EntryPrice-PriceScale*ProfitTickCount1,"",1,1);
ExitShort("sp2",atlimit,EntryPrice-PriceScale*ProfitTickCount2,"",1,1);
ExitShort("sp3",atlimit,EntryPrice-PriceScale*ProfitTickCount3);
ExitShort("sl",AtStop,avgEntryPrice+PriceScale*LossTickCount);
}
즐거운 하루되세요
> 고박사122 님이 쓴 글입니다.
> 제목 : 85869 에 대한 추가 요청사항입니다.
> 안녕하세요.
수식 검토해 주셔서 감사합니다.
나스닥 시뮬레이션 챠트에서 구현해 보면 손실거래가 잡히지 않습니다. 점검 부탁드립니다.
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 수식 검토 요청드립니다.
>
안녕하세요
예스스탁입니다.
올려주신 수식 분할청산에 문제가 없습니다.
설정창에서 수량을 3으로 지정하고 적용하시면 3회 분할 익절이 됩니다.
시스템의 수량은 수식안 진입함수에 수량을 지정하지 않으면 설정청에서 지정한 수량이 적용됩니다.
수식에 진입수량을 3으로 지정해 드립니다.
진입조건에도 언급하신 내용을 추가했습니다.
input : TradingTime(1),StartTime(160000),EndTime(045000);
input : ProfitTickCount1(20),ProfitTickCount2(40),ProfitTickCount3(60),LossTickCount (10);
input : P1(7),P2(14),P3(21);
input : ADXP(14),value(20);
input : af(0.02),maxaf(0.2);
input : Period(50);
input : CumulativeLossTicks(100);
var : R1(0),R2(0),R3(0),AA(0),MM(0),MS(0),SS(0),EE(0), HH(0), LL(0);
var : Xcond(false),N1(0),daypl(0),CumulativeLoss(0);
R1 = RSI(P1);
R2 = RSI(P2);
R3 = RSI(P3);
AA = ADX(ADXP);
SS = sar(af,maxaf);
EE = Ema(C,Period);
if TradingTime == 1 then
condition3 = (stime>=StartTime or stime<=EndTime );
Else if TradingTime == 2 then
condition3 = (stime>=StartTime and stime<=EndTime );
Else
condition3 = true;
if TradingTime == 1 or TradingTime == 2 then
{
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Xcond = false;
N1 = NetProfit;
}
}
else
{
if Bdate != Bdate[1] Then
{
Xcond = false;
N1 = NetProfit;
}
}
CumulativeLoss = PriceScale*CumulativeLossTicks;
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] and
(IsExitName("dbl",1) == true or IsExitName("dsl",1) == true) then
Xcond = true;
If MarketPosition == 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and
R1 > R2 and R2 > R3 and R3 >= 50 and
AA > value and
C > SS and C > EE Then
Buy("b",OnClose,Def,3);
If MarketPosition == 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and
R1 < R2 and R2 < R3 and R3 <= 50 and
AA < value and
C < SS and C < EE Then
Sell("s",OnClose,Def,3);
if MarketPosition == 1 Then
{
ExitLong("bp1",atlimit,EntryPrice+PriceScale*ProfitTickCount1,"",1,1);
ExitLong("bp2",atlimit,EntryPrice+PriceScale*ProfitTickCount2,"",1,1);
ExitLong("bp3",atlimit,EntryPrice+PriceScale*ProfitTickCount3);
}
if MarketPosition == -1 Then
{
ExitShort("sp1",atlimit,EntryPrice-PriceScale*ProfitTickCount1,"",1,1);
ExitShort("sp2",atlimit,EntryPrice-PriceScale*ProfitTickCount2,"",1,1);
ExitShort("sp3",atlimit,EntryPrice-PriceScale*ProfitTickCount3);
}
즐거운 하루되세요