커뮤니티

수식 작성 부탁드립니다. 미리 감사드립니다.

프로필 이미지
나스닥에센피
2022-04-22 11:39:54
1900
글번호 158224
답변완료

첨부 이미지

일전에도 시스템 수식을 만들어 주셔서 잘 사용하고 있는데, 이번에 새로운 시스템을 만들게 되어 다시 한번 수식작성을 부탁드립니다. 추세추종 시스템인데요. 리버스 시스템은 아닙니다. 일단 매번 일정 포인트 이상의 등락이 있는 경우, 여기선 예를 들어 골드로 가정하여 이전 저점과 고점에서 8.0 이상의 등락(기준 등락)이 있는 경우만 시세를 체크합니다. 첨부파일 셋째 행에서 4.19일 전저점대비로 기준등락(8.0)보다 약간 큰 9.5가 올라 1985.1 이 되었고, 이후 25.6 하락하여 1959.5 가 되는데, 이 하락시 이전 상승폭보다 0.1만큼 더 하락한 지점인 1975.5(직전 고점대비 9.6 하락)에서 즉시 매도 진입.. 즉, 이 경우 하락이 이전 상승폭인 9.5 보다 적은 상황에서 이후 8.0 이상 올랐다면 신호가 없게 됩니다. 즉 절대값 기준 등락폭이 이전 등락폭보다 적으면 기준등락 이상 움직이더라도 계속 신호가 없게 됩니다. 진입은 이런 식으로 하고, 청산은 세가지(진입은 세가지 모두 동일) 방법이 있는데요. 신호1은 진입후 8.0 수익지점에서 청산하거나, 8.0 수익지점에 미달후 되돌림하면 8.0 되돌림 수준에서 청산하고 다음 신호를 기다립니다. 신호2는 진입후 갈 때까지 가는 걸 보고 트레일링스탑으로 8.0 되돌림 수준에서 청산하고 역시 다음 신호를 기다리게 됩니다. 신호3은 최대이익을 설정(여기서는 16.0)하여 최대이익 도달지점에서 청산하거나, 최대이익 포인트에 미달후 되돌림하면 신호2와 같은 방식으로 8.0 되돌림 수준에서 청산하고 다음 신호가 나올 때까지 기다립니다. 이렇게 신호가 3 개인 셈인데, 각각 따로 만들어주셨으면 합니다. 고저가/등락폭은 전날로부터 이어지는 개념으로 하되, 시스템 오픈하는 시간은 9시로 하여 연결개념에서 매매신호가 아직 없다면 신호를 기다리고, 전날과 연결하여 이미 매수(/매도)신호 상태면 9시에 매수(/매도)로 진입 후 이후엔 매매신호를 따라가고, 일중 거래 종결(포지션 청산)시간은 현물 마감시간인 새벽 5시에 하고자 합니다. <추가질문입니다: 4.22일 11시40분> 일중 거래 청산을 하지 않고 오버나이트할 수 있게 하려면 시간설정을 어떻게 해야 하는지요? 이상인데요. 미리 감사드리며 모두 즐거운 주말 되세요^^
시스템
답변 4
프로필 이미지

예스스탁 예스스탁 답변

2022-04-22 14:02:57

