커뮤니티
Stochastic, WiliamsR 수식 수정 부탁드립니다.
2019-02-06 15:13:26
225
글번호 125899
아래의 수식에서 매수진입과 매도진입 포지션 수식만 변경 부탁드립니다.
매수 조건
1. Stochastic Fast cross Up 과 WiliamsR 20 돌파가 동시에 발생시 매수포지션
2. Stochastic Fast cross Up 발생 이후 WiliamsR 20 돌파 발생시 매수포지션
매도 조건
1. Stochastic Fast cross Down 과 WiliansR 80 이탈이 동시에 발생시 매도포지션
2. Stochastic Fast cress Down 발생 이후 WiliamsR 80 이탈 발생시 매도포지션
나머지 스위칭 조건, 당일누적틱수 관련 수식은 동일합니다. 꾸벅
- 아 래 -
Input : 당일누적수익틱수(200),당일누적손실틱수(150),P(120);
input : startdate(20181003),starttime(100000),enddate(20181031),endtime(172000);
input : sto1(25),sto2(15),sto3(15);
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
예스스탁 예스스탁 답변
2019-02-07 14:28:59
안녕하세요
예스스탁입니다.
각 진입조건식 1번은 2번에 포함되는 내용입니다.
2번 내용으로만 작성하시면 됩니다.
Input : 당일누적수익틱수(200),당일누적손실틱수(150),P(120);
input : startdate(20181003),starttime(100000),enddate(20181031),endtime(172000);
input : sto1(25),sto2(15),sto3(15);
Input : Period(14);
VARS: Tcond(false),N1(0),dayPl(0),당일누적수익(0),당일누적손실(0),Xcond(false),stok(0),stod(0);
var : WR(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);
WR = WILLR(Period);
if Tcond == true and Xcond == false then
{
if stok > stod and crossup(WR,20) Then
buy("매수");
if stok < stod and CrossDown(WR,80) 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 님이 쓴 글입니다.
> 제목 : Stochastic, WiliamsR 수식 수정 부탁드립니다.
> 아래의 수식에서 매수진입과 매도진입 포지션 수식만 변경 부탁드립니다.
매수 조건
1. Stochastic Fast cross Up 과 WiliamsR 20 돌파가 동시에 발생시 매수포지션
2. Stochastic Fast cross Up 발생 이후 WiliamsR 20 돌파 발생시 매수포지션
매도 조건
1. Stochastic Fast cross Down 과 WiliansR 80 이탈이 동시에 발생시 매도포지션
2. Stochastic Fast cress Down 발생 이후 WiliamsR 80 이탈 발생시 매도포지션
나머지 스위칭 조건, 당일누적틱수 관련 수식은 동일합니다. 꾸벅
- 아 래 -
Input : 당일누적수익틱수(200),당일누적손실틱수(150),P(120);
input : startdate(20181003),starttime(100000),enddate(20181031),endtime(172000);
input : sto1(25),sto2(15),sto3(15);
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);
다음글
이전글