안녕하세요.
아래와 같이 작성해주셨었는데.
if entry1 == False and (CrossUp(line1, line2) or CrossDown(line1, line2)) Then
여기서 crossup과 crossdown에 상관없이 시작시간인 213000에 무조건 진입하네요.
그리고 마지막의 청산시 entry1과 entry2를 False로 만드는 과정도 잘 안먹히는지 한번 진입/청산 후 종료가 됩니다.
해결 부탁드리겠습니다.
input : 익절틱수(100),손절틱수(50), 진입틱수(50);
input : tr_onoff(1),최소수익(50),감소수익(50);
var : line1(0),line2(0);
var : entry1(False),entry2(False);
input : StartTime(213000),EndTime(055000);
var : Tcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
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;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
line1 = (H+L)/2;
line2 = ma(C,60);
if entry1 == False and (CrossUp(line1, line2) or CrossDown(line1, line2)) Then
{
var1 = line1;
entry1= True;
}
if entry1 == True and entry2 == False and c> var1 + 진입틱수*PriceScale and Tcond == true Then
{
Buy("b");
entry2 = True;
}
if entry1 == True and entry2 == False and c < var1 - 진입틱수*PriceScale and Tcond == true Then
{
Sell("s");
entry2 = True;
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
if tr_onoff == 1 Then
SetStopTrailing(PriceScale*감소수익,PriceScale*최소수익,PointStop);
if TotalTrades > TotalTrades[1] Then
{
entry1 == False;
entry2 == False;
}
답변 1
예스스탁
예스스탁 답변
2023-04-25 08:44:01
안녕하세요
예스스탁입니다.
크로스도 지정한 시간안에 발생한것만 체크되게 수정해 드립니다.
청산시 false로 되는 부분도 수정했습니다.
input : 익절틱수(100),손절틱수(50), 진입틱수(50);
input : tr_onoff(1),최소수익(50),감소수익(50);
var : line1(0),line2(0);
var : entry1(False),entry2(False);
input : StartTime(213000),EndTime(055000);
var : Tcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
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;
entry1 = False;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
line1 = (H+L)/2;
line2 = ma(C,60);
if Tcond == true Then
{
if entry1 == False and (CrossUp(line1, line2) or CrossDown(line1, line2)) Then
{
var1 = line1;
entry1= True;
}
if entry1 == True and entry2 == False and c> var1 + 진입틱수*PriceScale Then
{
Buy("b");
entry2 = True;
}
if entry1 == True and entry2 == False and c < var1 - 진입틱수*PriceScale Then
{
Sell("s");
entry2 = True;
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
if tr_onoff == 1 Then
SetStopTrailing(PriceScale*감소수익,PriceScale*최소수익,PointStop);
if TotalTrades > TotalTrades[1] Then
{
entry1 = False;
entry2 = False;
}
즐거운 하루되세요
> 강장군 님이 쓴 글입니다.
> 제목 : 81809 재질문
> 안녕하세요.
아래와 같이 작성해주셨었는데.
if entry1 == False and (CrossUp(line1, line2) or CrossDown(line1, line2)) Then
여기서 crossup과 crossdown에 상관없이 시작시간인 213000에 무조건 진입하네요.
그리고 마지막의 청산시 entry1과 entry2를 False로 만드는 과정도 잘 안먹히는지 한번 진입/청산 후 종료가 됩니다.
해결 부탁드리겠습니다.
input : 익절틱수(100),손절틱수(50), 진입틱수(50);
input : tr_onoff(1),최소수익(50),감소수익(50);
var : line1(0),line2(0);
var : entry1(False),entry2(False);
input : StartTime(213000),EndTime(055000);
var : Tcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
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;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
line1 = (H+L)/2;
line2 = ma(C,60);
if entry1 == False and (CrossUp(line1, line2) or CrossDown(line1, line2)) Then
{
var1 = line1;
entry1= True;
}
if entry1 == True and entry2 == False and c> var1 + 진입틱수*PriceScale and Tcond == true Then
{
Buy("b");
entry2 = True;
}
if entry1 == True and entry2 == False and c < var1 - 진입틱수*PriceScale and Tcond == true Then
{
Sell("s");
entry2 = True;
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
if tr_onoff == 1 Then
SetStopTrailing(PriceScale*감소수익,PriceScale*최소수익,PointStop);
if TotalTrades > TotalTrades[1] Then
{
entry1 == False;
entry2 == False;
}