안녕하세요 예스스탁입니다. 당일청산을 안하시려면 Endtime을 -1로 지정하시면 됩니다. 1 input : StartTime(90000),EndTime(050000); var : Tcond(false); if endtime > -1 Then { IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } } if endtime > -1 and ((sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime)) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; IF Endtime > -1 and Endtime <= starttime Then { SetStopEndofday(0); } } if Tcond == true Then { if MarketPosition <= 0 and C >= C[1]+8 Then { Sell("s",AtStop,C[1]-0.1); } if MarketPosition >= 0 and C <= C[1]-8 Then { Buy("b",AtStop,C[1]+0.1); } if MarketPosition == 1 Then { ExitLong("bx1",AtLimit,EntryPrice+8); ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-8); } if MarketPosition == -1 Then { ExitShort("sx1",AtLimit,EntryPrice-8); ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+8); } } 2 input : StartTime(90000),EndTime(050000); var : Tcond(false); if endtime > -1 Then { IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } } if endtime > -1 and ((sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime)) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; IF Endtime > -1 and Endtime <= starttime Then { SetStopEndofday(0); } } if Tcond == true Then { if MarketPosition <= 0 and C >= C[1]+8 Then { Sell("s",AtStop,C[1]-0.1); } if MarketPosition >= 0 and C <= C[1]-8 Then { Buy("b",AtStop,C[1]+0.1); } if MarketPosition == 1 Then { ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-8); } if MarketPosition == -1 Then { ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+8); } } 3 input : StartTime(90000),EndTime(050000); var : Tcond(false); if endtime > -1 Then { IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } } if endtime > -1 and ((sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime)) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; IF Endtime > -1 and Endtime <= starttime Then { SetStopEndofday(0); } } if Tcond == true Then { if MarketPosition <= 0 and C >= C[1]+8 Then { Sell("s",AtStop,C[1]-0.1); } if MarketPosition >= 0 and C <= C[1]-8 Then { Buy("b",AtStop,C[1]+0.1); } if MarketPosition == 1 Then { ExitLong("bx1",AtLimit,EntryPrice+16); ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-8); } if MarketPosition == -1 Then { ExitShort("sx1",AtLimit,EntryPrice-16); ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+8); } } 즐거운 하루되세요 > 나스닥에센피 님이 쓴 글입니다. > 제목 : 수식 작성 부탁드립니다. 미리 감사드립니다. > 일전에도 시스템 수식을 만들어 주셔서 잘 사용하고 있는데, 이번에 새로운 시스템을 만들게 되어 다시 한번 수식작성을 부탁드립니다. 추세추종 시스템인데요. 리버스 시스템은 아닙니다. 일단 매번 일정 포인트 이상의 등락이 있는 경우, 여기선 예를 들어 골드로 가정하여 이전 저점과 고점에서 8.0 이상의 등락(기준 등락)이 있는 경우만 시세를 체크합니다. 첨부파일 셋째 행에서 4.19일 전저점대비로 기준등락(8.0)보다 약간 큰 9.5가 올라 1985.1 이 되었고, 이후 25.6 하락하여 1959.5 가 되는데, 이 하락시 이전 상승폭보다 0.1만큼 더 하락한 지점인 1975.5(직전 고점대비 9.6 하락)에서 즉시 매도 진입.. 즉, 이 경우 하락이 이전 상승폭인 9.5 보다 적은 상황에서 이후 8.0 이상 올랐다면 신호가 없게 됩니다. 즉 절대값 기준 등락폭이 이전 등락폭보다 적으면 기준등락 이상 움직이더라도 계속 신호가 없게 됩니다. 진입은 이런 식으로 하고, 청산은 세가지(진입은 세가지 모두 동일) 방법이 있는데요. 신호1은 진입후 8.0 수익지점에서 청산하거나, 8.0 수익지점에 미달후 되돌림하면 8.0 되돌림 수준에서 청산하고 다음 신호를 기다립니다. 신호2는 진입후 갈 때까지 가는 걸 보고 트레일링스탑으로 8.0 되돌림 수준에서 청산하고 역시 다음 신호를 기다리게 됩니다. 신호3은 최대이익을 설정(여기서는 16.0)하여 최대이익 도달지점에서 청산하거나, 최대이익 포인트에 미달후 되돌림하면 신호2와 같은 방식으로 8.0 되돌림 수준에서 청산하고 다음 신호가 나올 때까지 기다립니다. 이렇게 신호가 3 개인 셈인데, 각각 따로 만들어주셨으면 합니다. 고저가/등락폭은 전날로부터 이어지는 개념으로 하되, 시스템 오픈하는 시간은 9시로 하여 연결개념에서 매매신호가 아직 없다면 신호를 기다리고, 전날과 연결하여 이미 매수(/매도)신호 상태면 9시에 매수(/매도)로 진입 후 이후엔 매매신호를 따라가고, 일중 거래 종결(포지션 청산)시간은 현물 마감시간인 새벽 5시에 하고자 합니다. <추가질문입니다: 4.22일 11시40분> 일중 거래 청산을 하지 않고 오버나이트할 수 있게 하려면 시간설정을 어떻게 해야 하는지요? 이상인데요. 미리 감사드리며 모두 즐거운 주말 되세요^^
프로필 이미지

나스닥에센피

2022-04-22 15:41:35

