친절한 도움에 감사드립니다.
수식에 IF Endtime > starttime Then
이 부분에 에러가 난다고 합니다.
다른 부분도 혹시 잘못된 부분 있으면 수정 부탁드립니다.
감사합니다.
input : n1(n),n(n);
input : StartTime(231000),EndTime(053000);
input : 익절틱수1(80),익절틱수2(100),손절틱수(50), 익절횟수(1);
input : mm(50),m1(10);
var : Tcond(false), T(0), Profit(0);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (NextBarSdate != sdate and NextBarStime >= EndTime) or
(NextBarSdate == sdate and NextBarStime >= EndTime and stime < EndTime) Then
Tcond = False;
if (NextBarSdate != sdate and NextBarStime >= StartTime) or
(NextBarSdate == sdate and NextBarStime >= StartTime and stime < StartTime) Then
{
T = 0;
Tcond = true;
Profit = 0;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if TotalTrades > TotalTrades[1] and IsExitName("StopProfitTarget",1) == true Then
Profit = profit+1;
if Tcond == true Then
{
if MarketPosition <= 0 and NextBarOpen <= Highest(H,n1) and Profit < 익절횟수 Then
Buy("b1",AtStop,Highest(H,n1)+PriceScale*1);
if MarketPosition >= 0 and NextBarOpen >= Lowest(L,N1) and Profit < 익절횟수 Then
Sell("s1",AtStop,Lowest(L,N1)-PriceScale*1);
}
SetStopLoss(PriceScale*손절틱수,PointStop);
if MarketPosition == 1 Then
{
ExitLong("Bp1",AtLimit,EntryPrice+PriceScale*익절틱수1,"",max(1,Floor(MaxContracts/2)),1);
ExitLong("Bp2",AtLimit,EntryPrice+PriceScale*익절틱수2);
if Highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*mm Then
ExitLong("btr",AtStop,EntryPrice+PriceScale*m1);
}
if MarketPosition == -1 Then
{
ExitShort("sp1",AtLimit,EntryPrice-PriceScale*익절틱수1,"",max(1,Floor(MaxContracts/2)),1);
ExitShort("sp2",AtLimit,EntryPrice-PriceScale*익절틱수2);
if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*mm Then
ExitShort("str",AtStop,EntryPrice-PriceScale*m1);
}
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);
}
}
답변 1
예스스탁
예스스탁 답변
2021-11-25 16:26:22
안녕하세요
예스스탁입니다.
IF Endtime > starttime Then
위 부분에 에러는 없습니다.
올리신 수식을 검증하면 수식의 제일 상단에 아래 부분 때문에 에러가 납니다.
외부변수의 기초값을 n으로 지정되어 있습니다.
input : n1(n),n(n);
수식을 문의하실때 값을 숨기시기 위해서 n으로 지정하신 부분입니다.
n1과 n변수의 초기값을 기존문의하시기 전에 지정한 숫자로 변경하시면 됩니다.
즐거운 하루되세요
> jesten77 님이 쓴 글입니다.
> 제목 : 문의 드립니다.
> 친절한 도움에 감사드립니다.
수식에 IF Endtime > starttime Then
이 부분에 에러가 난다고 합니다.
다른 부분도 혹시 잘못된 부분 있으면 수정 부탁드립니다.
감사합니다.
input : n1(n),n(n);
input : StartTime(231000),EndTime(053000);
input : 익절틱수1(80),익절틱수2(100),손절틱수(50), 익절횟수(1);
input : mm(50),m1(10);
var : Tcond(false), T(0), Profit(0);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (NextBarSdate != sdate and NextBarStime >= EndTime) or
(NextBarSdate == sdate and NextBarStime >= EndTime and stime < EndTime) Then
Tcond = False;
if (NextBarSdate != sdate and NextBarStime >= StartTime) or
(NextBarSdate == sdate and NextBarStime >= StartTime and stime < StartTime) Then
{
T = 0;
Tcond = true;
Profit = 0;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if TotalTrades > TotalTrades[1] and IsExitName("StopProfitTarget",1) == true Then
Profit = profit+1;
if Tcond == true Then
{
if MarketPosition <= 0 and NextBarOpen <= Highest(H,n1) and Profit < 익절횟수 Then
Buy("b1",AtStop,Highest(H,n1)+PriceScale*1);
if MarketPosition >= 0 and NextBarOpen >= Lowest(L,N1) and Profit < 익절횟수 Then
Sell("s1",AtStop,Lowest(L,N1)-PriceScale*1);
}
SetStopLoss(PriceScale*손절틱수,PointStop);
if MarketPosition == 1 Then
{
ExitLong("Bp1",AtLimit,EntryPrice+PriceScale*익절틱수1,"",max(1,Floor(MaxContracts/2)),1);
ExitLong("Bp2",AtLimit,EntryPrice+PriceScale*익절틱수2);
if Highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*mm Then
ExitLong("btr",AtStop,EntryPrice+PriceScale*m1);
}
if MarketPosition == -1 Then
{
ExitShort("sp1",AtLimit,EntryPrice-PriceScale*익절틱수1,"",max(1,Floor(MaxContracts/2)),1);
ExitShort("sp2",AtLimit,EntryPrice-PriceScale*익절틱수2);
if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*mm Then
ExitShort("str",AtStop,EntryPrice-PriceScale*m1);
}
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);
}
}