답변완료
문의
항상감사합니다
1수식을 넣으면 챠트상신호도 나오고
거래내역도 나옵니다
2수식은 1수식을 구체화 한 수식입니다
오늘 해외챠트적용시
신호도 거래내용도 나오지않습니다
차이점이나 수정내용 부탁드립니다.
1수식]
Input : Length(20), D1(2);
# 매수/매도청산
If CrossUP(H,BollBandUp(20, 2)) then
Buy();
# 매도/매수청산
If CrossDown(L,BollBandDown(20, 2)) then
Sell();
2수식]input : StartTime(101800),EndTime(114000);
input : Length(20), D1(2);
input : 익절1(30),손절1(30),청산구분시간(103000),익절2(50),손절2(30),익절연속횟수(3),손절연속횟수(3);
var : Tcond(false),profit(0),loss(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;
profit = 0;
loss = 0;
}
if TotalTrades > TotalTrades[1] Then
{
if IsExitName("bp.",1) or IsExitName("bp1",1) or IsExitName("bp2",21) or
IsExitName("sp.",1) or IsExitName("sp1",1) or IsExitName("sp2",1) Then
profit = profit+1;
Else
profit = 0;
if IsExitName("bl.",1) or IsExitName("bl1",1) or IsExitName("bl2",1) or
IsExitName("sl.",1) or IsExitName("sl1",1) or IsExitName("sl2",1) Then
loss = loss+1;
Else
loss = 0;
}
var1 = BollBandUp(Length,D1);
var2 = BollBandDown(Length,D1);
if Tcond == true Then
{
If CrossUP(H,var1) and c > o and profit < 익절연속횟수 and loss < 손절연속횟수 then
{
Buy("b",OnClose,DEF,1);
ExitLong("bp.",AtLimit,C+PriceScale*익절1,"",1,1);
ExitLong("bl.",AtStop,C-PriceScale*손절1,"",1,1);
}
If CrossDown(L,Var2) and C < O and profit < 익절연속횟수 and loss < 손절연속횟수 then
{
Sell("s",OnClose,DEF,1);
ExitShort("sp.",AtLimit,C-PriceScale*익절1,"",1,1);
ExitShort("sl.",AtStop,C+PriceScale*손절1,"",1,1);
}
}
if MarketPosition == 1 Then
{
if sTime >= StartTime and sTime < 청산구분시간 Then
{
ExitLong("bp1",AtLimit,EntryPrice+PriceScale*익절1,"",1,1);
ExitLong("bl1",AtStop,EntryPrice-PriceScale*손절1,"",1,1);
}
if sTime >= 청산구분시간 and sTime < Endtime Then
{
ExitLong("bp2",AtLimit,EntryPrice+PriceScale*익절2,"",1,1);
ExitLong("bl2",AtStop,EntryPrice-PriceScale*손절2,"",1,1);
}
}
if MarketPosition == -1 Then
{
if sTime >= StartTime and sTime < 103000 Then
{
ExitShort("sp1",AtLimit,EntryPrice-PriceScale*익절1,"",1,1);
ExitShort("sl1",AtStop,EntryPrice+PriceScale*손절1,"",1,1);
}
if sTime >= 103000 and sTime < Endtime Then
{
ExitShort("sp2",AtLimit,EntryPrice-PriceScale*익절2,"",1,1);
ExitShort("sl2",AtStop,EntryPrice+PriceScale*손절2,"",1,1);
}
}
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);
}
}
2021-10-11
701
글번호 152791
시스템