올려주신 수식중 '신호1'을 복사하여 매매신호를 만들어서 적용해보니 매매신호가 표시가 안되고(그림2에서 처럼 3분봉 기준으로 할 경우 최근 기준 4.21일 17:33분 매도, 4.22일 03:45분 매수, 4.22일 15:03분 매수 등) 해서 시스템 성능보고서가 공란으로 나오고 있는데 이건 왜 그럴까요? 그리고 한가지 더 문의합니다. 당일청산을 하지 않고 오버나이트할 경우 Endtime을 -1로 지정하듯이 "StartTime(90000)"은 그냥 그대로 두어도 될런지요? 항상 친절한 답변 감사합니다. > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 수식 작성 부탁드립니다. 미리 감사드립니다. > 안녕하세요 예스스탁입니다. 당일청산을 안하시려면 Endtime을 -1로 지정하시면 됩니다. 1 input : StartTime(90000),EndTime(050000); var : Tcond(false); if endtime > -1 Then { IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } } if endtime > -1 and ((sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime)) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; IF Endtime > -1 and Endtime <= starttime Then { SetStopEndofday(0); } } if Tcond == true Then { if MarketPosition <= 0 and C >= C[1]+8 Then { Sell("s",AtStop,C[1]-0.1); } if MarketPosition >= 0 and C <= C[1]-8 Then { Buy("b",AtStop,C[1]+0.1); } if MarketPosition == 1 Then { ExitLong("bx1",AtLimit,EntryPrice+8); ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-8); } if MarketPosition == -1 Then { ExitShort("sx1",AtLimit,EntryPrice-8); ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+8); } } 2 input : StartTime(90000),EndTime(050000); var : Tcond(false); if endtime > -1 Then { IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } } if endtime > -1 and ((sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime)) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; IF Endtime > -1 and Endtime <= starttime Then { SetStopEndofday(0); } } if Tcond == true Then { if MarketPosition <= 0 and C >= C[1]+8 Then { Sell("s",AtStop,C[1]-0.1); } if MarketPosition >= 0 and C <= C[1]-8 Then { Buy("b",AtStop,C[1]+0.1); } if MarketPosition == 1 Then { ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-8); } if MarketPosition == -1 Then { ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+8); } } 3 input : StartTime(90000),EndTime(050000); var : Tcond(false); if endtime > -1 Then { IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } } if endtime > -1 and ((sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime)) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; IF Endtime > -1 and Endtime <= starttime Then { SetStopEndofday(0); } } if Tcond == true Then { if MarketPosition <= 0 and C >= C[1]+8 Then { Sell("s",AtStop,C[1]-0.1); } if MarketPosition >= 0 and C <= C[1]-8 Then { Buy("b",AtStop,C[1]+0.1); } if MarketPosition == 1 Then { ExitLong("bx1",AtLimit,EntryPrice+16); ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-8); } if MarketPosition == -1 Then { ExitShort("sx1",AtLimit,EntryPrice-16); ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+8); } } 즐거운 하루되세요 > 나스닥에센피 님이 쓴 글입니다. > 제목 : 수식 작성 부탁드립니다. 미리 감사드립니다. > 일전에도 시스템 수식을 만들어 주셔서 잘 사용하고 있는데, 이번에 새로운 시스템을 만들게 되어 다시 한번 수식작성을 부탁드립니다. 추세추종 시스템인데요. 리버스 시스템은 아닙니다. 일단 매번 일정 포인트 이상의 등락이 있는 경우, 여기선 예를 들어 골드로 가정하여 이전 저점과 고점에서 8.0 이상의 등락(기준 등락)이 있는 경우만 시세를 체크합니다. 첨부파일 셋째 행에서 4.19일 전저점대비로 기준등락(8.0)보다 약간 큰 9.5가 올라 1985.1 이 되었고, 이후 25.6 하락하여 1959.5 가 되는데, 이 하락시 이전 상승폭보다 0.1만큼 더 하락한 지점인 1975.5(직전 고점대비 9.6 하락)에서 즉시 매도 진입.. 즉, 이 경우 하락이 이전 상승폭인 9.5 보다 적은 상황에서 이후 8.0 이상 올랐다면 신호가 없게 됩니다. 즉 절대값 기준 등락폭이 이전 등락폭보다 적으면 기준등락 이상 움직이더라도 계속 신호가 없게 됩니다. 진입은 이런 식으로 하고, 청산은 세가지(진입은 세가지 모두 동일) 방법이 있는데요. 신호1은 진입후 8.0 수익지점에서 청산하거나, 8.0 수익지점에 미달후 되돌림하면 8.0 되돌림 수준에서 청산하고 다음 신호를 기다립니다. 신호2는 진입후 갈 때까지 가는 걸 보고 트레일링스탑으로 8.0 되돌림 수준에서 청산하고 역시 다음 신호를 기다리게 됩니다. 신호3은 최대이익을 설정(여기서는 16.0)하여 최대이익 도달지점에서 청산하거나, 최대이익 포인트에 미달후 되돌림하면 신호2와 같은 방식으로 8.0 되돌림 수준에서 청산하고 다음 신호가 나올 때까지 기다립니다. 이렇게 신호가 3 개인 셈인데, 각각 따로 만들어주셨으면 합니다. 고저가/등락폭은 전날로부터 이어지는 개념으로 하되, 시스템 오픈하는 시간은 9시로 하여 연결개념에서 매매신호가 아직 없다면 신호를 기다리고, 전날과 연결하여 이미 매수(/매도)신호 상태면 9시에 매수(/매도)로 진입 후 이후엔 매매신호를 따라가고, 일중 거래 종결(포지션 청산)시간은 현물 마감시간인 새벽 5시에 하고자 합니다. <추가질문입니다: 4.22일 11시40분> 일중 거래 청산을 하지 않고 오버나이트할 수 있게 하려면 시간설정을 어떻게 해야 하는지요? 이상인데요. 미리 감사드리며 모두 즐거운 주말 되세요^^
프로필 이미지

