input : StartTime(140000),EndTime(60000);
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);
}
}
Inputs: VtyPercent(0.05),ATRperiod(5);
If MarketPosition() <> 1 Then
Buy ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod)));
If MarketPosition() <> -1 Then
Sell ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod)));
If MarketPosition() == 1 Then
Buy ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod)));
If MarketPosition() == -1 Then
Sell ("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod)));
위 수식어에서 10분선 위에선 Buy진입후 청산 10분선 아래에선 Sell진입후 청산으로
수식어를 변경하고자 합니다.
미리 감사드립니다.
답변 1
예스스탁
예스스탁 답변
2022-12-14 10:58:15
안녕하세요
예스스탁입니다.
현재수식에서 buy나 sell진입에 atstop타입이 사용되어 봉미완성시에 발생합니다.
봉완성시 값을 셋팅하고 다음봉 미완성시에 셋팅된 가격과 현재가를 비교해서 가격조건 충족하면
즉시 신호가 발생하는 구조입니다.
추가하는 내용은 if문으로 조건을 지정해야 하는데 if문이 봉완성시가 기준입니다.
봉미완성시에 특정조건만족 여부는 체크를 하지 못합니다.
언급하신 조건을 추가한다면 아래와 정도로만 작성이 가능합니다.
봉완성시 종가가 이평보다 클때만 가격이 셋팅되고 다음봉에서 매수신호가 발생할수 있고
봉완성시 종가가 이평보다 작을때만 가격이 셋팅되고 다음봉에서 매도신호가 발생할수 있습니다.
input : StartTime(140000),EndTime(60000);
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);
}
}
Inputs: VtyPercent(0.05),ATRperiod(5),P(10);
var : mav(0);
mav = ma(C,10);
If MarketPosition() <> 1 and C > mav Then
Buy ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod)));
If MarketPosition() <> -1 and c < mav Then
Sell ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod)));
If MarketPosition() == 1 and C > mav Then
Buy ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod)));
If MarketPosition() == -1 and C < mav Then
Sell ("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod)));
즐거운 하루되세요
> 푸른 님이 쓴 글입니다.
> 제목 : 문의 드립니다.
>
input : StartTime(140000),EndTime(60000);
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);
}
}
Inputs: VtyPercent(0.05),ATRperiod(5);
If MarketPosition() <> 1 Then
Buy ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod)));
If MarketPosition() <> -1 Then
Sell ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod)));
If MarketPosition() == 1 Then
Buy ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod)));
If MarketPosition() == -1 Then
Sell ("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod)));
위 수식어에서 10분선 위에선 Buy진입후 청산 10분선 아래에선 Sell진입후 청산으로
수식어를 변경하고자 합니다.
미리 감사드립니다.