예스스탁
예스스탁 답변
2022-08-26 15:31:02
안녕하세요
예스스탁입니다.
input : position(1), P1(5),P2(20);
input : StartTime(220000),EndTime(223000),xtime(55800),vol1(1);
input : 최소수익틱수(100),수익감소틱수(10);
var : Tcond(false),entry(False);
IF xtime > starttime Then
SetStopEndofday(xtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(xtime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = False;
if MarketPosition == 0 and position == 1 and entry == true Then
Buy("b2",OnClose,Def,vol1);
if MarketPosition == 0 and position == -1 and entry == true Then
Sell("s2",OnClose,Def,vol1);
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
entry = true;
IF xtime <= starttime Then
{
SetStopEndofday(0);
}
}
var1 = ma(C,P1);
Var2 = ma(C,P2);
if Tcond == true Then
{
if MarketPosition == 0 and entry == true and position == 1 and CrossUp(var1,Var2) Then
{
entry = False;
Buy("b1",OnClose,Def,vol1);
}
if MarketPosition == 0 and entry == true and position == -1 and CrossDown(var1,Var2) Then
{
entry = False;
Sell("s1",OnClose,Def,vol1);
}
}
if MarketPosition == 1 and Highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*최소수익틱수 Then
ExitLong("매수스탑x",AtStop,Highest(H,BarsSinceEntry)-PriceScale*수익감소틱수);
if MarketPosition == -1 and lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*최소수익틱수 Then
ExitShort("매도스턉x",AtStop,lowest(L,BarsSinceEntry)+PriceScale*수익감소틱수);
즐거운 하루되세요
> 스카스카 님이 쓴 글입니다.
> 제목 : 추가수정 요청...
>
잘 작동됩니다. 감사합니다. ^^
문제가 있는데요
*정해진 체크시간에 돌파 체크하고 만약 돌파 하지 않는다면 아래 정해진 시간에 강제 진입
위 상황인데 정해진 시간 전에 종료가 되면 또 한번 진입합니다.
만약 이평선 크로스로 진입하되 강제시간 전에 수익이 난다면 추가 진입을 안했으면 좋겠습니다.
감사합니다. ^^
-----------------------------------------------------------------------------------------------------
안녕하세요
예스스탁입니다.
input : position(1), P1(5),P2(20);
input : StartTime(220000),EndTime(223000),xtime(55800),vol1(1);
input : 최소수익틱수(100),수익감소틱수(10);
var : Tcond(false);
IF xtime > starttime Then
SetStopEndofday(xtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(xtime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = False;
if MarketPosition == 0 and position == 1 Then
Buy("b2",OnClose,Def,vol1);
if MarketPosition == 0 and position == -1 Then
Sell("s2",OnClose,Def,vol1);
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
IF xtime <= starttime Then
{
SetStopEndofday(0);
}
}
var1 = ma(C,P1);
Var2 = ma(C,P2);
if Tcond == true Then
{
if MarketPosition == 0 and position == 1 and CrossUp(var1,Var2) Then
Buy("b1",OnClose,Def,vol1);
if MarketPosition == 0 and position == -1 and CrossDown(var1,Var2) Then
Sell("s1",OnClose,Def,vol1);
}
if MarketPosition == 1 and Highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*최소수익틱수 Then
ExitLong("매수스탑x",AtStop,Highest(H,BarsSinceEntry)-PriceScale*수익감소틱수);
if MarketPosition == -1 and lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*최소수익틱수 Then
ExitShort("매도스턉x",AtStop,lowest(L,BarsSinceEntry)+PriceScale*수익감소틱수);
즐거운 하루되세요
> 스카스카 님이 쓴 글입니다.
> 제목 : 수정 요청드립니다. ^^ 감사합니다~
> 아래 수식을 사용하고 있습니다.
추가 내용을 요청드립니다. ^^ 감사합니다.
-----------------------------------------------------------------------------------------------------
포지션에 따라 (1 or -1) 매수/매도 진입을 하는데
이동평균선 돌파 후 진입 기능 (5일선 / 20일선)
*단 정해진 체크시간에 돌파 체크하고 만약 돌파 하지 않는다면 아래 정해진 시간에 강제 진입
[예시]
1. 매수의 경우 22시 부터 22시 30분까지 이동평균선 (5일선 20일선) 5일선이 20일선을 크로스하면 매수진입...
만약 크로스 안하면 22시 30분 강제 진입
매도의 경우 반대
** 5일선 10일선은 마음대로 (일수)수정이 가능했으면 좋겠습니다.
** 이동평균선 진입 시간도 수정이 가능하면 좋겠습니다.
요청 드립니다~ ^^
--------------------------------------------------------------------------------------------------------
input : position1(1),ntime1(223000),vol1(1);
input : xtime(55800);
input : 최소수익틱수(100),수익감소틱수(10);
var : ST(0);
if Bdate != Bdate[1] Then
{
ST = sTime;
}
if ST > 0 then
{
if (sdate != sdate[1] and stime >= ntime1) or
(sdate == sdate[1] and stime >= ntime1 and stime[1] < ntime1) Then
{
if position1 == 1 Then
Buy("매수-1",OnClose,DEf,vol1);
if position1 == -1 Then
Sell("매도-1",OnClose,DEf,vol1);
}
if MarketPosition == 1 and Highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*최소수익틱수 Then
ExitLong("매수스탑x",AtStop,Highest(H,BarsSinceEntry)-PriceScale*수익감소틱수);
if MarketPosition == -1 and lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*최소수익틱수 Then
ExitShort("매도스턉x",AtStop,lowest(L,BarsSinceEntry)+PriceScale*수익감소틱수);
}
IF Xtime > ST Then
SetStopEndofday(Xtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Xtime);
}
if (sdate != sdate[1] and stime >= ST) or
(sdate == sdate[1] and stime >= ST and stime[1] < ST) Then
{
IF Xtime <= ST Then
{
SetStopEndofday(0);
}
}