예스스탁
예스스탁 답변
2022-09-13 08:58:51
안녕하세요
예스스탁입니다.
input : StartTime(83000),EndTime(65000);
Input : rsiP(9),과매수(80),과매도(20),maP(120);
var : RSIV(0),mav(0);
var : Tcond(false);
RSIV = RSI(rsiP);
mav = ma(c,mav);
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);
}
}
Condition1 = MarketPosition == 0 and MarketPosition(1) == 1 and IsExitName("StopLoss",1) == true;
Condition2 = MarketPosition == 0 and MarketPosition(1) == -1 and IsExitName("StopLoss",1) == true;
if Tcond == true Then
{
if MarketPosition >= 0 and CrossUp(RSIV,과매수) and IsExitName("sx1",1) == False and Condition2 == False Then
Sell("s");
if MarketPosition == -1 Then
{
if CountIf(CrossUp(RSIV,과매수),BarsSinceEntry) == 4 Then
ExitShort("sx1");
if CrossUp(C,mav) Then
ExitShort("sx2");
}
if MarketPosition <= 0 and CrossDown(RSIV,과매도) and IsExitName("bx1",1) == False and Condition1 == False Then
Buy();
if MarketPosition == 1 Then
{
if CountIf(CrossDown(RSIV,과매도),BarsSinceEntry) == 4 Then
ExitLong("bx1");
if CrossDown(C,mav) Then
ExitShort("bx2");
}
}
SetStopLoss(PriceScale*200,PointStop);
즐거운 하루되세요
> 하늘북 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 감사합니다.
아래수식 수정해주시면 감사하겠습니다.
아래 수식에 강제청산 200틱 손절을 포함해주시고,
강제청산후 다음 진입신호가 같은 방향이면 진입하지 않고, 3번째 진입신호부터는 같은방향도 진입가능하게 부탁드립니다.
강제청산후 다음 진입신호가 다른 방향이면 무조건 진입가능 합니다.
감사합니다....
input : StartTime(83000),EndTime(65000);
Input : rsiP(9),과매수(80),과매도(20),maP(120);
var : RSIV(0),mav(0);
var : Tcond(false);
RSIV = RSI(rsiP);
mav = ma(c,mav);
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);
}
}
if Tcond == true Then
{
if MarketPosition >= 0 and CrossUp(RSIV,과매수) and IsExitName("sx1",1) == False Then
Sell("s");
if MarketPosition == -1 Then
{
if CountIf(CrossUp(RSIV,과매수),BarsSinceEntry) == 4 Then
ExitShort("sx1");
if CrossUp(C,mav) Then
ExitShort("sx2");
}
if MarketPosition <= 0 and CrossDown(RSIV,과매도) and IsExitName("bx1",1) == False Then
Buy();
if MarketPosition == 1 Then
{
if CountIf(CrossDown(RSIV,과매도),BarsSinceEntry) == 4 Then
ExitLong("bx1");
if CrossDown(C,mav) Then
ExitShort("bx2");
}
}