커뮤니티

문의 드립니다

프로필 이미지
푸른
2022-12-09 07:29:21
783
글번호 164455
답변완료
input:length(5),a틱(20),b틱(20),c틱(5); Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),Text1(0),process(0),T(0); Array:HH[10,2](0),LL[10,2](0); input : StartTime(100000),EndTime(60000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if (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 <= starttime Then { SetStopEndofday(0); } } process = 0; If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then { If LL[1,1] > L Then process = -1; If HH[1,1] < H Then process = 1; } Else If Highest(H,length) == H and lastHiVal <> H Then process = 1; Else If Lowest(L,length) == L and lastLoVal <> L Then process = -1; If process == 1 Then { T = 1; lastHiVal = H; If HH[1,2] < LL[1,2] Then { For j = 10 DownTo 2 { HH[j,1] = HH[j-1,1]; HH[j,2] = HH[j-1,2]; } } If HH[1,2] < LL[1,2] or HH[1,1] < H Then { HH[1,1] = H; HH[1,2] = Index; sBar = Index - LL[1,2]; eBar = 0; If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { TL_Delete(TL1); Text_Delete(Text1); } if LL[1,1] > 0 Then { TL1 = TL_New(sDate[sBar],sTime[sBar],LL[1,1],sDate[eBar],sTime[eBar],HH[1,1]); Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0)); Text_SetStyle(Text1, 2, 1); } Else { Text_Delete(text1); Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,2)); Text_SetStyle(Text1, 2, 1); } Text_SetStyle(Text1, 2, 1); } if MarketPosition <= 0 and HH[2,1] >= LL[2,1]+PriceScale*a틱 and LL[1,1] <= HH[2,1]-PriceScale*b틱 and Tcond == true Then Buy("b",AtStop,HH[2,1]+PriceScale*c틱); } If process == -1 Then { T = -1; lastLoVal = L; If LL[1,2] < HH[1,2] Then { For j = 10 DownTo 2 { LL[j,1] = LL[j-1,1]; LL[j,2] = LL[j-1,2]; } } If LL[1,2] < HH[1,2] or LL[1,1] > L Then { LL[1,1] = L; LL[1,2] = Index; sBar = Index - HH[1,2]; eBar = 0; If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { TL_Delete(TL1); Text_Delete(Text1); } if HH[1,1] > 0 Then { TL1 = TL_New(sDate[sBar],sTime[sBar],HH[1,1],sDate[eBar],sTime[eBar],LL[1,1]); Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0)); Text_SetStyle(Text1, 2, 0); } Else { Text_Delete(text1); Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0)); Text_SetStyle(Text1, 2, 0); } } if MarketPosition >= 0 and LL[2,1] <= HH[2,1]-PriceScale*a틱 and HH[1,1] >= LL[2,1]+PriceScale*b틱 and Tcond == true Then Sell("s",AtStop,LL[2,1]-PriceScale*c틱); } if MarketPosition == 1 and IsEntryName("b") == true Then Sell("bs",AtStop,EntryPrice-PriceScale*20); if MarketPosition == -1 and IsEntryName("s") == true Then Buy("sb",AtStop,EntryPrice+PriceScale*20); 해외선물에서 밤 12시 지나서 급격한 변동성에는 강제청산의 손절매신호가 작동하지 않아서 위 수식어에 익절과 손절의 수식어를 넣고자 하는데 아래 내용이 맞는지 문의 드립니다. input:length(5),a틱(20),b틱(20),c틱(5); input : 익절틱수(30),손절틱수(30); Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),Text1(0),process(0),T(0); Array:HH[10,2](0),LL[10,2](0); input : StartTime(100000),EndTime(60000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if (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 <= starttime Then { SetStopEndofday(0); } } process = 0; If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then { If LL[1,1] > L Then process = -1; If HH[1,1] < H Then process = 1; } Else If Highest(H,length) == H and lastHiVal <> H Then process = 1; Else If Lowest(L,length) == L and lastLoVal <> L Then process = -1; If process == 1 Then { T = 1; lastHiVal = H; If HH[1,2] < LL[1,2] Then { For j = 10 DownTo 2 { HH[j,1] = HH[j-1,1]; HH[j,2] = HH[j-1,2]; } } If HH[1,2] < LL[1,2] or HH[1,1] < H Then { HH[1,1] = H; HH[1,2] = Index; sBar = Index - LL[1,2]; eBar = 0; If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { TL_Delete(TL1); Text_Delete(Text1); } if LL[1,1] > 0 Then { TL1 = TL_New(sDate[sBar],sTime[sBar],LL[1,1],sDate[eBar],sTime[eBar],HH[1,1]); Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0)); Text_SetStyle(Text1, 2, 1); } Else { Text_Delete(text1); Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,2)); Text_SetStyle(Text1, 2, 1); } Text_SetStyle(Text1, 2, 1); } if MarketPosition <= 0 and HH[2,1] >= LL[2,1]+PriceScale*a틱 and LL[1,1] <= HH[2,1]-PriceScale*b틱 and Tcond == true Then Buy("b",AtStop,HH[2,1]+PriceScale*c틱); } If process == -1 Then { T = -1; lastLoVal = L; If LL[1,2] < HH[1,2] Then { For j = 10 DownTo 2 { LL[j,1] = LL[j-1,1]; LL[j,2] = LL[j-1,2]; } } If LL[1,2] < HH[1,2] or LL[1,1] > L Then { LL[1,1] = L; LL[1,2] = Index; sBar = Index - HH[1,2]; eBar = 0; If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { TL_Delete(TL1); Text_Delete(Text1); } if HH[1,1] > 0 Then { TL1 = TL_New(sDate[sBar],sTime[sBar],HH[1,1],sDate[eBar],sTime[eBar],LL[1,1]); Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0)); Text_SetStyle(Text1, 2, 0); } Else { Text_Delete(text1); Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0)); Text_SetStyle(Text1, 2, 0); } } if MarketPosition >= 0 and LL[2,1] <= HH[2,1]-PriceScale*a틱 and HH[1,1] >= LL[2,1]+PriceScale*b틱 and Tcond == true Then Sell("s",AtStop,LL[2,1]-PriceScale*c틱); } if MarketPosition == 1 and IsEntryName("b") == true Then Sell("bs",AtStop,EntryPrice-PriceScale*20); if MarketPosition == -1 and IsEntryName("s") == true Then Buy("sb",AtStop,EntryPrice+PriceScale*20); SetStopProfittarget(PriceScale*익절틱수,PointStop); SetStopLoss(PriceScale*손절틱수,PointStop); ---------------- input : n(1),손절틱수(200); var : DD(0),Year(0),V1(0),V2(0),V3(0),V4(0),summer(False); var : ST(0),ET(0),entry(0),Tcond(False); var : cnt(0),hh(0),ll(0); if NextBarSdate != sDate Then { DD = DayOfWeek(NextBarSdate); Year = Floor(NextBarSdate/10000); V1 = (10000 * Year) + (100 * 3) + 1; V2 = 15 - dayofweek(v1); v3 = (10000 * Year) + (100 * 11) + 1; v4 = 8 - dayofweek(v3); Summer = NextBarSdate > (10000 * Year) + (100 * 3) + v2 And NextBarSdate < (10000 * Year) + (100 * 11) + v4; if summer == true Then { ST = 80000; ET = 60000; } Else { ST = 80000; ET = 60000; } } if Year > 0 Then { hh = 0; ll = 0; For cnt = 0 to n-1 { if hh == 0 or (hh > 0 and DayHigh(cnt) > hh) Then hh = DayHigh(cnt); if ll == 0 or (ll > 0 and DayLow(cnt) < ll) Then ll = DayLow(cnt); } IF ET > ST Then SetStopEndofday(ET); Else { if sDate != sDate[1] Then SetStopEndofday(ET); } if ((sDate != sDate[1] and Stime >= ET) or (sDate == sDate[1] and Stime >= ET and sTime < ET)) Then Tcond = False; if Bdate != Bdate[1] Then { Tcond = true; entry = 0; if ST <= ET Then SetStopEndofday(0); } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; if Tcond == true Then { if entry < 1 Then Buy("b",AtLimit,hh-(hh-ll)*0.382); ExitLong("bx",AtLimit,hh-(hh-ll)*0.050); } SetStopLoss(PriceScale*손절틱수,PointStop); } 위는 N일 피보나치 수열에 당일진입및 청산의 수식어 입니다. 당일 장중 피보나치 수열에 고,저대비 아래의 0.382 % 매수후 위 0.959 % 청산되는 수식어로 변경하고자 합니다. 매매시간의 수식어가 국내선물인듯 밤 12시 이후로 신호가 나옵니다. 해이선물로 변경 바라고 매매시간은 아침8시부터 익일 7시까지입니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2022-12-09 09:57:08

