커뮤니티

문의드립니다.

프로필 이미지
비츠로
2012-01-18 08:59:56
286
글번호 46740
답변완료
작성해주신 식대로 대입을 했는데 b,bb/s,ss가 계속 반복해서 나오고 에전엔 목표수익 청산후 반대로만 진입했는데 data2 참조식을 넣으니 같은 방향으로 재진입이 됩니다. 제가 원하는건 목표수익(bpt1.spt1)청산 후 반대로만 진입. data2청산(bbx,ssx) 후 역시 반대로만 진입. 일반 청산은(bx,sx) 같은 방향도 재진입가능입니다. 아래식 확인 좀 부탁드리겠습니다. 감사합니다. Input : shortPeriod(5), longPeriod(20), period(36),ADXP(14); var : cnt(0),count(0),d2adx(0,data2),cond(false,data2); d2adx = data2(ADX(ADXP)); value1 = ema(C, shortPeriod); value2 = ema(C, longPeriod); value3= 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; } condition1 = count == 0 or (count >= 1 and (MarketPosition == -1 or (MarketPosition == 0 and IsExitName("bbx",1) == false))); condition2 = count == 0 or (count >= 1 and (MarketPosition == 1 or (MarketPosition == 0 and IsExitName("ssx",1) == false))); if Condition1 == true and value1> value2 and value3 > value3[1] Then buy("bb"); if Condition2 == true and value1<value2 and value3 < value3[1] Then sell("ss"); if MarketPosition == 1 and value3 < value3[1] and cond == false Then ExitLong("bx"); if MarketPosition == 1 and value2 < value2[1] and cond == true Then ExitLong("bbx"); if MarketPosition == -1 and value3 > value3[1] and cond == false Then ExitShort("sx"); if MarketPosition == -1 and value2 > value2[1] and cond == true Then ExitShort("ssx"); count = 0; for cnt = 0 to 10{ if sdate == EntryDate(cnt) Then count = count+1; } condition2 = count == 0 or (count >= 1 and (MarketPosition == -1 or (MarketPosition == 0 and IsExitName("bPt1",1) == false))); condition3 = count == 0 or (count >= 1 and (MarketPosition == 1 or (MarketPosition == 0 and IsExitName("sPT1",1) == false))); if Condition2 == true and value1> value2 and value3 > value3[1] Then buy("b"); if Condition3 == true and value1<value2 and value3 < value3[1] Then sell("s"); if MarketPosition !=0 Then{ ExitLong("bPT1",atLimit,EntryPrice+1);#진입가+1포인트 매수청산 ExitShort("SPT1",AtLimit,EntryPrice-1);#진입가-1포인트 매도청산 }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2012-01-18 15:05:46

안녕하세요 예스스탁입니다. 식을 수정했습니다. 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포인트 매도청산 } 즐거운 하루되세요 > 비츠로 님이 쓴 글입니다. > 제목 : 문의드립니다. > 작성해주신 식대로 대입을 했는데 b,bb/s,ss가 계속 반복해서 나오고 에전엔 목표수익 청산후 반대로만 진입했는데 data2 참조식을 넣으니 같은 방향으로 재진입이 됩니다. 제가 원하는건 목표수익(bpt1.spt1)청산 후 반대로만 진입. data2청산(bbx,ssx) 후 역시 반대로만 진입. 일반 청산은(bx,sx) 같은 방향도 재진입가능입니다. 아래식 확인 좀 부탁드리겠습니다. 감사합니다. Input : shortPeriod(5), longPeriod(20), period(36),ADXP(14); var : cnt(0),count(0),d2adx(0,data2),cond(false,data2); d2adx = data2(ADX(ADXP)); value1 = ema(C, shortPeriod); value2 = ema(C, longPeriod); value3= 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; } condition1 = count == 0 or (count >= 1 and (MarketPosition == -1 or (MarketPosition == 0 and IsExitName("bbx",1) == false))); condition2 = count == 0 or (count >= 1 and (MarketPosition == 1 or (MarketPosition == 0 and IsExitName("ssx",1) == false))); if Condition1 == true and value1> value2 and value3 > value3[1] Then buy("bb"); if Condition2 == true and value1<value2 and value3 < value3[1] Then sell("ss"); if MarketPosition == 1 and value3 < value3[1] and cond == false Then ExitLong("bx"); if MarketPosition == 1 and value2 < value2[1] and cond == true Then ExitLong("bbx"); if MarketPosition == -1 and value3 > value3[1] and cond == false Then ExitShort("sx"); if MarketPosition == -1 and value2 > value2[1] and cond == true Then ExitShort("ssx"); count = 0; for cnt = 0 to 10{ if sdate == EntryDate(cnt) Then count = count+1; } condition2 = count == 0 or (count >= 1 and (MarketPosition == -1 or (MarketPosition == 0 and IsExitName("bPt1",1) == false))); condition3 = count == 0 or (count >= 1 and (MarketPosition == 1 or (MarketPosition == 0 and IsExitName("sPT1",1) == false))); if Condition2 == true and value1> value2 and value3 > value3[1] Then buy("b"); if Condition3 == true and value1<value2 and value3 < value3[1] Then sell("s"); if MarketPosition !=0 Then{ ExitLong("bPT1",atLimit,EntryPrice+1);#진입가+1포인트 매수청산 ExitShort("SPT1",AtLimit,EntryPrice-1);#진입가-1포인트 매도청산 }