커뮤니티
수식 수정 부탁드립니다.
2018-12-05 07:19:16
180
글번호 124156
아래의 수식은 스토캐스틱을 기준으로 설정되어 있는데요.
스토캐스틱 대신에 일목균형표 기준선을 기준값으로 설정하고 싶습니다.
기준선 상향돌파시 매수포지션
기준선 하향이탈시 매도포지션 (스위칭)
부탁드리겠습니다.
- 아 래 -
Input : 당일누적수익틱수(200),당일누적손실틱수(200),P(120);
input : startdate(20181003),starttime(100000),enddate(20181031),endtime(172000);
input : sto1(10),sto2(6),sto3(6);
VARS: Tcond(false),N1(0),dayPl(0),당일누적수익(0),당일누적손실(0),Xcond(false),stok(0),stod(0);
if (sdate == enddate and sdate != sdate[1] and stime >= endtime) or
(sdate == enddate and 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 >= startdate and sdate != sdate[1] and stime >= starttime) or
(sdate >= startdate and 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;
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("매도");
}
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));
}
if sdate != sdate[1] Then
SetStopEndofday(172000);
if bdate != bdate[1] Then
SetStopEndofday(0);
답변 1
예스스탁 예스스탁 답변
2018-12-05 13:27:51
안녕하세요
예스스탁입니다.
Input : 당일누적수익틱수(200),당일누적손실틱수(200),P(120);
input : startdate(20181003),starttime(100000),enddate(20181031),endtime(172000);
VARS: Tcond(false),N1(0),dayPl(0),당일누적수익(0),당일누적손실(0),Xcond(false),기준선(0);
if (sdate == enddate and sdate != sdate[1] and stime >= endtime) or
(sdate == enddate and 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 >= startdate and sdate != sdate[1] and stime >= starttime) or
(sdate >= startdate and 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;
기준선 = (highest(H,26)+lowest(L,26))/2;
if Tcond == true and Xcond == false then
{
if crossup(c,기준선) Then
buy("매수");
if CrossDown(c,기준선) Then
sell("매도");
}
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));
}
if sdate != sdate[1] Then
SetStopEndofday(172000);
if bdate != bdate[1] Then
SetStopEndofday(0);
즐거운 하루되세요
> 승부사1 님이 쓴 글입니다.
> 제목 : 수식 수정 부탁드립니다.
> 아래의 수식은 스토캐스틱을 기준으로 설정되어 있는데요.
스토캐스틱 대신에 일목균형표 기준선을 기준값으로 설정하고 싶습니다.
기준선 상향돌파시 매수포지션
기준선 하향이탈시 매도포지션 (스위칭)
부탁드리겠습니다.
- 아 래 -
Input : 당일누적수익틱수(200),당일누적손실틱수(200),P(120);
input : startdate(20181003),starttime(100000),enddate(20181031),endtime(172000);
input : sto1(10),sto2(6),sto3(6);
VARS: Tcond(false),N1(0),dayPl(0),당일누적수익(0),당일누적손실(0),Xcond(false),stok(0),stod(0);
if (sdate == enddate and sdate != sdate[1] and stime >= endtime) or
(sdate == enddate and 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 >= startdate and sdate != sdate[1] and stime >= starttime) or
(sdate >= startdate and 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;
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("매도");
}
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));
}
if sdate != sdate[1] Then
SetStopEndofday(172000);
if bdate != bdate[1] Then
SetStopEndofday(0);