예스스탁 예스스탁 답변

2022-04-22 16:38:53

안녕하세요 예스스탁입니다. 1 input : StartTime(90000),EndTime(050000); var : Tcond(false),HL(0),LH(0),BuyPrice(0),SellPrice(0); if endtime > -1 Then { IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } } if endtime > -1 and ((sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime)) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; IF Endtime > -1 and Endtime <= starttime Then { SetStopEndofday(0); } } if H == DayHigh Then { HL = H; Condition1 = False; } Else { if L < HL Then { HL = L; if Condition1 == False and HL <= DayHigh-8 Then { Condition1 = true; BuyPrice = DayHigh+0.1; } } } if L == DayLow Then { LH = L; Condition2 = False; } Else { if H > LH Then { LH = H; if Condition2 == False and LH >= DayLow+8 Then { Condition2 = true; SellPrice = DayLow-0.1; } } } if Tcond == true Then { if MarketPosition >= 0 and L > SellPrice and SellPrice > 0 Then { Sell("s",AtStop,SellPrice); } if MarketPosition <= 0 and H < BuyPrice and BuyPrice > 0 Then { Buy("b",AtStop,BuyPrice); } if MarketPosition == 1 Then { if MarketPosition != MarketPosition[1] Then BuyPrice = 0; ExitLong("bx1",AtLimit,EntryPrice+8); ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-8); } if MarketPosition == -1 Then { if MarketPosition != MarketPosition[1] Then SellPrice = 0; ExitShort("sx1",AtLimit,EntryPrice-8); ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+8); } } 2 input : StartTime(90000),EndTime(050000); var : Tcond(false),HL(0),LH(0),BuyPrice(0),SellPrice(0); if endtime > -1 Then { IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } } if endtime > -1 and ((sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime)) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; IF Endtime > -1 and Endtime <= starttime Then { SetStopEndofday(0); } } if H == DayHigh Then { HL = H; Condition1 = False; } Else { if L < HL Then { HL = L; if Condition1 == False and HL <= DayHigh-8 Then { Condition1 = true; BuyPrice = DayHigh+0.1; } } } if L == DayLow Then { LH = L; Condition2 = False; } Else { if H > LH Then { LH = H; if Condition2 == False and LH >= DayLow+8 Then { Condition2 = true; SellPrice = DayLow-0.1; } } } if Tcond == true Then { if MarketPosition >= 0 and L > SellPrice and SellPrice > 0 Then { Sell("s",AtStop,SellPrice); } if MarketPosition <= 0 and H < BuyPrice and BuyPrice > 0 Then { Buy("b",AtStop,BuyPrice); } if MarketPosition == 1 Then { if MarketPosition != MarketPosition[1] Then BuyPrice = 0; ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-8); } if MarketPosition == -1 Then { if MarketPosition != MarketPosition[1] Then SellPrice = 0; ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+8); } } 3 input : StartTime(90000),EndTime(050000); var : Tcond(false),HL(0),LH(0),BuyPrice(0),SellPrice(0); if endtime > -1 Then { IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } } if endtime > -1 and ((sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime)) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; IF Endtime > -1 and Endtime <= starttime Then { SetStopEndofday(0); } } if H == DayHigh Then { HL = H; Condition1 = False; } Else { if L < HL Then { HL = L; if Condition1 == False and HL <= DayHigh-8 Then { Condition1 = true; BuyPrice = DayHigh+0.1; } } } if L == DayLow Then { LH = L; Condition2 = False; } Else { if H > LH Then { LH = H; if Condition2 == False and LH >= DayLow+8 Then { Condition2 = true; SellPrice = DayLow-0.1; } } } if Tcond == true Then { if MarketPosition >= 0 and L > SellPrice and SellPrice > 0 Then { Sell("s",AtStop,SellPrice); } if MarketPosition <= 0 and H < BuyPrice and BuyPrice > 0 Then { Buy("b",AtStop,BuyPrice); } if MarketPosition == 1 Then { if MarketPosition != MarketPosition[1] Then BuyPrice = 0; ExitLong("bx1",AtLimit,EntryPrice+16); ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-8); } if MarketPosition == -1 Then { if MarketPosition != MarketPosition[1] Then SellPrice = 0; ExitShort("sx1",AtLimit,EntryPrice-16); ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+8); } } 즐거운 하루되세요 > 나스닥에센피 님이 쓴 글입니다. > 제목 : 친절한 답변에 감사드리며, 추가문의입니다. > 올려주신 수식중 '신호1'을 복사하여 매매신호를 만들어서 적용해보니 매매신호가 표시가 안되고(그림2에서 처럼 3분봉 기준으로 할 경우 최근 기준 4.21일 17:33분 매도, 4.22일 03:45분 매수, 4.22일 15:03분 매수 등) 해서 시스템 성능보고서가 공란으로 나오고 있는데 이건 왜 그럴까요? 그리고 한가지 더 문의합니다. 당일청산을 하지 않고 오버나이트할 경우 Endtime을 -1로 지정하듯이 "StartTime(90000)"은 그냥 그대로 두어도 될런지요? 항상 친절한 답변 감사합니다. > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 수식 작성 부탁드립니다. 미리 감사드립니다. > 안녕하세요 예스스탁입니다. 당일청산을 안하시려면 Endtime을 -1로 지정하시면 됩니다. 1 input : StartTime(90000),EndTime(050000); var : Tcond(false); if endtime > -1 Then { IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } } if endtime > -1 and ((sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime)) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; IF Endtime > -1 and Endtime <= starttime Then { SetStopEndofday(0); } } if Tcond == true Then { if MarketPosition <= 0 and C >= C[1]+8 Then { Sell("s",AtStop,C[1]-0.1); } if MarketPosition >= 0 and C <= C[1]-8 Then { Buy("b",AtStop,C[1]+0.1); } if MarketPosition == 1 Then { ExitLong("bx1",AtLimit,EntryPrice+8); ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-8); } if MarketPosition == -1 Then { ExitShort("sx1",AtLimit,EntryPrice-8); ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+8); } } 2 input : StartTime(90000),EndTime(050000); var : Tcond(false); if endtime > -1 Then { IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } } if endtime > -1 and ((sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime)) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; IF Endtime > -1 and Endtime <= starttime Then { SetStopEndofday(0); } } if Tcond == true Then { if MarketPosition <= 0 and C >= C[1]+8 Then { Sell("s",AtStop,C[1]-0.1); } if MarketPosition >= 0 and C <= C[1]-8 Then { Buy("b",AtStop,C[1]+0.1); } if MarketPosition == 1 Then { ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-8); } if MarketPosition == -1 Then { ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+8); } } 3 input : StartTime(90000),EndTime(050000); var : Tcond(false); if endtime > -1 Then { IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } } if endtime > -1 and ((sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime)) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; IF Endtime > -1 and Endtime <= starttime Then { SetStopEndofday(0); } } if Tcond == true Then { if MarketPosition <= 0 and C >= C[1]+8 Then { Sell("s",AtStop,C[1]-0.1); } if MarketPosition >= 0 and C <= C[1]-8 Then { Buy("b",AtStop,C[1]+0.1); } if MarketPosition == 1 Then { ExitLong("bx1",AtLimit,EntryPrice+16); ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-8); } if MarketPosition == -1 Then { ExitShort("sx1",AtLimit,EntryPrice-16); ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+8); } } 즐거운 하루되세요 > 나스닥에센피 님이 쓴 글입니다. > 제목 : 수식 작성 부탁드립니다. 미리 감사드립니다. > 일전에도 시스템 수식을 만들어 주셔서 잘 사용하고 있는데, 이번에 새로운 시스템을 만들게 되어 다시 한번 수식작성을 부탁드립니다. 추세추종 시스템인데요. 리버스 시스템은 아닙니다. 일단 매번 일정 포인트 이상의 등락이 있는 경우, 여기선 예를 들어 골드로 가정하여 이전 저점과 고점에서 8.0 이상의 등락(기준 등락)이 있는 경우만 시세를 체크합니다. 첨부파일 셋째 행에서 4.19일 전저점대비로 기준등락(8.0)보다 약간 큰 9.5가 올라 1985.1 이 되었고, 이후 25.6 하락하여 1959.5 가 되는데, 이 하락시 이전 상승폭보다 0.1만큼 더 하락한 지점인 1975.5(직전 고점대비 9.6 하락)에서 즉시 매도 진입.. 즉, 이 경우 하락이 이전 상승폭인 9.5 보다 적은 상황에서 이후 8.0 이상 올랐다면 신호가 없게 됩니다. 즉 절대값 기준 등락폭이 이전 등락폭보다 적으면 기준등락 이상 움직이더라도 계속 신호가 없게 됩니다. 진입은 이런 식으로 하고, 청산은 세가지(진입은 세가지 모두 동일) 방법이 있는데요. 신호1은 진입후 8.0 수익지점에서 청산하거나, 8.0 수익지점에 미달후 되돌림하면 8.0 되돌림 수준에서 청산하고 다음 신호를 기다립니다. 신호2는 진입후 갈 때까지 가는 걸 보고 트레일링스탑으로 8.0 되돌림 수준에서 청산하고 역시 다음 신호를 기다리게 됩니다. 신호3은 최대이익을 설정(여기서는 16.0)하여 최대이익 도달지점에서 청산하거나, 최대이익 포인트에 미달후 되돌림하면 신호2와 같은 방식으로 8.0 되돌림 수준에서 청산하고 다음 신호가 나올 때까지 기다립니다. 이렇게 신호가 3 개인 셈인데, 각각 따로 만들어주셨으면 합니다. 고저가/등락폭은 전날로부터 이어지는 개념으로 하되, 시스템 오픈하는 시간은 9시로 하여 연결개념에서 매매신호가 아직 없다면 신호를 기다리고, 전날과 연결하여 이미 매수(/매도)신호 상태면 9시에 매수(/매도)로 진입 후 이후엔 매매신호를 따라가고, 일중 거래 종결(포지션 청산)시간은 현물 마감시간인 새벽 5시에 하고자 합니다. <추가질문입니다: 4.22일 11시40분> 일중 거래 청산을 하지 않고 오버나이트할 수 있게 하려면 시간설정을 어떻게 해야 하는지요? 이상인데요. 미리 감사드리며 모두 즐거운 주말 되세요^^
프로필 이미지

