커뮤니티
검토 부탁드립니다.
2018-10-22 09:26:38
257
글번호 122877
1. 아래 시스템을 적용한 결과 매수진입은 정상적이나 매도진입은 분할청산이 안되는 것 같습니다. 검토 부탁드립니다.
2. 또한 당일 누적손실이 X틱 손실 시 거래가 자동멈춤되도록 요청드립니다.
(변수처리하여 최적화/수정가능하도록 부탁드립니다)
3. 만일 동일한 시스템을 여러 거래 상품에 적용하여 총 거래 상품의 총 누적손실이 X틱일때 모든 거래가 자동적으로 멈추도록 하고 싶습니다. 가능한지요?
input : 거래시간 (1), 시작시간 (160000), 끝시간 (045000),익절틱수1(6),익절틱수2(12),익절틱수3(18),손절틱수 (10);
input : P1(40), ADXP(9);
Var: value(0), HH(0), LL(0), HHH(0), LLL(0), FK(0), Condition3(false);
HHH = highest(H,P1);
LLL = lowest(L,P1);
FK = (C-LLL) / (HHH-LLL) * 100;
var1 = adx(ADXP);
if 거래시간 == 1 then
condition3 = (stime>=시작시간 or stime<=끝시간);
Else if 거래시간 == 2 then
condition3 = (stime>=시작시간 and stime<=끝시간);
Else
condition3 = true;
# 매수/매도청산
If MarketPosition == 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and var1 < 25 and crossup(FK,80) Then
{
Buy("b",OnClose,def,3);
}
# 매도/매수청산
If MarketPosition == 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and var1 < 25 and CrossDown(FK,20) Then
{
Sell("s",OnClose,def,3);
}
if MarketPosition == 1 Then{
ExitLong("bp1",atlimit,EntryPrice+PriceScale*익절틱수1,"",1,1);
ExitLong("bp2",atlimit,EntryPrice+PriceScale*익절틱수2,"",1,1);
ExitLong("bp3",atlimit,EntryPrice+PriceScale*익절틱수3);
}
if MarketPosition == 1 Then{
ExitShort("sp1",atlimit,EntryPrice-PriceScale*익절틱수1,"",1,1);
ExitShort("sp2",atlimit,EntryPrice-PriceScale*익절틱수2,"",1,1);
ExitShort("sp3",atlimit,EntryPrice-PriceScale*익절틱수3);
}
SetStopLoss(PriceScale*손절틱수,PointStop);
if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간 ) Then{
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
- 1. 123474_1.PNG (0.08 MB)
답변 1
예스스탁 예스스탁 답변
2018-10-22 15:47:35
안녕하세요
예스스탁입니다.
1.2
input : 거래시간 (1), 시작시간 (160000), 끝시간 (045000),익절틱수1(6),익절틱수2(12),익절틱수3(18),손절틱수 (10);
input : P1(40), ADXP(9),당일누적손실틱수(80);
Var: value(0), HH(0), LL(0), HHH(0), LLL(0), FK(0), Condition3(false);
var : Xcond(false),N1(0),daypl(0),당일누적손실(0);
HHH = highest(H,P1);
LLL = lowest(L,P1);
FK = (C-LLL) / (HHH-LLL) * 100;
var1 = adx(ADXP);
if 거래시간 == 1 then
condition3 = (stime>=시작시간 or stime<=끝시간);
Else if 거래시간 == 2 then
condition3 = (stime>=시작시간 and stime<=끝시간);
Else
condition3 = true;
if 거래시간 == 1 or 거래시간 == 2 then
{
if (sdate != sdate[1] and stime >= 시작시간) or
(sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then
{
Xcond = false;
N1 = NetProfit;
}
}
else
{
if Bdate != Bdate[1] Then
{
Xcond = false;
N1 = NetProfit;
}
}
당일누적손실 = PriceScale*당일누적손실틱수;
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 var1 < 25 and crossup(FK,80) Then
{
Buy("b",OnClose,def,3);
}
# 매도/매수청산
If MarketPosition == 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and var1 < 25 and CrossDown(FK,20) Then
{
Sell("s",OnClose,def,3);
}
if MarketPosition == 1 Then{
ExitLong("bp1",atlimit,EntryPrice+PriceScale*익절틱수1,"",1,1);
ExitLong("bp2",atlimit,EntryPrice+PriceScale*익절틱수2,"",1,1);
ExitLong("bp3",atlimit,EntryPrice+PriceScale*익절틱수3);
}
if MarketPosition == -1 Then{
ExitShort("sp1",atlimit,EntryPrice-PriceScale*익절틱수1,"",1,1);
ExitShort("sp2",atlimit,EntryPrice-PriceScale*익절틱수2,"",1,1);
ExitShort("sp3",atlimit,EntryPrice-PriceScale*익절틱수3);
}
SetStopLoss(PriceScale*손절틱수,PointStop);
if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간 ) Then{
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if MarketPosition == 1 then{
ExitLong("dbl",AtStop,EntryPrice-((당일누적손실+daypl)/CurrentContracts));
}
if MarketPosition == -1 then{
ExitShort("dsl",AtStop,EntryPrice+((당일누적손실+daypl)/CurrentContracts));
}
3
가능하지 않습니다.
즐거운 하루되세요
> 고박사122 님이 쓴 글입니다.
> 제목 : 검토 부탁드립니다.
> 1. 아래 시스템을 적용한 결과 매수진입은 정상적이나 매도진입은 분할청산이 안되는 것 같습니다. 검토 부탁드립니다.
2. 또한 당일 누적손실이 X틱 손실 시 거래가 자동멈춤되도록 요청드립니다.
(변수처리하여 최적화/수정가능하도록 부탁드립니다)
3. 만일 동일한 시스템을 여러 거래 상품에 적용하여 총 거래 상품의 총 누적손실이 X틱일때 모든 거래가 자동적으로 멈추도록 하고 싶습니다. 가능한지요?
input : 거래시간 (1), 시작시간 (160000), 끝시간 (045000),익절틱수1(6),익절틱수2(12),익절틱수3(18),손절틱수 (10);
input : P1(40), ADXP(9);
Var: value(0), HH(0), LL(0), HHH(0), LLL(0), FK(0), Condition3(false);
HHH = highest(H,P1);
LLL = lowest(L,P1);
FK = (C-LLL) / (HHH-LLL) * 100;
var1 = adx(ADXP);
if 거래시간 == 1 then
condition3 = (stime>=시작시간 or stime<=끝시간);
Else if 거래시간 == 2 then
condition3 = (stime>=시작시간 and stime<=끝시간);
Else
condition3 = true;
# 매수/매도청산
If MarketPosition == 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and var1 < 25 and crossup(FK,80) Then
{
Buy("b",OnClose,def,3);
}
# 매도/매수청산
If MarketPosition == 0 and TotalTrades == TotalTrades[1] and
Condition3 == true and var1 < 25 and CrossDown(FK,20) Then
{
Sell("s",OnClose,def,3);
}
if MarketPosition == 1 Then{
ExitLong("bp1",atlimit,EntryPrice+PriceScale*익절틱수1,"",1,1);
ExitLong("bp2",atlimit,EntryPrice+PriceScale*익절틱수2,"",1,1);
ExitLong("bp3",atlimit,EntryPrice+PriceScale*익절틱수3);
}
if MarketPosition == 1 Then{
ExitShort("sp1",atlimit,EntryPrice-PriceScale*익절틱수1,"",1,1);
ExitShort("sp2",atlimit,EntryPrice-PriceScale*익절틱수2,"",1,1);
ExitShort("sp3",atlimit,EntryPrice-PriceScale*익절틱수3);
}
SetStopLoss(PriceScale*손절틱수,PointStop);
if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간 ) Then{
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}