커뮤니티
문의드립니다
2012-02-21 23:31:37
305
글번호 48030
1.엠에이시디
Input : shortPeriod(12), longPeriod(26), Period(9);
Var : value(0) , macdosc(0) ;
value = MACD(shortPeriod, longPeriod);
macdosc = value-ema(value,Period);
Plot1(value, "MACD");
Plot2(ema(value,Period), "MACDSignal");
PlotBaseLine1(0, "기준선1");
2.스톡
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);
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 Then{
if crossup(var98,var99) or crossup(var99,20) Then
buy("b",OnClose,def,2);
}
if stoK < StoD-5 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);
}
}
1번은 엠에이시디이고 2번은 지난번 작성해주신 스톡의 시스템식입니다
2번 시스템식을 참고 하고 있으나 한가지 더 추가하고 싶은것이 있어 문의드립니다
2번 시스템식을 그대로 유지하되 1번 엠에이시디가 상향 돌파한 골드상태에서는 매도신호 금지 반대로 하향 돌파하여 데드 상태에선 매수신호 금지 ... 를 추가하고 싶습니다
감사합니다
답변 1
예스스탁 예스스탁 답변
2012-02-22 10:50:19
안녕하세요
예스스탁입니다.
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 value1 == 1 Then{
if crossup(var98,var99) or crossup(var99,20) Then
buy("b",OnClose,def,2);
}
if stoK < StoD-5 and value1 == -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 님이 쓴 글입니다.
> 제목 : 문의드립니다
> 1.엠에이시디
Input : shortPeriod(12), longPeriod(26), Period(9);
Var : value(0) , macdosc(0) ;
value = MACD(shortPeriod, longPeriod);
macdosc = value-ema(value,Period);
Plot1(value, "MACD");
Plot2(ema(value,Period), "MACDSignal");
PlotBaseLine1(0, "기준선1");
2.스톡
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);
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 Then{
if crossup(var98,var99) or crossup(var99,20) Then
buy("b",OnClose,def,2);
}
if stoK < StoD-5 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);
}
}
1번은 엠에이시디이고 2번은 지난번 작성해주신 스톡의 시스템식입니다
2번 시스템식을 참고 하고 있으나 한가지 더 추가하고 싶은것이 있어 문의드립니다
2번 시스템식을 그대로 유지하되 1번 엠에이시디가 상향 돌파한 골드상태에서는 매도신호 금지 반대로 하향 돌파하여 데드 상태에선 매수신호 금지 ... 를 추가하고 싶습니다
감사합니다
다음글
이전글