안녕하세요 예스스탁입니다. 1 예 맞습니다. 2 매도는 맞지만 매수는 상단기준 0.382입니다. 매수는 하단기준 0.382이므로 아래와 같이 변경하시면 됩니다. Buy("b",AtLimit,LL+(hh-ll)*0.382); 즐거운 하루되세요 > 푸른 님이 쓴 글입니다. > 제목 : 문의 드립니다 > input:length(5),a틱(20),b틱(20),c틱(5); Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),Text1(0),process(0),T(0); Array:HH[10,2](0),LL[10,2](0); input : StartTime(100000),EndTime(60000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if (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 <= starttime Then { SetStopEndofday(0); } } process = 0; If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then { If LL[1,1] > L Then process = -1; If HH[1,1] < H Then process = 1; } Else If Highest(H,length) == H and lastHiVal <> H Then process = 1; Else If Lowest(L,length) == L and lastLoVal <> L Then process = -1; If process == 1 Then { T = 1; lastHiVal = H; If HH[1,2] < LL[1,2] Then { For j = 10 DownTo 2 { HH[j,1] = HH[j-1,1]; HH[j,2] = HH[j-1,2]; } } If HH[1,2] < LL[1,2] or HH[1,1] < H Then { HH[1,1] = H; HH[1,2] = Index; sBar = Index - LL[1,2]; eBar = 0; If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { TL_Delete(TL1); Text_Delete(Text1); } if LL[1,1] > 0 Then { TL1 = TL_New(sDate[sBar],sTime[sBar],LL[1,1],sDate[eBar],sTime[eBar],HH[1,1]); Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0)); Text_SetStyle(Text1, 2, 1); } Else { Text_Delete(text1); Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,2)); Text_SetStyle(Text1, 2, 1); } Text_SetStyle(Text1, 2, 1); } if MarketPosition <= 0 and HH[2,1] >= LL[2,1]+PriceScale*a틱 and LL[1,1] <= HH[2,1]-PriceScale*b틱 and Tcond == true Then Buy("b",AtStop,HH[2,1]+PriceScale*c틱); } If process == -1 Then { T = -1; lastLoVal = L; If LL[1,2] < HH[1,2] Then { For j = 10 DownTo 2 { LL[j,1] = LL[j-1,1]; LL[j,2] = LL[j-1,2]; } } If LL[1,2] < HH[1,2] or LL[1,1] > L Then { LL[1,1] = L; LL[1,2] = Index; sBar = Index - HH[1,2]; eBar = 0; If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { TL_Delete(TL1); Text_Delete(Text1); } if HH[1,1] > 0 Then { TL1 = TL_New(sDate[sBar],sTime[sBar],HH[1,1],sDate[eBar],sTime[eBar],LL[1,1]); Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0)); Text_SetStyle(Text1, 2, 0); } Else { Text_Delete(text1); Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0)); Text_SetStyle(Text1, 2, 0); } } if MarketPosition >= 0 and LL[2,1] <= HH[2,1]-PriceScale*a틱 and HH[1,1] >= LL[2,1]+PriceScale*b틱 and Tcond == true Then Sell("s",AtStop,LL[2,1]-PriceScale*c틱); } if MarketPosition == 1 and IsEntryName("b") == true Then Sell("bs",AtStop,EntryPrice-PriceScale*20); if MarketPosition == -1 and IsEntryName("s") == true Then Buy("sb",AtStop,EntryPrice+PriceScale*20); 해외선물에서 밤 12시 지나서 급격한 변동성에는 강제청산의 손절매신호가 작동하지 않아서 위 수식어에 익절과 손절의 수식어를 넣고자 하는데 아래 내용이 맞는지 문의 드립니다. input:length(5),a틱(20),b틱(20),c틱(5); input : 익절틱수(30),손절틱수(30); Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),Text1(0),process(0),T(0); Array:HH[10,2](0),LL[10,2](0); input : StartTime(100000),EndTime(60000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if (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 <= starttime Then { SetStopEndofday(0); } } process = 0; If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then { If LL[1,1] > L Then process = -1; If HH[1,1] < H Then process = 1; } Else If Highest(H,length) == H and lastHiVal <> H Then process = 1; Else If Lowest(L,length) == L and lastLoVal <> L Then process = -1; If process == 1 Then { T = 1; lastHiVal = H; If HH[1,2] < LL[1,2] Then { For j = 10 DownTo 2 { HH[j,1] = HH[j-1,1]; HH[j,2] = HH[j-1,2]; } } If HH[1,2] < LL[1,2] or HH[1,1] < H Then { HH[1,1] = H; HH[1,2] = Index; sBar = Index - LL[1,2]; eBar = 0; If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { TL_Delete(TL1); Text_Delete(Text1); } if LL[1,1] > 0 Then { TL1 = TL_New(sDate[sBar],sTime[sBar],LL[1,1],sDate[eBar],sTime[eBar],HH[1,1]); Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0)); Text_SetStyle(Text1, 2, 1); } Else { Text_Delete(text1); Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,2)); Text_SetStyle(Text1, 2, 1); } Text_SetStyle(Text1, 2, 1); } if MarketPosition <= 0 and HH[2,1] >= LL[2,1]+PriceScale*a틱 and LL[1,1] <= HH[2,1]-PriceScale*b틱 and Tcond == true Then Buy("b",AtStop,HH[2,1]+PriceScale*c틱); } If process == -1 Then { T = -1; lastLoVal = L; If LL[1,2] < HH[1,2] Then { For j = 10 DownTo 2 { LL[j,1] = LL[j-1,1]; LL[j,2] = LL[j-1,2]; } } If LL[1,2] < HH[1,2] or LL[1,1] > L Then { LL[1,1] = L; LL[1,2] = Index; sBar = Index - HH[1,2]; eBar = 0; If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { TL_Delete(TL1); Text_Delete(Text1); } if HH[1,1] > 0 Then { TL1 = TL_New(sDate[sBar],sTime[sBar],HH[1,1],sDate[eBar],sTime[eBar],LL[1,1]); Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0)); Text_SetStyle(Text1, 2, 0); } Else { Text_Delete(text1); Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0)); Text_SetStyle(Text1, 2, 0); } } if MarketPosition >= 0 and LL[2,1] <= HH[2,1]-PriceScale*a틱 and HH[1,1] >= LL[2,1]+PriceScale*b틱 and Tcond == true Then Sell("s",AtStop,LL[2,1]-PriceScale*c틱); } if MarketPosition == 1 and IsEntryName("b") == true Then Sell("bs",AtStop,EntryPrice-PriceScale*20); if MarketPosition == -1 and IsEntryName("s") == true Then Buy("sb",AtStop,EntryPrice+PriceScale*20); SetStopProfittarget(PriceScale*익절틱수,PointStop); SetStopLoss(PriceScale*손절틱수,PointStop); ---------------- input : n(1),손절틱수(200); var : DD(0),Year(0),V1(0),V2(0),V3(0),V4(0),summer(False); var : ST(0),ET(0),entry(0),Tcond(False); var : cnt(0),hh(0),ll(0); if NextBarSdate != sDate Then { DD = DayOfWeek(NextBarSdate); Year = Floor(NextBarSdate/10000); V1 = (10000 * Year) + (100 * 3) + 1; V2 = 15 - dayofweek(v1); v3 = (10000 * Year) + (100 * 11) + 1; v4 = 8 - dayofweek(v3); Summer = NextBarSdate > (10000 * Year) + (100 * 3) + v2 And NextBarSdate < (10000 * Year) + (100 * 11) + v4; if summer == true Then { ST = 80000; ET = 60000; } Else { ST = 80000; ET = 60000; } } if Year > 0 Then { hh = 0; ll = 0; For cnt = 0 to n-1 { if hh == 0 or (hh > 0 and DayHigh(cnt) > hh) Then hh = DayHigh(cnt); if ll == 0 or (ll > 0 and DayLow(cnt) < ll) Then ll = DayLow(cnt); } IF ET > ST Then SetStopEndofday(ET); Else { if sDate != sDate[1] Then SetStopEndofday(ET); } if ((sDate != sDate[1] and Stime >= ET) or (sDate == sDate[1] and Stime >= ET and sTime < ET)) Then Tcond = False; if Bdate != Bdate[1] Then { Tcond = true; entry = 0; if ST <= ET Then SetStopEndofday(0); } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; if Tcond == true Then { if entry < 1 Then Buy("b",AtLimit,hh-(hh-ll)*0.382); ExitLong("bx",AtLimit,hh-(hh-ll)*0.050); } SetStopLoss(PriceScale*손절틱수,PointStop); } 위는 N일 피보나치 수열에 당일진입및 청산의 수식어 입니다. 당일 장중 피보나치 수열에 고,저대비 아래의 0.382 % 매수후 위 0.959 % 청산되는 수식어로 변경하고자 합니다. 매매시간의 수식어가 국내선물인듯 밤 12시 이후로 신호가 나옵니다. 해이선물로 변경 바라고 매매시간은 아침8시부터 익일 7시까지입니다.