커뮤니티
문의드립니다
2012-02-22 15:52:31
387
글번호 48060
23108번 문의드렸었는데 적용해 보니 아무른 신호가 나오지 않아 ...
제가 뭘 잘못 만져서 그런건지 다시 한번 검토 부탁드립니다
기존의 시스템 신호에서 엠에이시디와 반대돼는 신호만 안 나오게 해 주십사 하는 문의였는데 하나도 안 나오니 다시 한번 검토 부탁드립니다
건강하십시오
답변 1
예스스탁 예스스탁 답변
2012-02-22 16:48:06
안녕하세요
예스스탁입니다.
죄송합니다. 변수가 중복될까봐 다른 변수명으로 변경했는데
이부분때문에 신호가 발생하지 않았습니다.
아래식 사용하시면 됩니다.
Input : sPeriod(10), sPeriod1(3), sPeriod2(3);
input : 분(30),Period(10), Period1(6), Period2(6);
var : count(0), highVal(0), lowVal(0), StoFastK(0), StoK(0), StoD(0);
var : Ep(0), EP1(0), JISU(0), DINDEX(0), PreStoK(0), PreStoD(0),cnt(0);
Array : HH[20](0),LL[20](0);
Input : MACDP1(12), MACDP2(26), MACDP3(9);
Var : MACDV(0) , macds(0) ,direction(0);
MACDV = MACD(MACDP1, MACDP2);
macds = MACDV-ema(MACDV,MACDP3);
if crossup(MACDV,MACDS) Then
direction = 1;
if crossup(MACDV,MACDS) Then
direction = -1;
var1 = TimeToMinutes(stime)%분;
if dayindex == 0 or var1 < var1[1] Then{
HH[0] = H;
LL[0] = L;
for cnt = 1 to 19{
HH[cnt] = HH[cnt-1][1];
LL[cnt] = LL[cnt-1][1];
}
}
if H > HH[0] Then
HH[0] = H;
if L < LL[0] Then
LL[0] = L;
#### 특정 구간의 고가 [highest(H,Period)] ####
highVal = HH[0];
for count = 0 to Period-1 {
if HH[count] > highVal then
highVal = HH[count];
}
#### 특정 구간의 저가 [lowest(L,Period)] ####
lowVal = LL[0];
for count = 0 to Period-1 {
if LL[count] < lowVal then
lowVal = LL[count];
}
#### Fast StochasticsK ####
StoFastK = (C-lowVal)/(highVal-lowVal)*100; //Fast StochasticsK ==> (C-lowest(L,Period))/(highest(H,Period)-lowest(L,Period))*100
#### Slow StochasticsK ####
Ep = 2/(Period1+1);
if DINDEX >= Period and (date != date[1] or var1 < var1[1]) then {
DINDEX = DINDEX + 1;
PreStoK = StoK[1];
}
if DINDEX <= 1 then
StoK = StoFastK ;
else
StoK = StoFastK * EP + PreStoK * (1-EP); //Slow StochasticsK ==> ema(Fast StochasticsK, Period1)
#### Slow StochasticsD ####
Ep1 = 2/(Period2+1);
if date != date[1] or var1 < var1[1] then {
DINDEX = DINDEX + 1;
PreStoD = StoD[1];
}
if DINDEX <= 1 then
StoD = StoK ;
else
StoD = StoK * EP1 + PreStoD * (1-EP1); //Slow StochasticsD ==> ema(Slow StochasticsK, Period2)
var98 = StochasticsK(sPeriod,sPeriod1);
var99 = StochasticsD(sPeriod,sPeriod1,sPeriod2);
if StoK > Stod+5 and direction == 1 Then{
if crossup(var98,var99) or crossup(var99,20) Then
buy("b",OnClose,def,2);
}
if stoK < StoD-5 and direction == -1 Then{
if CrossDown(var98,var99) or CrossDown(var99,80) Then
sell("s",OnClose,def,2);
}
if MarketPosition == 1 Then{
if CurrentContracts == MaxContracts Then
ExitLong("bx1",AtLimit,EntryPrice+0.4);
if CurrentContracts < MaxContracts Then{
ExitLong("bx2_1",AtLimit,EntryPrice+0.8);
ExitLong("bx2_2",AtStop,EntryPrice);
}
}
if MarketPosition == -1 Then{
if CurrentContracts == MaxContracts Then
ExitShort("sx1",AtLimit,EntryPrice-0.4);
if CurrentContracts < MaxContracts Then{
ExitShort("sx2_1",AtLimit,EntryPrice-0.8);
ExitShort("sx2_2",AtStop,EntryPrice);
}
}
즐거운 하루되세요
> cjfdk 님이 쓴 글입니다.
> 제목 : 문의드립니다
> 23108번 문의드렸었는데 적용해 보니 아무른 신호가 나오지 않아 ...
제가 뭘 잘못 만져서 그런건지 다시 한번 검토 부탁드립니다
기존의 시스템 신호에서 엠에이시디와 반대돼는 신호만 안 나오게 해 주십사 하는 문의였는데 하나도 안 나오니 다시 한번 검토 부탁드립니다
건강하십시오
다음글
이전글