예스스탁
예스스탁 답변
2021-02-08 13:03:51
안녕하세요
예스스탁입니다.
지정한 시간이내이면 Tcond가 true이고 아니면 false인데
진입/청산식에 Tcond == true 라는 조건이 없습니다.
Input : short(12), long(26), signal(9),봉수(32),익절1(50),익절2(100),손절(50);
input : StartTime(105000),EndTime(153000);
Var : MACDV(0) , MACDS(0),t(0);
var : Tcond(false);
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;
MACDV = MACD(short, long);
MACDS = ema(MACDV,signal);
if CrossUp(macdv,macds) Then
{
t = 1;
var1 = C;
Var2 = O;
Var3 = Index;
}
if CrossDown(macdv,macds) Then
{
t = -1;
var1 = C;
Var2 = O;
Var3 = Index;
}
if t == 1 and Index > Var3 and C > Var1 and C > O Then
{
t = 2;
Var3 = Index;
}
if t == 2 and Index > Var3 and Index <= Var3+20 and
CrossUp(c,var2) and C > O Then
{
t = 3;
if MarketPosition == 0 and Tcond == true Then
Buy();
}
if t == -1 and Index > Var3 and C < Var1 and C < O Then
{
t = -2;
Var3 = Index;
}
if t == -2 and Index > Var3 and Index <= Var3+20 and
CrossDown(c,var2) and C < O Then
{
t = -3;
if MarketPosition == 0 and Tcond == true Then
Sell();
}
if MarketPosition == 1 and Tcond == true Then
{
if BarsSinceEntry >= 봉수 Then
exitlong("bp1",AtLimit,EntryPrice+PriceScale*익절1);
Else
exitlong("bp2",AtLimit,EntryPrice+PriceScale*익절2);
exitlong("bl",AtStop,EntryPrice-PriceScale*손절);
}
if MarketPosition == -1 and Tcond == true Then
{
if BarsSinceEntry >= 봉수 Then
ExitShort("sp1",AtLimit,EntryPrice-PriceScale*익절1);
Else
ExitShort("sp2",AtLimit,EntryPrice-PriceScale*익절2);
ExitShort("sl",AtStop,EntryPrice+PriceScale*손절);
}
즐거운 하루되세요
> 저은아빠 님이 쓴 글입니다.
> 제목 : 수식문의
> 수고하십니다.
아래 수식은 신규진입 매매시간(10시50분~15시30분)을 정해 놓았습니다만
아무때나 진입이 됩니다.
뭐가 잘못 문제일까요?
if Tcond == true 가 빠져서 일까요?
Input : short(12), long(26), signal(9),봉수(32),익절1(50),익절2(100),손절(50);
input : StartTime(105000),EndTime(153000);
Var : MACDV(0) , MACDS(0),t(0);
var : Tcond(false);
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;
MACDV = MACD(short, long);
MACDS = ema(MACDV,signal);
if CrossUp(macdv,macds) Then
{
t = 1;
var1 = C;
Var2 = O;
Var3 = Index;
}
if CrossDown(macdv,macds) Then
{
t = -1;
var1 = C;
Var2 = O;
Var3 = Index;
}
if t == 1 and Index > Var3 and C > Var1 and C > O Then
{
t = 2;
Var3 = Index;
}
if t == 2 and Index > Var3 and Index <= Var3+20 and
CrossUp(c,var2) and C > O Then
{
t = 3;
if MarketPosition == 0 Then
Buy();
}
if t == -1 and Index > Var3 and C < Var1 and C < O Then
{
t = -2;
Var3 = Index;
}
if t == -2 and Index > Var3 and Index <= Var3+20 and
CrossDown(c,var2) and C < O Then
{
t = -3;
if MarketPosition == 0 Then
Sell();
}
if MarketPosition == 1 Then
{
if BarsSinceEntry >= 봉수 Then
exitlong("bp1",AtLimit,EntryPrice+PriceScale*익절1);
Else
exitlong("bp2",AtLimit,EntryPrice+PriceScale*익절2);
exitlong("bl",AtStop,EntryPrice-PriceScale*손절);
}
if MarketPosition == -1 Then
{
if BarsSinceEntry >= 봉수 Then
ExitShort("sp1",AtLimit,EntryPrice-PriceScale*익절1);
Else
ExitShort("sp2",AtLimit,EntryPrice-PriceScale*익절2);
ExitShort("sl",AtStop,EntryPrice+PriceScale*손절);
}