커뮤니티
문의드립니다
2019-06-07 20:41:18
315
글번호 129270
아래 수식에서
단순이면 지수로
지수면 단순으로 변경 가능하면 부탁드리겠습니다
Input : P1(14),p2(5),P3(10),p4(5);
input : Period1(14),Period2(10) ,Period3(20),Period4(10);
input : 익절틱수(20),손절틱수(40);
input : starttime(101600),endtime(173000);
var : Tcond(false);
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
}
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("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
var1 = StochasticsK(P1,P2);
var2 = StochasticsK(P3,P4);
var3 = StochasticsK(Period1,Period2);
var4 = StochasticsK(Period3,Period4);
if Tcond == true then
{
if crossup(var1,var3) and var1 < 20 and var3 < 20 Then
buy("매수");
if CrossDown(var2,var4) and var2 > 80 and var4 > 80 Then
sell("매도");
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
답변 1
예스스탁 예스스탁 답변
2019-06-10 08:46:25
안녕하세요
예스스탁입니다.
기본으로 제공되는 스토케스틱 함수는 지수이평을 기준으로 계산 됩니다.
단순이평 기준으로 변경하면 아래와 같습니다.
Input : P1(14),p2(5),P3(10),p4(5);
input : Period1(14),Period2(10) ,Period3(20),Period4(10);
input : 익절틱수(20),손절틱수(40);
input : starttime(101600),endtime(173000);
var : Tcond(false),fk1(0),fk2(0);
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
}
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("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
fk1 = FastK(p1);
var1 = ma(fk1,P2);
var2 = ma(var1,P2);
fk2 = FastK(period1);
var3 = ma(fk2,Period2);
var4 = ma(var3,Period2);
if Tcond == true then
{
if crossup(var1,var3) and var1 < 20 and var3 < 20 Then
buy("매수");
if CrossDown(var2,var4) and var2 > 80 and var4 > 80 Then
sell("매도");
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
즐거운 하루되세요
> 해피슈 님이 쓴 글입니다.
> 제목 : 문의드립니다
> 아래 수식에서
단순이면 지수로
지수면 단순으로 변경 가능하면 부탁드리겠습니다
Input : P1(14),p2(5),P3(10),p4(5);
input : Period1(14),Period2(10) ,Period3(20),Period4(10);
input : 익절틱수(20),손절틱수(40);
input : starttime(101600),endtime(173000);
var : Tcond(false);
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
}
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("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
var1 = StochasticsK(P1,P2);
var2 = StochasticsK(P3,P4);
var3 = StochasticsK(Period1,Period2);
var4 = StochasticsK(Period3,Period4);
if Tcond == true then
{
if crossup(var1,var3) and var1 < 20 and var3 < 20 Then
buy("매수");
if CrossDown(var2,var4) and var2 > 80 and var4 > 80 Then
sell("매도");
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);