나스닥에센피

2022-04-22 18:49:03

친절하신 설명에 깊이 감사드립니다. 적용해보니 신호가 잘 나옵니다. 즐거운 주말 되세요. > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 친절한 답변에 감사드리며, 추가문의입니다. > 안녕하세요 예스스탁입니다. 1 input : StartTime(90000),EndTime(050000); var : Tcond(false),HL(0),LH(0),BuyPrice(0),SellPrice(0); if endtime > -1 Then { IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } } if endtime > -1 and ((sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime)) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; IF Endtime > -1 and Endtime <= starttime Then { SetStopEndofday(0); } } if H == DayHigh Then { HL = H; Condition1 = False; } Else { if L < HL Then { HL = L; if Condition1 == False and HL <= DayHigh-8 Then { Condition1 = true; BuyPrice = DayHigh+0.1; } } } if L == DayLow Then { LH = L; Condition2 = False; } Else { if H > LH Then { LH = H; if Condition2 == False and LH >= DayLow+8 Then { Condition2 = true; SellPrice = DayLow-0.1; } } } if Tcond == true Then { if MarketPosition >= 0 and L > SellPrice and SellPrice > 0 Then { Sell("s",AtStop,SellPrice); } if MarketPosition <= 0 and H < BuyPrice and BuyPrice > 0 Then { Buy("b",AtStop,BuyPrice); } if MarketPosition == 1 Then { if MarketPosition != MarketPosition[1] Then BuyPrice = 0; ExitLong("bx1",AtLimit,EntryPrice+8); ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-8); } if MarketPosition == -1 Then { if MarketPosition != MarketPosition[1] Then SellPrice = 0; ExitShort("sx1",AtLimit,EntryPrice-8); ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+8); } } 2 input : StartTime(90000),EndTime(050000); var : Tcond(false),HL(0),LH(0),BuyPrice(0),SellPrice(0); if endtime > -1 Then { IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } } if endtime > -1 and ((sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime)) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; IF Endtime > -1 and Endtime <= starttime Then { SetStopEndofday(0); } } if H == DayHigh Then { HL = H; Condition1 = False; } Else { if L < HL Then { HL = L; if Condition1 == False and HL <= DayHigh-8 Then { Condition1 = true; BuyPrice = DayHigh+0.1; } } } if L == DayLow Then { LH = L; Condition2 = False; } Else { if H > LH Then { LH = H; if Condition2 == False and LH >= DayLow+8 Then { Condition2 = true; SellPrice = DayLow-0.1; } } } if Tcond == true Then { if MarketPosition >= 0 and L > SellPrice and SellPrice > 0 Then { Sell("s",AtStop,SellPrice); } if MarketPosition <= 0 and H < BuyPrice and BuyPrice > 0 Then { Buy("b",AtStop,BuyPrice); } if MarketPosition == 1 Then { if MarketPosition != MarketPosition[1] Then BuyPrice = 0; ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-8); } if MarketPosition == -1 Then { if MarketPosition != MarketPosition[1] Then SellPrice = 0; ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+8); } } 3 input : StartTime(90000),EndTime(050000); var : Tcond(false),HL(0),LH(0),BuyPrice(0),SellPrice(0); if endtime > -1 Then { IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } } if endtime > -1 and ((sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime)) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; IF Endtime > -1 and Endtime <= starttime Then { SetStopEndofday(0); } } if H == DayHigh Then { HL = H; Condition1 = False; } Else { if L < HL Then { HL = L; if Condition1 == False and HL <= DayHigh-8 Then { Condition1 = true; BuyPrice = DayHigh+0.1; } } } if L == DayLow Then { LH = L; Condition2 = False; } Else { if H > LH Then { LH = H; if Condition2 == False and LH >= DayLow+8 Then { Condition2 = true; SellPrice = DayLow-0.1; } } } if Tcond == true Then { if MarketPosition >= 0 and L > SellPrice and SellPrice > 0 Then { Sell("s",AtStop,SellPrice); } if MarketPosition <= 0 and H < BuyPrice and BuyPrice > 0 Then { Buy("b",AtStop,BuyPrice); } if MarketPosition == 1 Then { if MarketPosition != MarketPosition[1] Then BuyPrice = 0; ExitLong("bx1",AtLimit,EntryPrice+16); ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-8); } if MarketPosition == -1 Then { if MarketPosition != MarketPosition[1] Then SellPrice = 0; ExitShort("sx1",AtLimit,EntryPrice-16); ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+8); } } 즐거운 하루되세요 > 나스닥에센피 님이 쓴 글입니다. > 제목 : 친절한 답변에 감사드리며, 추가문의입니다. > 올려주신 수식중 '신호1'을 복사하여 매매신호를 만들어서 적용해보니 매매신호가 표시가 안되고(그림2에서 처럼 3분봉 기준으로 할 경우 최근 기준 4.21일 17:33분 매도, 4.22일 03:45분 매수, 4.22일 15:03분 매수 등) 해서 시스템 성능보고서가 공란으로 나오고 있는데 이건 왜 그럴까요? 그리고 한가지 더 문의합니다. 당일청산을 하지 않고 오버나이트할 경우 Endtime을 -1로 지정하듯이 "StartTime(90000)"은 그냥 그대로 두어도 될런지요? 항상 친절한 답변 감사합니다. > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 수식 작성 부탁드립니다. 미리 감사드립니다. > 안녕하세요 예스스탁입니다. 당일청산을 안하시려면 Endtime을 -1로 지정하시면 됩니다. 1 input : StartTime(90000),EndTime(050000); var : Tcond(false); if endtime > -1 Then { IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } } if endtime > -1 and ((sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime)) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; IF Endtime > -1 and Endtime <= starttime Then { SetStopEndofday(0); } } if Tcond == true Then { if MarketPosition <= 0 and C >= C[1]+8 Then { Sell("s",AtStop,C[1]-0.1); } if MarketPosition >= 0 and C <= C[1]-8 Then { Buy("b",AtStop,C[1]+0.1); } if MarketPosition == 1 Then { ExitLong("bx1",AtLimit,EntryPrice+8); ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-8); } if MarketPosition == -1 Then { ExitShort("sx1",AtLimit,EntryPrice-8); ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+8); } } 2 input : StartTime(90000),EndTime(050000); var : Tcond(false); if endtime > -1 Then { IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } } if endtime > -1 and ((sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime)) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; IF Endtime > -1 and Endtime <= starttime Then { SetStopEndofday(0); } } if Tcond == true Then { if MarketPosition <= 0 and C >= C[1]+8 Then { Sell("s",AtStop,C[1]-0.1); } if MarketPosition >= 0 and C <= C[1]-8 Then { Buy("b",AtStop,C[1]+0.1); } if MarketPosition == 1 Then { ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-8); } if MarketPosition == -1 Then { ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+8); } } 3 input : StartTime(90000),EndTime(050000); var : Tcond(false); if endtime > -1 Then { IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } } if endtime > -1 and ((sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime)) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; IF Endtime > -1 and Endtime <= starttime Then { SetStopEndofday(0); } } if Tcond == true Then { if MarketPosition <= 0 and C >= C[1]+8 Then { Sell("s",AtStop,C[1]-0.1); } if MarketPosition >= 0 and C <= C[1]-8 Then { Buy("b",AtStop,C[1]+0.1); } if MarketPosition == 1 Then { ExitLong("bx1",AtLimit,EntryPrice+16); ExitLong("bx2",AtStop,Highest(H,BarsSinceEntry)-8); } if MarketPosition == -1 Then { ExitShort("sx1",AtLimit,EntryPrice-16); ExitShort("sx2",AtStop,Lowest(L,BarsSinceEntry)+8); } } 즐거운 하루되세요 > 나스닥에센피 님이 쓴 글입니다. > 제목 : 수식 작성 부탁드립니다. 미리 감사드립니다. > 일전에도 시스템 수식을 만들어 주셔서 잘 사용하고 있는데, 이번에 새로운 시스템을 만들게 되어 다시 한번 수식작성을 부탁드립니다. 추세추종 시스템인데요. 리버스 시스템은 아닙니다. 일단 매번 일정 포인트 이상의 등락이 있는 경우, 여기선 예를 들어 골드로 가정하여 이전 저점과 고점에서 8.0 이상의 등락(기준 등락)이 있는 경우만 시세를 체크합니다. 첨부파일 셋째 행에서 4.19일 전저점대비로 기준등락(8.0)보다 약간 큰 9.5가 올라 1985.1 이 되었고, 이후 25.6 하락하여 1959.5 가 되는데, 이 하락시 이전 상승폭보다 0.1만큼 더 하락한 지점인 1975.5(직전 고점대비 9.6 하락)에서 즉시 매도 진입.. 즉, 이 경우 하락이 이전 상승폭인 9.5 보다 적은 상황에서 이후 8.0 이상 올랐다면 신호가 없게 됩니다. 즉 절대값 기준 등락폭이 이전 등락폭보다 적으면 기준등락 이상 움직이더라도 계속 신호가 없게 됩니다. 진입은 이런 식으로 하고, 청산은 세가지(진입은 세가지 모두 동일) 방법이 있는데요. 신호1은 진입후 8.0 수익지점에서 청산하거나, 8.0 수익지점에 미달후 되돌림하면 8.0 되돌림 수준에서 청산하고 다음 신호를 기다립니다. 신호2는 진입후 갈 때까지 가는 걸 보고 트레일링스탑으로 8.0 되돌림 수준에서 청산하고 역시 다음 신호를 기다리게 됩니다. 신호3은 최대이익을 설정(여기서는 16.0)하여 최대이익 도달지점에서 청산하거나, 최대이익 포인트에 미달후 되돌림하면 신호2와 같은 방식으로 8.0 되돌림 수준에서 청산하고 다음 신호가 나올 때까지 기다립니다. 이렇게 신호가 3 개인 셈인데, 각각 따로 만들어주셨으면 합니다. 고저가/등락폭은 전날로부터 이어지는 개념으로 하되, 시스템 오픈하는 시간은 9시로 하여 연결개념에서 매매신호가 아직 없다면 신호를 기다리고, 전날과 연결하여 이미 매수(/매도)신호 상태면 9시에 매수(/매도)로 진입 후 이후엔 매매신호를 따라가고, 일중 거래 종결(포지션 청산)시간은 현물 마감시간인 새벽 5시에 하고자 합니다. <추가질문입니다: 4.22일 11시40분> 일중 거래 청산을 하지 않고 오버나이트할 수 있게 하려면 시간설정을 어떻게 해야 하는지요? 이상인데요. 미리 감사드리며 모두 즐거운 주말 되세요^^