예스스탁
예스스탁 답변
2019-12-12 13:31:14
안녕하세요
예스스탁입니다.
Input : 당일누적수익틱수(1000),당일누적손실틱수(300),손절틱수(20);
input : starttime(101500),endtime(150000);
input : sto1(5),sto2(3),sto3(3);
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] and
(daypl >= 당일누적수익 or daypl <= -당일누적손실) 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) and stok < 50 Then
Buy("매수");
if CrossDown(stok,stod) and stok > 50 Then
Sell("매도");
}
if MarketPosition == 1 Then
sell("bs",AtStop,EntryPrice-PriceScale*손절틱수);
if MarketPosition == -1 Then
buy("sb",AtStop,EntryPrice+PriceScale*손절틱수);
즐거운 하루되세요
> 승부사1 님이 쓴 글입니다.
> 제목 : 스토캐스틱 수식 수정 부탁드립니다.
> 아래의 수식에서 추가 수식 좀 부탁드리겠습니다.
추가 1. 진입 이후 손절 (n)틱수 설정
추가 2. 손절과 동시에 스위칭
== 아 래 ==
Input : 당일누적수익틱수(1000),당일누적손실틱수(300);
input : starttime(101500),endtime(150000);
input : sto1(5),sto2(3),sto3(3);
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] and
(daypl >= 당일누적수익 or daypl <= -당일누적손실) 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) and stok < 50 Then
Buy("매수");
if CrossDown(stok,stod) and stok > 50 Then
Sell("매도");
}