예스스탁
예스스탁 답변
2024-04-18 15:40:35
안녕하세요
예스스탁입니다.
Input :
APeriod( 5 ),
BPeriod( 20 ),
CPeriod( 120 );
input : StartTime(90000),EndTime(120000),당일진입횟수(2),당일수익틱수(100),당일손실틱수(40);
Vars :
v5( 0 ),
v20( 0 ),
v120( 0 ),
T(0),entry(0), Tcond(false),Xcond(False),N1(0),당일수익(0),당일손실(0),daypl(0);
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;
Xcond = false;
N1 = NetProfit;
entry = 0;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
당일수익 = PriceScale*당일수익틱수;
당일손실 = PriceScale*당일손실틱수;
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 or daypl <= -당일손실 Then
Xcond = true;
if (IsExitName("dbp",1) == true or IsExitName("dbl",1) == true or
IsExitName("dsp",1) == true or IsExitName("dsl",1) == true) then
Xcond = true;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
v5 = wma(C, APeriod);
v20 = wma(C, BPeriod);
v120 = wma(C, CPeriod);
if CrossUp(v20,v120) then
T = 1;
if CrossDown(v20,v120) then
T = -1;
If T == 1 and CrossUp(v5, v20) and Xcond == False Then
{
T = 2;
if entry < 당일진입횟수 Then
Buy("매수");
}
If T == -1 and CrossDown(v5, v20) and Xcond == False Then
{
T = -2;
if entry < 당일진입횟수 Then
Sell("매도");
}
if MarketPosition == 1 then
{
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
ExitLong("dbl",AtStop,EntryPrice-((당일손실+daypl)/CurrentContracts));
}
if MarketPosition == -1 then{
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
ExitShort("dsl",AtStop,EntryPrice+((당일손실+daypl)/CurrentContracts));
}
즐거운 하루되세요
> 무청 님이 쓴 글입니다.
> 제목 : Re : 수식 문의 드립니다.
> 이전에 수정 잘해주셔서 감사합니다~!
여러 거래 중에 총 손실제한을 40틱으로 제한을 두고 싶은데
부탁드립니다.
///////////////////////////////////////////
안녕하세요
예스스탁입니다.
진입횟수 초기화가 빠져있었습니다.
지정한 시작시간에 초기화되게 수정했습니다.
Input :
APeriod( 5 ),
BPeriod( 20 ),
CPeriod( 120 );
input : StartTime(90000),EndTime(120000),당일진입횟수(2),당일수익틱수(100);
Vars :
v5( 0 ),
v20( 0 ),
v120( 0 ),
T(0),entry(0), Tcond(false),Xcond(False),N1(0),당일수익(0),daypl(0);
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;
Xcond = false;
N1 = NetProfit;
entry = 0;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
당일수익 = PriceScale*당일수익틱수;
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 Then
Xcond = true;
if (IsExitName("dbp",1) == true or
IsExitName("dsp",1) == true ) then
Xcond = true;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
v5 = wma(C, APeriod);
v20 = wma(C, BPeriod);
v120 = wma(C, CPeriod);
if CrossUp(v20,v120) then
T = 1;
if CrossDown(v20,v120) then
T = -1;
If T == 1 and CrossUp(v5, v20) and Xcond == False Then
{
T = 2;
if entry < 당일진입횟수 Then
Buy("매수");
}
If T == -1 and CrossDown(v5, v20) and Xcond == False Then
{
T = -2;
if entry < 당일진입횟수 Then
Sell("매도");
}
if MarketPosition == 1 then
{
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
}
if MarketPosition == -1 then
{
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
}
즐거운 하루되세요
> 무청 님이 쓴 글입니다.
> 제목 : 수식 문의 드립니다.
> 사진 보시면 이 차트의 첫부분만 매매가 이뤄지고
다음날 9시에 진입된게 보여하는데 안떠있습니다. 어떻게 해야하나요?
//////////////////////////////////////////////////////////
안녕하세요
예스스탁입니다.
기존식에 2번 내용만 추가해 드립니다.
.
Input :
APeriod( 5 ),
BPeriod( 20 ),
CPeriod( 120 );
input : StartTime(90000),EndTime(120000),당일진입횟수(2),당일수익틱수(100);
Vars :
v5( 0 ),
v20( 0 ),
v120( 0 ),
T(0),entry(0), Tcond(false),Xcond(False),N1(0),당일수익(0),daypl(0);
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;
Xcond = false;
N1 = NetProfit;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
당일수익 = PriceScale*당일수익틱수;
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 Then
Xcond = true;
if (IsExitName("dbp",1) == true or
IsExitName("dsp",1) == true ) then
Xcond = true;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
v5 = wma(C, APeriod);
v20 = wma(C, BPeriod);
v120 = wma(C, CPeriod);
if CrossUp(v20,v120) then
T = 1;
if CrossDown(v20,v120) then
T = -1;
If T == 1 and CrossUp(v5, v20) and Xcond == False Then
{
T = 2;
if entry < 당일진입횟수 Then
Buy("매수");
}
If T == -1 and CrossDown(v5, v20) and Xcond == False Then
{
T = -2;
if entry < 당일진입횟수 Then
Sell("매도");
}
if MarketPosition == 1 then
{
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
}
if MarketPosition == -1 then
{
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
}
즐거운 하루되세요
> 무청 님이 쓴 글입니다.
> 제목 : Re : Re : 수식 문의 드립니다.
> 수식 세워주셨는데 구동이 안됩니다.
1번 질문 무시하고 2번만 해서 수식 세워주실 수 있으실까요?
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 수식 문의 드립니다.
> 안녕하세요
예스스탁입니다.
1
현재 진입은 지정시간에 지정한 횟수만큼 발생을 합니다.
다만 2번째 진입 후 반대조건이 나오면 청산을 할수 없어
진입횟수 충족후에 반대조건 나오면 청산하게 추가하고
EndTime에 포지션이 있으면 청산되게 수정해 드립니다.
2
Input :
APeriod( 5 ),
BPeriod( 20 ),
CPeriod( 120 );
input : StartTime(90000),EndTime(120000),당일진입횟수(2),당일수익틱수(100);
Vars :
v5( 0 ),
v20( 0 ),
v120( 0 ),
T(0),entry(0), Tcond(false),Xcond(False),N1(0),당일수익(0),daypl(0);
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;
Xcond = false;
N1 = NetProfit;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
당일수익 = PriceScale*당일수익틱수;
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 Then
Xcond = true;
if (IsExitName("dbp",1) == true or
IsExitName("dsp",1) == true ) then
Xcond = true;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
v5 = wma(C, APeriod);
v20 = wma(C, BPeriod);
v120 = wma(C, CPeriod);
if CrossUp(v20,v120) then
T = 1;
if CrossDown(v20,v120) then
T = -1;
If T == 1 and CrossUp(v5, v20) and Tcond == true and Xcond == False Then
{
T = 2;
if entry < 당일진입횟수 Then
Buy("매수");
Else
ExitShort("sx");
}
If T == -1 and CrossDown(v5, v20) and Tcond == true and Xcond == False Then
{
T = -2;
if entry < 당일진입횟수 Then
Sell("매도");
Else
ExitLong("bx");
}
if MarketPosition == 1 then
{
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
}
if MarketPosition == -1 then
{
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
}
즐거운 하루되세요
> 무청 님이 쓴 글입니다.
> 제목 : 수식 문의 드립니다.
> 1. 일전에 이렇게 하단 수식 문의 했었는데 당일진입횟수가 2번인데 왜 1번만 진입하는지 궁금합니다.
(항셍에서)
2. 당일 최종 목표틱수가 100틱이게 수식을 넣을 수 있을까요?
예를들어 총 100틱 수익인데 1차 -20틱 2차 120틱 해서 총 100틱 수익이 날 수 있도록이요..
감사합니다.
Input :
APeriod( 5 ),
BPeriod( 20 ),
CPeriod( 120 );
input : StartTime(90000),EndTime(120000),당일진입횟수(2);
Vars :
v5( 0 ),
v20( 0 ),
v120( 0 ),
T(0),entry(0), Tcond(false);
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
entry = 0;
}
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 MarketPosition != MarketPosition[1]) or
(MarketPosition == 0 and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
v5 = wma(C, APeriod);
v20 = wma(C, BPeriod);
v120 = wma(C, CPeriod);
if CrossUp(v20,v120) then
T = 1;
if CrossDown(v20,v120) then
T = -1;
If T == 1 and CrossUp(v5, v20) Then
{
T = 2;
if entry < 당일진입횟수 Then
Buy("매수");
}
If T == -1 and CrossDown(v5, v20) Then
{
T = -2;
if entry < 당일진입횟수 Then
Sell("매도");
}