당일 시초가 갭상승인 경우는 매수만 진입
당일 시초가 갭하락인 경우는 매도만 진입
하는 수식을 추가 하고 싶은데 수정 가능할런지요??
고견 부탁드리겠습니다.
- 아래 -
Input : 당일누적수익틱수(10000),당일누적손실틱수(1000);
input : starttime(100000),endtime(114000);
input : sto1(20),sto2(12),sto3(12);
VARS: Tcond(false),N1(0),dayPl(0),당일누적수익(0),당일누적손실(0),Xcond(false),stok(0),stod(0);
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("매수청산");
if MarketPosition == -1 Then
ExitShort("매도청산");
}
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Xcond = false;
N1 = NetProfit;
Tcond = true;
}
당일누적수익 = PriceScale*당일누적수익틱수;
당일누적손실 = PriceScale*당일누적손실틱수;
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일누적수익 or daypl <= -당일누적손실 Then
Xcond = true;
if (IsExitName("매수수익",1) == true or IsExitName("매수손실",1) == true or
IsExitName("매도수익",1) == true or IsExitName("매도손실",1) == true) then
Xcond = true;
}
if MarketPosition == 1 then
{
ExitLong("매수수익",atlimit,EntryPrice+((당일누적수익-daypl)/CurrentContracts));
ExitLong("매수손실",AtStop,EntryPrice-((당일누적손실+daypl)/CurrentContracts));
}
if MarketPosition == -1 then
{
ExitShort("매도수익",atlimit,EntryPrice-((당일누적수익-daypl)/CurrentContracts));
ExitShort("매도손실",AtStop,EntryPrice+((당일누적손실+daypl)/CurrentContracts));
}
stok = StochasticsK(sto1,sto2);
stod = StochasticsD(sto1,sto2,sto3);
if Tcond == true and Xcond == false then
{
if Crossup(stok,stod) Then
Buy("매수");
if CrossDown(stok,stod) Then
Sell("매도");
}
답변 1
예스스탁
예스스탁 답변
2021-08-30 11:40:24
안녕하세요?
매수와 매도 조건에 갭상승 갭하락의 표현을 추가하면 되지 않을까 싶습니다.
if Tcond == true and Xcond == false then
{
if Crossup(stok,stod) and dayOpen > dayClose(1) Then
Buy("매수");
if CrossDown(stok,stod) and dayOpen < dayClose(1) Then
Sell("매도");
}
감사합니다.
> 승부사1 님이 쓴 글입니다.
> 제목 : 스토캐스틱 수식 수정 부탁드립니다.
> 당일 시초가 갭상승인 경우는 매수만 진입
당일 시초가 갭하락인 경우는 매도만 진입
하는 수식을 추가 하고 싶은데 수정 가능할런지요??
고견 부탁드리겠습니다.
- 아래 -
Input : 당일누적수익틱수(10000),당일누적손실틱수(1000);
input : starttime(100000),endtime(114000);
input : sto1(20),sto2(12),sto3(12);
VARS: Tcond(false),N1(0),dayPl(0),당일누적수익(0),당일누적손실(0),Xcond(false),stok(0),stod(0);
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("매수청산");
if MarketPosition == -1 Then
ExitShort("매도청산");
}
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Xcond = false;
N1 = NetProfit;
Tcond = true;
}
당일누적수익 = PriceScale*당일누적수익틱수;
당일누적손실 = PriceScale*당일누적손실틱수;
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일누적수익 or daypl <= -당일누적손실 Then
Xcond = true;
if (IsExitName("매수수익",1) == true or IsExitName("매수손실",1) == true or
IsExitName("매도수익",1) == true or IsExitName("매도손실",1) == true) then
Xcond = true;
}
if MarketPosition == 1 then
{
ExitLong("매수수익",atlimit,EntryPrice+((당일누적수익-daypl)/CurrentContracts));
ExitLong("매수손실",AtStop,EntryPrice-((당일누적손실+daypl)/CurrentContracts));
}
if MarketPosition == -1 then
{
ExitShort("매도수익",atlimit,EntryPrice-((당일누적수익-daypl)/CurrentContracts));
ExitShort("매도손실",AtStop,EntryPrice+((당일누적손실+daypl)/CurrentContracts));
}
stok = StochasticsK(sto1,sto2);
stod = StochasticsD(sto1,sto2,sto3);
if Tcond == true and Xcond == false then
{
if Crossup(stok,stod) Then
Buy("매수");
if CrossDown(stok,stod) Then
Sell("매도");
}