커뮤니티

수식 오류 좀 잡아주세요..

프로필 이미지
수연사랑
2011-05-20 09:46:33
628
글번호 38863
답변완료
수고 많으십니다. 관리자님. 수식을 작성한 것이 작동을 제대로 하지 않아서 문의를 드립니다. "상기대매수" "상기대재진입" "상한가오버청산1" "상한가오버청산2" 이것이 작동을 안합니다. If MarketPosition == 1 and sdate != EntryDate(1) and dayclose(1) == 상한가 Then{ if stime == 150000 and NextBarOpen <= dayclose*1.03 then ExitLong("상한가오버청산1",AtStop,Dayclose*1.03); if stime == 150000 and NextBarOpen > dayclose*1.03 then ExitLong("상한가오버청산2",AtStop,highest(H,BarsSinceEntry)*0.99); 요 식은 전날 매수하고 청산하지 않은 채 익일로 넘어갔을 경우(상한가로 오버된 경우)청산하고자 하는 식인데 아예 작동을 하지 않네요. 시초가매도하려는 식인데 어떤 오류인지 잡아주시면 감사드리구요, "상기대매수" "상기대재진입" 은 기본적으로 당일 14% 넘어가면 진입하는 것인데 진입을 안하더라구요. 오류시정좀 부탁드립니다.. ************************************************************************** input : N(1); var : 상한가(0), UpLimit(0); var : aaa(0), bbb(0), ccc(0), ddd(0), eee(0),fff(0); if date >= 19981207 then { if date < 20050328 && CodeCategory() == 2 then UpLimit = (BP[0] * 1.12); Else UpLimit = (BP[0] * 1.15); if CodeCategory() == 2 then { if date >= 20030721 then { aaa = int(UpLimit/100+0.00001)*100; bbb = int(UpLimit/100+0.00001)*100; ccc = int(UpLimit/100+0.00001)*100; ddd = int(UpLimit/50+0.00001)*50; eee = int(UpLimit/10+0.00001)*10; fff = int(UpLimit/5+0.00001)*5; } else { aaa = int(UpLimit/1000+0.00001)*1000; bbb = int(UpLimit/500+0.00001)*500; ccc = int(UpLimit/100+0.00001)*100; ddd = int(UpLimit/50+0.00001)*50; eee = int(UpLimit/10+0.00001)*10; fff = int(UpLimit/10+0.00001)*10; } } Else { aaa = int(UpLimit/1000+0.00001)*1000; bbb = int(UpLimit/500+0.00001)*500; ccc = int(UpLimit/100+0.00001)*100; ddd = int(UpLimit/50+0.00001)*50; eee = int(UpLimit/10+0.00001)*10; fff = int(UpLimit/5+0.00001)*5; } if CodeCategory() == 1 || CodeCategory() == 2 then { If BP >= 500000 Then 상한가 = aaa; Else If BP >= 100000 Then 상한가 = iff(bbb>=500000, aaa, bbb); Else If BP >= 50000 Then 상한가 = iff(ccc>=100000, bbb, ccc); Else If BP >= 10000 Then 상한가 = iff(ddd>=50000, ccc, ddd); Else If BP >= 5000 Then 상한가 = iff(eee>=10000, ddd, eee); Else 상한가 = iff(fff>=5000, eee, fff); } else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF 상한가 = fff; } } if MarketPosition == 0 and ExitDate(1) != sdate Then{ if dayindex >= 0 and stime < 143000 Then buy("고점돌파",AtStop,dayhigh(N)+PriceScale); if dayindex >= 0 and stime < 143000 and DayVolume < DayVolume(N)*(4/5) and c[1] < dayopen*1.14 Then buy("상기대매수",AtStop,dayopen*1.14); } if MarketPosition == 0 then{ if stime == 150000 and NextBarOpen >= dayhigh(N-1)+PriceScale Then buy("시초가매수",AtStop,dayhigh(N-1)+PriceScale); } if MarketPosition == 1 and ExitDate(1) != sdate and dayclose(1) != 상한가 Then{ exitlong("진입가손절",AtStop,EntryPrice*0.98); exitlong("고점손절",AtStop,dayhigh(N)*0.985); if highest(H,BarsSinceEntry) < dayopen*1.1 Then exitlong("10%미만청산",AtStop,highest(H,BarsSinceEntry)*0.97); if highest(H,BarsSinceEntry) >= dayopen*1.1 Then exitlong("10%이상청산",AtStop,highest(H,BarsSinceEntry)*0.98); if c == 상한가 Then exitlong("상한가청산",AtStop,상한가*0.99); } if MarketPosition == 0 and ExitDate(1) == sdate and ExitDate(2) != sdate then{ if dayindex >= 0 and stime < 143000 and DayVolume < DayVolume(N)*(4/5) and c[1] < dayopen*1.149 Then buy("상기대재진입",AtStop,dayopen*1.14); if dayindex >= 0 and stime < 143000 and C < dayhigh(N) then buy("고점재돌파",AtStop,dayhigh(N)+PriceScale*2); if dayindex >= 0 and stime < 143000 and C < dayopen then buy("시초가재매수",AtStop,dayopen+PriceScale*2); } if MarketPosition == 1 and (IsEntryName("상기대재진입") or IsEntryName("고점재돌파") or IsEntryName("시초가재매수")) Then{ exitlong("진입가손절2",AtStop,EntryPrice*0.98); if highest(H,BarsSinceEntry) < dayopen*1.1 Then exitlong("10%미만청산2",AtStop,highest(H,BarsSinceEntry)*0.97); if highest(H,BarsSinceEntry) >= dayopen*1.1 Then exitlong("10%이상청산2",AtStop,highest(H,BarsSinceEntry)*0.98); if c == 상한가 Then exitlong("상한가청산2",AtStop,상한가*0.99); } If MarketPosition == 1 and sdate != EntryDate(1) and dayclose(1) == 상한가 Then{ if stime == 150000 and NextBarOpen <= dayclose*1.03 then ExitLong("상한가오버청산1",AtStop,Dayclose*1.03); if stime == 150000 and NextBarOpen > dayclose*1.03 then ExitLong("상한가오버청산2",AtStop,highest(H,BarsSinceEntry)*0.99);
시스템
답변 2
프로필 이미지

예스스탁 예스스탁 답변

2011-05-20 15:08:30

안녕하세요 예스스탁입니다. If MarketPosition == 1 and sdate != EntryDate(1) and DayHigh(1) == 상한가[1] Then{ if dayindex == 0 and O <= dayclose(1)*1.03 and H >=Dayclose(1)*1.03 then ExitLong("상한가오버청산1"); if dayindex == 0 and O > dayclose(1)*1.03 and H > highest(H,BarsSinceEntry)*0.99 then ExitLong("상한가오버청산2"); } 즐거운 하루되세요 > 수연사랑 님이 쓴 글입니다. > 제목 : 수식 오류 좀 잡아주세요.. > 수고 많으십니다. 관리자님. 수식을 작성한 것이 작동을 제대로 하지 않아서 문의를 드립니다. "상기대매수" "상기대재진입" "상한가오버청산1" "상한가오버청산2" 이것이 작동을 안합니다. If MarketPosition == 1 and sdate != EntryDate(1) and dayclose(1) == 상한가 Then{ if stime == 150000 and NextBarOpen <= dayclose*1.03 then ExitLong("상한가오버청산1",AtStop,Dayclose*1.03); if stime == 150000 and NextBarOpen > dayclose*1.03 then ExitLong("상한가오버청산2",AtStop,highest(H,BarsSinceEntry)*0.99); 요 식은 전날 매수하고 청산하지 않은 채 익일로 넘어갔을 경우(상한가로 오버된 경우)청산하고자 하는 식인데 아예 작동을 하지 않네요. 시초가매도하려는 식인데 어떤 오류인지 잡아주시면 감사드리구요, "상기대매수" "상기대재진입" 은 기본적으로 당일 14% 넘어가면 진입하는 것인데 진입을 안하더라구요. 오류시정좀 부탁드립니다.. ************************************************************************** input : N(1); var : 상한가(0), UpLimit(0); var : aaa(0), bbb(0), ccc(0), ddd(0), eee(0),fff(0); if date >= 19981207 then { if date < 20050328 && CodeCategory() == 2 then UpLimit = (BP[0] * 1.12); Else UpLimit = (BP[0] * 1.15); if CodeCategory() == 2 then { if date >= 20030721 then { aaa = int(UpLimit/100+0.00001)*100; bbb = int(UpLimit/100+0.00001)*100; ccc = int(UpLimit/100+0.00001)*100; ddd = int(UpLimit/50+0.00001)*50; eee = int(UpLimit/10+0.00001)*10; fff = int(UpLimit/5+0.00001)*5; } else { aaa = int(UpLimit/1000+0.00001)*1000; bbb = int(UpLimit/500+0.00001)*500; ccc = int(UpLimit/100+0.00001)*100; ddd = int(UpLimit/50+0.00001)*50; eee = int(UpLimit/10+0.00001)*10; fff = int(UpLimit/10+0.00001)*10; } } Else { aaa = int(UpLimit/1000+0.00001)*1000; bbb = int(UpLimit/500+0.00001)*500; ccc = int(UpLimit/100+0.00001)*100; ddd = int(UpLimit/50+0.00001)*50; eee = int(UpLimit/10+0.00001)*10; fff = int(UpLimit/5+0.00001)*5; } if CodeCategory() == 1 || CodeCategory() == 2 then { If BP >= 500000 Then 상한가 = aaa; Else If BP >= 100000 Then 상한가 = iff(bbb>=500000, aaa, bbb); Else If BP >= 50000 Then 상한가 = iff(ccc>=100000, bbb, ccc); Else If BP >= 10000 Then 상한가 = iff(ddd>=50000, ccc, ddd); Else If BP >= 5000 Then 상한가 = iff(eee>=10000, ddd, eee); Else 상한가 = iff(fff>=5000, eee, fff); } else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF 상한가 = fff; } } if MarketPosition == 0 and ExitDate(1) != sdate Then{ if dayindex >= 0 and stime < 143000 Then buy("고점돌파",AtStop,dayhigh(N)+PriceScale); if dayindex >= 0 and stime < 143000 and DayVolume < DayVolume(N)*(4/5) and c[1] < dayopen*1.14 Then buy("상기대매수",AtStop,dayopen*1.14); } if MarketPosition == 0 then{ if stime == 150000 and NextBarOpen >= dayhigh(N-1)+PriceScale Then buy("시초가매수",AtStop,dayhigh(N-1)+PriceScale); } if MarketPosition == 1 and ExitDate(1) != sdate and dayclose(1) != 상한가 Then{ exitlong("진입가손절",AtStop,EntryPrice*0.98); exitlong("고점손절",AtStop,dayhigh(N)*0.985); if highest(H,BarsSinceEntry) < dayopen*1.1 Then exitlong("10%미만청산",AtStop,highest(H,BarsSinceEntry)*0.97); if highest(H,BarsSinceEntry) >= dayopen*1.1 Then exitlong("10%이상청산",AtStop,highest(H,BarsSinceEntry)*0.98); if c == 상한가 Then exitlong("상한가청산",AtStop,상한가*0.99); } if MarketPosition == 0 and ExitDate(1) == sdate and ExitDate(2) != sdate then{ if dayindex >= 0 and stime < 143000 and DayVolume < DayVolume(N)*(4/5) and c[1] < dayopen*1.149 Then buy("상기대재진입",AtStop,dayopen*1.14); if dayindex >= 0 and stime < 143000 and C < dayhigh(N) then buy("고점재돌파",AtStop,dayhigh(N)+PriceScale*2); if dayindex >= 0 and stime < 143000 and C < dayopen then buy("시초가재매수",AtStop,dayopen+PriceScale*2); } if MarketPosition == 1 and (IsEntryName("상기대재진입") or IsEntryName("고점재돌파") or IsEntryName("시초가재매수")) Then{ exitlong("진입가손절2",AtStop,EntryPrice*0.98); if highest(H,BarsSinceEntry) < dayopen*1.1 Then exitlong("10%미만청산2",AtStop,highest(H,BarsSinceEntry)*0.97); if highest(H,BarsSinceEntry) >= dayopen*1.1 Then exitlong("10%이상청산2",AtStop,highest(H,BarsSinceEntry)*0.98); if c == 상한가 Then exitlong("상한가청산2",AtStop,상한가*0.99); } If MarketPosition == 1 and sdate != EntryDate(1) and dayclose(1) == 상한가 Then{ if stime == 150000 and NextBarOpen <= dayclose*1.03 then ExitLong("상한가오버청산1",AtStop,Dayclose*1.03); if stime == 150000 and NextBarOpen > dayclose*1.03 then ExitLong("상한가오버청산2",AtStop,highest(H,BarsSinceEntry)*0.99);
프로필 이미지

청춘의환희

2011-05-20 15:11:23

친절히 답변해주셔서 감사합니다 > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 수식 오류 좀 잡아주세요.. > 안녕하세요 예스스탁입니다. If MarketPosition == 1 and sdate != EntryDate(1) and DayHigh(1) == 상한가[1] Then{ if dayindex == 0 and O <= dayclose(1)*1.03 and H >=Dayclose(1)*1.03 then ExitLong("상한가오버청산1"); if dayindex == 0 and O > dayclose(1)*1.03 and H > highest(H,BarsSinceEntry)*0.99 then ExitLong("상한가오버청산2"); } 즐거운 하루되세요 > 수연사랑 님이 쓴 글입니다. > 제목 : 수식 오류 좀 잡아주세요.. > 수고 많으십니다. 관리자님. 수식을 작성한 것이 작동을 제대로 하지 않아서 문의를 드립니다. "상기대매수" "상기대재진입" "상한가오버청산1" "상한가오버청산2" 이것이 작동을 안합니다. If MarketPosition == 1 and sdate != EntryDate(1) and dayclose(1) == 상한가 Then{ if stime == 150000 and NextBarOpen <= dayclose*1.03 then ExitLong("상한가오버청산1",AtStop,Dayclose*1.03); if stime == 150000 and NextBarOpen > dayclose*1.03 then ExitLong("상한가오버청산2",AtStop,highest(H,BarsSinceEntry)*0.99); 요 식은 전날 매수하고 청산하지 않은 채 익일로 넘어갔을 경우(상한가로 오버된 경우)청산하고자 하는 식인데 아예 작동을 하지 않네요. 시초가매도하려는 식인데 어떤 오류인지 잡아주시면 감사드리구요, "상기대매수" "상기대재진입" 은 기본적으로 당일 14% 넘어가면 진입하는 것인데 진입을 안하더라구요. 오류시정좀 부탁드립니다.. ************************************************************************** input : N(1); var : 상한가(0), UpLimit(0); var : aaa(0), bbb(0), ccc(0), ddd(0), eee(0),fff(0); if date >= 19981207 then { if date < 20050328 && CodeCategory() == 2 then UpLimit = (BP[0] * 1.12); Else UpLimit = (BP[0] * 1.15); if CodeCategory() == 2 then { if date >= 20030721 then { aaa = int(UpLimit/100+0.00001)*100; bbb = int(UpLimit/100+0.00001)*100; ccc = int(UpLimit/100+0.00001)*100; ddd = int(UpLimit/50+0.00001)*50; eee = int(UpLimit/10+0.00001)*10; fff = int(UpLimit/5+0.00001)*5; } else { aaa = int(UpLimit/1000+0.00001)*1000; bbb = int(UpLimit/500+0.00001)*500; ccc = int(UpLimit/100+0.00001)*100; ddd = int(UpLimit/50+0.00001)*50; eee = int(UpLimit/10+0.00001)*10; fff = int(UpLimit/10+0.00001)*10; } } Else { aaa = int(UpLimit/1000+0.00001)*1000; bbb = int(UpLimit/500+0.00001)*500; ccc = int(UpLimit/100+0.00001)*100; ddd = int(UpLimit/50+0.00001)*50; eee = int(UpLimit/10+0.00001)*10; fff = int(UpLimit/5+0.00001)*5; } if CodeCategory() == 1 || CodeCategory() == 2 then { If BP >= 500000 Then 상한가 = aaa; Else If BP >= 100000 Then 상한가 = iff(bbb>=500000, aaa, bbb); Else If BP >= 50000 Then 상한가 = iff(ccc>=100000, bbb, ccc); Else If BP >= 10000 Then 상한가 = iff(ddd>=50000, ccc, ddd); Else If BP >= 5000 Then 상한가 = iff(eee>=10000, ddd, eee); Else 상한가 = iff(fff>=5000, eee, fff); } else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF 상한가 = fff; } } if MarketPosition == 0 and ExitDate(1) != sdate Then{ if dayindex >= 0 and stime < 143000 Then buy("고점돌파",AtStop,dayhigh(N)+PriceScale); if dayindex >= 0 and stime < 143000 and DayVolume < DayVolume(N)*(4/5) and c[1] < dayopen*1.14 Then buy("상기대매수",AtStop,dayopen*1.14); } if MarketPosition == 0 then{ if stime == 150000 and NextBarOpen >= dayhigh(N-1)+PriceScale Then buy("시초가매수",AtStop,dayhigh(N-1)+PriceScale); } if MarketPosition == 1 and ExitDate(1) != sdate and dayclose(1) != 상한가 Then{ exitlong("진입가손절",AtStop,EntryPrice*0.98); exitlong("고점손절",AtStop,dayhigh(N)*0.985); if highest(H,BarsSinceEntry) < dayopen*1.1 Then exitlong("10%미만청산",AtStop,highest(H,BarsSinceEntry)*0.97); if highest(H,BarsSinceEntry) >= dayopen*1.1 Then exitlong("10%이상청산",AtStop,highest(H,BarsSinceEntry)*0.98); if c == 상한가 Then exitlong("상한가청산",AtStop,상한가*0.99); } if MarketPosition == 0 and ExitDate(1) == sdate and ExitDate(2) != sdate then{ if dayindex >= 0 and stime < 143000 and DayVolume < DayVolume(N)*(4/5) and c[1] < dayopen*1.149 Then buy("상기대재진입",AtStop,dayopen*1.14); if dayindex >= 0 and stime < 143000 and C < dayhigh(N) then buy("고점재돌파",AtStop,dayhigh(N)+PriceScale*2); if dayindex >= 0 and stime < 143000 and C < dayopen then buy("시초가재매수",AtStop,dayopen+PriceScale*2); } if MarketPosition == 1 and (IsEntryName("상기대재진입") or IsEntryName("고점재돌파") or IsEntryName("시초가재매수")) Then{ exitlong("진입가손절2",AtStop,EntryPrice*0.98); if highest(H,BarsSinceEntry) < dayopen*1.1 Then exitlong("10%미만청산2",AtStop,highest(H,BarsSinceEntry)*0.97); if highest(H,BarsSinceEntry) >= dayopen*1.1 Then exitlong("10%이상청산2",AtStop,highest(H,BarsSinceEntry)*0.98); if c == 상한가 Then exitlong("상한가청산2",AtStop,상한가*0.99); } If MarketPosition == 1 and sdate != EntryDate(1) and dayclose(1) == 상한가 Then{ if stime == 150000 and NextBarOpen <= dayclose*1.03 then ExitLong("상한가오버청산1",AtStop,Dayclose*1.03); if stime == 150000 and NextBarOpen > dayclose*1.03 then ExitLong("상한가오버청산2",AtStop,highest(H,BarsSinceEntry)*0.99);