커뮤니티
문의 합니다.
2014-12-10 12:00:16
108
글번호 81219
아래와 같은 수식에서
신규진입 후 만일 N 봉내에서 반대의 진입 조건이 발생하는 경우에는
청산 하도록 하는 수식을 작성하여 주십시요.
예를들어 crossup 매수진입 후 N 봉 내에서 crossdown 하는경우에는 매수청산 토록 하는 식입니다.
Input : Period(12), Period1(5),period2(5);
var : StoK(0),StoD(0);
StoK = StochasticsK(Period,Period1);
StoD = StochasticsD(Period,Period1,Period2);
if crossup(stok,stod) then
buy();
if crossdown(stok,stod) then
sell();
답변 1
예스스탁 예스스탁 답변
2014-12-10 18:12:58
안녕하세요
예스스탁입니다.
현재 작성된 식은 스위칭이 되는 식입니다.
진입후 N봉이내에 반대신호 나오면 청산하고
N봉이후에는 스위칭이 되도록 작성했습니다.
Input : Period(12), Period1(5),period2(5),N(10);
var : StoK(0),StoD(0);
StoK = StochasticsK(Period,Period1);
StoD = StochasticsD(Period,Period1,Period2);
if crossup(stok,stod) then{
if MarketPosition == 0 or
MarketPosition == -1 and BarsSinceEntry >= N Then
buy();
if MarketPosition == -1 and BarsSinceEntry < N Then
ExitShort();
}
if crossdown(stok,stod) then{
if MarketPosition == 0 or
MarketPosition == 1 and BarsSinceEntry >= N Then
sell();
if MarketPosition == 1 and BarsSinceEntry < N Then
ExitLong();
}
즐거운 하루되세요
> 너무조아 님이 쓴 글입니다.
> 제목 : 문의 합니다.
> 아래와 같은 수식에서
신규진입 후 만일 N 봉내에서 반대의 진입 조건이 발생하는 경우에는
청산 하도록 하는 수식을 작성하여 주십시요.
예를들어 crossup 매수진입 후 N 봉 내에서 crossdown 하는경우에는 매수청산 토록 하는 식입니다.
Input : Period(12), Period1(5),period2(5);
var : StoK(0),StoD(0);
StoK = StochasticsK(Period,Period1);
StoD = StochasticsD(Period,Period1,Period2);
if crossup(stok,stod) then
buy();
if crossdown(stok,stod) then
sell();
다음글
이전글