커뮤니티
문의드립니다.
2012-01-19 16:00:42
299
글번호 46823
항상 노고가 많으십니다.
아래식에서 DATA3, DATA4를 삽입해서 진입금지식을 만들고 싶습니다.
둘다 참조식에서 골든크로스면 매도금지, 데드크로스면 매수금지.
둘다 기준은 30일선과 5일선입니다.
감사합니다.
Input : shortPeriod(5), longPeriod(20), period(36),ADXP(14);
var : cnt(0),count(0),d2adx(0,data2),cond(false,data2);
var : val1(0,data1),val2(0,data1),val3(0,data1),cond1(false,data1),cond2(false,data1);
d2adx = data2(ADX(ADXP));
val1 = ema(C, shortPeriod);
val2 = ema(C, longPeriod);
val3= ema(C, Period);
if data2(date != date[1]) then
cond = false;
if d2adx >= 40 Then
cond = true;
count = 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
cond1 = count == 0 or
(count >= 1 and MarketPosition == -1) or
(count >= 1 and MarketPosition == 0 and
(IsExitName("ssx",1) == true or IsExitName("sPt1",1) == true or IsExitName("bx",1) == true or IsExitName("sx",1) == true));
cond2 = count == 0 or
(count >= 1 and MarketPosition == 1) or
(count >= 1 and MarketPosition == 0 and
(IsExitName("bbx",1) == true or IsExitName("bPt1",1) == true or IsExitName("bx",1) == true or IsExitName("sx",1) == true));
if cond1 == true and val1 > val2 and val3 > val3[1] Then
buy("b");
if cond2 == true and val1 < val2 and val3 < val3[1] Then
sell("s");
if MarketPosition == 1 and val3 < val3[1] and cond == false Then
ExitLong("bx");
if MarketPosition == 1 and val2 < val2[1] and cond == true Then
ExitLong("bbx");
if MarketPosition == -1 and val3 > val3[1] and cond == false Then
ExitShort("sx");
if MarketPosition == -1 and val2 > val2[1] and cond == true Then
ExitShort("ssx");
if MarketPosition !=0 Then{
ExitLong("bPT1",atLimit,EntryPrice+1);#진입가+1포인트 매수청산
ExitShort("SPT1",AtLimit,EntryPrice-1);#진입가-1포인트 매도청산
}
답변 1
예스스탁 예스스탁 답변
2012-01-19 16:33:55
안녕하세요
예스스탁입니다.
Input : shortPeriod(5), longPeriod(20), period(36),ADXP(14);
var : cnt(0),count(0),d2adx(0,data2),cond(false,data2),d3cross(0,data3),d4cross(0,data4);
var : val1(0,data1),val2(0,data1),val3(0,data1),cond1(false,data1),cond2(false,data1);
d2adx = data2(ADX(ADXP));
val1 = ema(C, shortPeriod);
val2 = ema(C, longPeriod);
val3= ema(C, Period);
if data2(date != date[1]) then
cond = false;
if d2adx >= 40 Then
cond = true;
count = 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
cond1 = count == 0 or
(count >= 1 and MarketPosition == -1) or
(count >= 1 and MarketPosition == 0 and
(IsExitName("ssx",1) == true or IsExitName("sPt1",1) == true or IsExitName("bx",1) == true or IsExitName("sx",1) == true));
cond2 = count == 0 or
(count >= 1 and MarketPosition == 1) or
(count >= 1 and MarketPosition == 0 and
(IsExitName("bbx",1) == true or IsExitName("bPt1",1) == true or IsExitName("bx",1) == true or IsExitName("sx",1) == true));
if data3(crossup(ma(c,5),ma(c,30))) Then
d3cross = 1;
if data3(CrossDown(ma(c,5),ma(c,30))) Then
d3cross = -1;
if data4(crossup(ma(c,5),ma(c,30))) Then
d4cross = 1;
if data4(CrossDown(ma(c,5),ma(c,30))) Then
d4cross = -1;
if cond1 == true and val1 > val2 and val3 > val3[1] and !(d3cross == -1 and d4cross == -1) Then
buy("b");
if cond2 == true and val1 < val2 and val3 < val3[1] and !(d3cross == 1 and d4cross == 1) Then
sell("s");
if MarketPosition == 1 and val3 < val3[1] and cond == false Then
ExitLong("bx");
if MarketPosition == 1 and val2 < val2[1] and cond == true Then
ExitLong("bbx");
if MarketPosition == -1 and val3 > val3[1] and cond == false Then
ExitShort("sx");
if MarketPosition == -1 and val2 > val2[1] and cond == true Then
ExitShort("ssx");
if MarketPosition !=0 Then{
ExitLong("bPT1",atLimit,EntryPrice+1);#진입가+1포인트 매수청산
ExitShort("SPT1",AtLimit,EntryPrice-1);#진입가-1포인트 매도청산
}
즐거운 하루되세요
> 비츠로 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 항상 노고가 많으십니다.
아래식에서 DATA3, DATA4를 삽입해서 진입금지식을 만들고 싶습니다.
둘다 참조식에서 골든크로스면 매도금지, 데드크로스면 매수금지.
둘다 기준은 30일선과 5일선입니다.
감사합니다.
Input : shortPeriod(5), longPeriod(20), period(36),ADXP(14);
var : cnt(0),count(0),d2adx(0,data2),cond(false,data2);
var : val1(0,data1),val2(0,data1),val3(0,data1),cond1(false,data1),cond2(false,data1);
d2adx = data2(ADX(ADXP));
val1 = ema(C, shortPeriod);
val2 = ema(C, longPeriod);
val3= ema(C, Period);
if data2(date != date[1]) then
cond = false;
if d2adx >= 40 Then
cond = true;
count = 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
cond1 = count == 0 or
(count >= 1 and MarketPosition == -1) or
(count >= 1 and MarketPosition == 0 and
(IsExitName("ssx",1) == true or IsExitName("sPt1",1) == true or IsExitName("bx",1) == true or IsExitName("sx",1) == true));
cond2 = count == 0 or
(count >= 1 and MarketPosition == 1) or
(count >= 1 and MarketPosition == 0 and
(IsExitName("bbx",1) == true or IsExitName("bPt1",1) == true or IsExitName("bx",1) == true or IsExitName("sx",1) == true));
if cond1 == true and val1 > val2 and val3 > val3[1] Then
buy("b");
if cond2 == true and val1 < val2 and val3 < val3[1] Then
sell("s");
if MarketPosition == 1 and val3 < val3[1] and cond == false Then
ExitLong("bx");
if MarketPosition == 1 and val2 < val2[1] and cond == true Then
ExitLong("bbx");
if MarketPosition == -1 and val3 > val3[1] and cond == false Then
ExitShort("sx");
if MarketPosition == -1 and val2 > val2[1] and cond == true Then
ExitShort("ssx");
if MarketPosition !=0 Then{
ExitLong("bPT1",atLimit,EntryPrice+1);#진입가+1포인트 매수청산
ExitShort("SPT1",AtLimit,EntryPrice-1);#진입가-1포인트 매도청산
}
다음글
이전글