예스스탁
예스스탁 답변
2021-10-21 14:43:20
안녕하세요
예스스탁입니다.
식을 수정했습니다.
input : StartTime(100000),EndTime(152000);
input : ntime(100000),n(10),익절틱수(10),최소손실틱(10),손실감소틱(10);
var : Tcond(false);
var : OO(0),HH(0),LL(0);
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;
OO = O;
HH = H;
LL = L;
}
if Tcond == true Then
{
if TotalTrades > TotalTrades[1] Then
{
OO = O;
HH = H;
LL = L;
}
if HH > 0 and H > HH Then
HH = H;
if LL > 0 and L < LL Then
LL = L;
if MarketPosition == 0 and OO > 0 and LL > OO-PriceScale*n Then
Sell("s",AtLimit,LL+PriceScale*n);
if MarketPosition == 0 and OO > 0 and HH < OO+PriceScale*n Then
Buy("b",AtLimit,HH-PriceScale*n);
if MarketPosition == 1 Then
{
if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*최소손실틱 Then
ExitLong("bx",AtLimit,Lowest(L,BarsSinceEntry)+PriceScale*손실감소틱);
}
if MarketPosition == -1 Then
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*최소손실틱 Then
ExitShort("sx",AtLimit,highest(H,BarsSinceEntry)-PriceScale*손실감소틱);
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
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
{
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
즐거운 하루되세요
> 예스요 님이 쓴 글입니다.
> 제목 : 74362 다시 문의 드립니다.~~~~
> 1, 진입조건
예를 들어
- 10시정각(변수처리) 시가에서
10틱이상 하락하지않고 10틱이상 상승시에는
저가(10시 정각 시가부터 형성된)+10틱(변수처리)에
역추세 매도진입
- 10시정각(변수처리) 틱봉 시가에서
10틱 상승하지않고 10틱이상 하락시에는
고가(10시 정각 시가부터 형성된)+10틱에(변수처리)
역추세 매수진입
2, 청산조건
-매수시
익절청산은 10틱(변수처리)
손절청산은 10틱(변수처리)이상 손실(최소손실틱)후
10틱(변수처리) 손실감소(손실감소틱)되는 지점에서
청산되는 트레일링스탑
-매도시
익절청산은 10틱(변수처리)
손절청산은 10틱(변수처리)이상 손실(최소손실틱)후
10틱(변수처리) 손실감소(손실감소틱)되는 지점에서
청산되는 트레일링스탑
3, 재진입 조건
익절 또는 손절청산되는 지점에서 역추세(스위칭) 재진입
4, 강제청산
정해진 시간(변수처리)에 보유포지션 강제청산
도와 주시면 감사 하겠습니다.
<질문> 올려 주신 수식을
시스톔 적용해보니 거래가 제대로 이루어 지지 않는데 왜 그런건가요?
1,첫진입도 의도한 지점에서 이루어 지지 않는 것 같고
2, 수식에 청산과 동시에 재진입(스위칭진입)조건은 혹시 누락되지 않았나요?
3, 트레일링 스탑도 적용이 안되는 것 같습니다.
(참고로 CME 상품에 적용해 보았습니다~~~)
항상 답변 감사합니다~``
올려주신 수식입니다.
안녕하세요
예스스탁입니다.
input : StartTime(100000),EndTime(152000);
input : ntime(100000),n(10),익절틱수(10),최소손실틱(10),손실감소틱(10);
var : Tcond(false);
var : OO(0),HH(0),LL(0);
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
{
OO = O;
HH = H;
LL = L;
}
if HH > 0 and H > HH Then
HH = H;
if LL > 0 and L < LL Then
LL = L;
if Tcond == true Then
{
if TotalTrades > TotalTrades[1] Then
{
OO = O;
HH = H;
LL = L;
}
if MarketPosition == 0 and OO > 0 and LL > OO-PriceScale*n Then
Sell("s",AtLimit,LL+PriceScale*n);
if MarketPosition == 0 and OO > 0 and HH < OO+PriceScale*n Then
Buy("b",AtLimit,HH-PriceScale*n);
if MarketPosition == 1 Then
{
if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*최소손실틱 Then
ExitLong("bx",AtLimit,Lowest(L,BarsSinceEntry)+PriceScale*손실감소틱);
}
if MarketPosition == -1 Then
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*최소손실틱 Then
ExitShort("sx",AtLimit,highest(H,BarsSinceEntry)-PriceScale*손실감소틱);
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
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
{
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
즐거운 하루되세요