커뮤니티

예스랭귀지 Q&A

글쓰기

와우리 님에 의해서 삭제되었습니다.

프로필 이미지
와우리
2025-05-21
51
글번호 191035
지표

사공하늘 님에 의해서 삭제되었습니다.

프로필 이미지
사공하늘
2025-05-21
74
글번호 191029
검색
답변완료

문의드립니다.

안녕하세요 항상 감사드립니다. 아래의 서식에서 추가적인 서식을 부탁드립니다. *추가사항 1.전일 대비 갭상승(하락)시 진입 금지. 갭의 값은 3pt로 해주시고, 추후 최적화를 하여 결정할 예정입니다. 최적화를 할 수 있도록 input으로 넣어주시기 바랍니다. # KOSPI 선물 10분봉 input: tt(150000),당일진입횟수(3); var: chkP(10), reChkP(20), stopChk(25); var: HH(0), LL(0), BS(0), SS(0); var: dayChk(0); var : TotalCount(0),PreDay(0),DayEntry(0); TotalCount = TotalTrades; if Bdate != Bdate[1] Then PreDay = TotalCount[1]; DayEntry = (TotalCount-PreDay)+IFF(MarketPosition != 0,1,0); if BarIndex == 0 then ClearDebug(); if dayindex == chkP then { HH = Highest(Max(C,O), chkP+1); LL = Lowest(Min(C,O), chkP+1); #if date == 20240612 then messageLog("--HH %.2f, LL: %.2f", HH, LL); } #if High >= HH and MarketPosition == 0 and ExitDate(1) < Date and time > 93000 then messageLog("HH %.2f, High: %.2f", HH, High); if DayIndex >= chkP # and Time < 95000 and sDate == NextBarSdate and EntryDate(0) < Date and EntryDate(1) < Date and DayEntry < 당일진입횟수 Then { Buy("B1", AtStop, HH); Sell("S1", AtStop, LL); } //if dayChk == 0 and High >= HH and MarketPosition == 0 and ExitDate(1) < Date and time > 93000 then { // messageLog("HH %.2f, High: %.2f", HH, High); // dayChk = 1; //} if ExitDate(1) == Date and Time < 150000 // and LatestEntryName(1) != "B2" // and LatestEntryName(1) != "S2" // and LatestEntryName(0) != "B2" // and LatestEntryName(0) != "S2" Then { if DayIndex < reChkP Then { HH = Highest(Max(C,O), DayIndex+1); LL = Lowest(Min(C,O), DayIndex+1); } Else { HH = Highest(Max(C,O), reChkP); LL = Lowest(Min(C,O), reChkP); } if DayEntry < 당일진입횟수 Then { Buy("B2", AtStop, HH); Sell("S2", AtStop, LL); } } if (MarketPosition == 1) Then { if DayIndex < stopChk Then { BS = Lowest(Min(C,O), DayIndex+1); } Else { BS = Lowest(Min(C,O), stopChk); } ExitLong("EL", AtStop, BS); } if (MarketPosition == -1) Then { if DayIndex < stopChk Then { SS = Highest(Max(C,O), DayIndex+1); } Else { SS = Highest(Max(C,O), stopChk); } #messageLog(" SS %.2f", SS); ExitShort("ES", AtStop, SS); } var : month(0),nday(0),week(0),X(False); month = int(date/100)-int(date/10000)*100; nday = date - int(date/100)*100; Week = DayOfWeek(date); #만기일 if (month%3 == 0 and nday >= 8 and nday <= 14 and week == 4) then { X = true; SetStopEndofday(151500); } Else#만기일아닐때 { X = False; SetStopEndofday(152000); }
프로필 이미지
가자아이
2025-05-21
259
글번호 191028
지표
답변완료

감사합니다 지표 변환 부탁드립니다

// INPUT SETTINGS period = input.int(10, "Period", minval=2) color lineUpColor = input(title="Color ↑", defval=#6ba583, inline="lines", group="&#9830;&#65038; lines") color lineDnColor = input(title="↓", defval=#d75442, inline="lines", group="&#9830;&#65038; lines") lw = input.int(2, "Width", [1, 2, 3, 4], inline="lines", group="&#9830;&#65038; lines") bool rangeLines = input.bool(true, "Range Lines", inline = 'rangelines', group = "&#9830;&#65038; lines") color rnglineColor = input(title="", defval=#000000, inline="rangelines", group="&#9830;&#65038; lines") //bool rnglineextend = input.bool(false, "Extend", inline = 'rangelines', group = "lines") delta = input.string('Percent', '&#120607; Format', options = [ 'Percent', 'Absolute'], group = '&#9830;&#65038; labels', inline = 'st') txtsz = input.string("Small", title="Text Size", options=["Tiny", "Small", "Normal", "Large", "Huge"], group = "&#9830;&#65038; labels", inline = 'st') bool cyclelab = input.bool(false, "Display Cycle", "Add Highs/Lows Cycle to the labels", group = "&#9830;&#65038; labels") showtable = input.bool(true, 'Show Stats table', group = '&#9830;&#65038; statistics table') locationtable = input.string('Top Right', 'Location', ['Top Right','Top Left', 'Bottom Right', 'Bottom Left'], group = '&#9830;&#65038; statistics table', inline = 'tbpr') sizetable = input.string('Normal', 'Size', ['Large', 'Normal', 'Small', 'Tiny'], group = '&#9830;&#65038; statistics table', inline = 'tbpr') avgln = input.int(10, "Averaging", minval=2, step=1, tooltip="Number of past occurrences to average", group = '&#9830;&#65038; statistics table') ts = txtsz == "Tiny" ? size.tiny :txtsz == "Small" ? size.small :txtsz == "Normal" ? size.normal:txtsz == "Large" ? size.large : size.huge // Variables { // LAST SWING TYPE var string lastSwingType = "" // SWING HIGHS var float[] swingHighValues = array.new_float(0) var int[] swingHighBarIndexes = array.new_int(0) var label[] swingHighLabels = array.new_label(0) // SWING LOWS var float[] swingLowValues = array.new_float(0) var int[] swingLowBarIndexes = array.new_int(0) var label[] swingLowLabels = array.new_label(0) // LINES var line[] highToHighLines = array.new_line(0) var line[] lowToLowLines = array.new_line(0) var line[] bullishLines = array.new_line(0) var line[] bearishLines = array.new_line(0) // STS var float[] highToHighPriceDiffs = array.new_float(0) var int[] highToHighTimeDiffs = array.new_int(0) var float[] lowToLowPriceDiffs = array.new_float(0) var int[] lowToLowTimeDiffs = array.new_int(0) var float[] bullishPriceDiffs = array.new_float(0) var float[] bullishPrcDiffs = array.new_float(0) var int[] bullishTimeDiffs = array.new_int(0) var float[] bearishPriceDiffs = array.new_float(0) var float[] bearishPrcDiffs = array.new_float(0) var int[] bearishTimeDiffs = array.new_int(0) //} pH = high == ta.highest(high, period) ? high : na pL = low == ta.lowest(low, period) ? low : na // Adds a new swing high point, calculates differences (same-type and cross-type), creates a label, and draws connecting lines{ f_addHighSwingPoint(highValue, barIndex) => // Calculate opposite-type differences (with most recent low) oppPriceDiff = (array.size(swingLowValues) > 0) ? highValue - array.get(swingLowValues, 0) : 0.0 oppPctDiff = (array.size(swingLowValues) > 0) ? oppPriceDiff / array.get(swingLowValues, 0) * 100 : 0.0 oppTimeDiff = (array.size(swingLowBarIndexes) > 0) ? barIndex - array.get(swingLowBarIndexes, 0) : 0 // Calculate same-type differences (with previous high) samePriceDiff = (array.size(swingHighValues) > 0) ? highValue - array.get(swingHighValues, 0) : 0.0 sameTimeDiff = (array.size(swingHighBarIndexes) > 0) ? barIndex - array.get(swingHighBarIndexes, 0) : 0 patternH = "" if array.size(swingHighValues) > 0 patternH := (highValue > array.get(swingHighValues, 0)) ? "&#668;&#668;" : "&#671;&#668;" labelText = "" if array.size(swingLowValues) > 0 textx = delta=="Percent"?(str.tostring(oppPctDiff, format.percent)):str.tostring(oppPriceDiff, "#.##") labelText := str.tostring(patternH) + "₩n+" + textx + "₩n&#9201;" + str.tostring(oppTimeDiff) //"L↑H " + str.tostring(oppPriceDiff, "#.##") if array.size(swingHighValues) > 0 and cyclelab labelText := labelText + "₩n&#668;&#618;&#610;&#668; &#7428;&#655;&#7428;&#671;&#7431;₩n" + "&#9201;" + str.tostring(sameTimeDiff) //+ str.tostring(samePriceDiff, "#.##") // Create label at swing high point newLabel = label.new(barIndex, highValue, labelText, textcolor = #6ba583, style=label.style_label_down, color=color.new(#000000, 100), size=ts, text_formatting = text.format_bold) // Store swing high data array.unshift(swingHighValues, highValue) array.unshift(swingHighBarIndexes, barIndex) array.unshift(swingHighLabels, newLabel) // Draw lin connection betwn cons swing highs // if previous high exists if array.size(swingHighValues) > 1 prevBar = array.get(swingHighBarIndexes, 1) prevValue = array.get(swingHighValues, 1) newLine = rangeLines?line.new(prevBar, prevValue, barIndex, highValue, color=rnglineColor, width=1, style = line.style_solid):na array.unshift(highToHighLines, newLine) // Calculate and store differences for this high-to-high line priceDiff = highValue - prevValue timeDiff = barIndex - prevBar array.unshift(highToHighPriceDiffs, priceDiff) array.unshift(highToHighTimeDiffs, timeDiff) // Draw bullish line if the last swing was // (from a low to this high) if array.size(swingLowValues) > 0 and lastSwingType != "high" prevLowBar = array.get(swingLowBarIndexes, 0) prevLowValue = array.get(swingLowValues, 0) newBullishLine = line.new(prevLowBar, prevLowValue, barIndex, highValue, color=lineUpColor, width=lw, style = line.style_solid) array.unshift(bullishLines, newBullishLine) bullishPdiff = highValue - prevLowValue bullishTdiff = barIndex - prevLowBar array.unshift(bullishPriceDiffs, bullishPdiff) array.unshift(bullishPrcDiffs, oppPctDiff) array.unshift(bullishTimeDiffs, bullishTdiff) //} // 업데이트 the current swing high point // if a new candidate is more extreme, recalculates differences, // 업데이트 the label text, and 업데이트 connecting lines{ f_업데이트HighSwingPoint(highValue, barIndex) => if highValue > array.get(swingHighValues, 0) array.set(swingHighValues, 0, highValue) array.set(swingHighBarIndexes, 0, barIndex) oppPriceDiff = (array.size(swingLowValues) > 0) ? highValue - array.get(swingLowValues, 0) : 0.0 oppPctDiff = (array.size(swingLowValues) > 0) ? oppPriceDiff / array.get(swingLowValues, 0) * 100 : 0.0 oppTimeDiff = (array.size(swingLowBarIndexes) > 0) ? barIndex - array.get(swingLowBarIndexes, 0) : 0 samePriceDiff = (array.size(swingHighValues) > 1) ? highValue - array.get(swingHighValues, 1) : 0.0 sameTimeDiff = (array.size(swingHighBarIndexes) > 1) ? barIndex - array.get(swingHighBarIndexes, 1) : 0 labelText = "" patternH = "" if array.size(swingHighValues) > 1 patternH := (highValue > array.get(swingHighValues, 1)) ? "&#668;&#668;" : "&#671;&#668;" if array.size(swingLowValues) > 0 textx = delta=="Percent"?(str.tostring(oppPctDiff, format.percent)):str.tostring(oppPriceDiff, "#.##") labelText := str.tostring(patternH) + "₩n+"+ textx + "₩n&#9201;" + str.tostring(oppTimeDiff) //+ str.tostring(oppPriceDiff, "#.##") if array.size(swingHighValues) > 1 and cyclelab labelText := labelText + "₩n&#668;&#618;&#610;&#668; &#7428;&#655;&#7428;&#671;&#7431;₩n" + "&#9201;" + str.tostring(sameTimeDiff) //str.tostring(samePriceDiff, "#.##") + // 업데이트 label for current swing high lbl = array.get(swingHighLabels, 0) label.set_xy(lbl, barIndex, highValue) label.set_text(lbl, labelText) // 업데이트 high-to-high connection if it exists if array.size(swingHighValues) > 1 and array.size(highToHighLines) > 0 prevBar = array.get(swingHighBarIndexes, 1) prevValue = array.get(swingHighValues, 1) line.set_xy1(array.get(highToHighLines, 0), array.get(swingHighBarIndexes, 1), array.get(swingHighValues, 1)) line.set_xy2(array.get(highToHighLines, 0), barIndex, highValue) // Upd stored diffs for high-to-high connection array.set(highToHighPriceDiffs, 0, highValue - prevValue) array.set(highToHighTimeDiffs, 0, barIndex - prevBar) // Upd bullish connection if array.size(swingLowValues) > 0 and array.size(bullishLines) > 0 prevLowBar = array.get(swingLowBarIndexes, 0) prevLowValue = array.get(swingLowValues, 0) line.set_xy1(array.get(bullishLines, 0), prevLowBar, prevLowValue) line.set_xy2(array.get(bullishLines, 0), barIndex, highValue) array.set(bullishPriceDiffs, 0, highValue - prevLowValue) array.set(bullishPrcDiffs, 0, (highValue - prevLowValue)/prevLowValue * 100) array.set(bullishTimeDiffs, 0, barIndex - prevLowBar) 0. //} // Adds a new swing low point, calculates differences (same-type and cross-type),creates a label, and draws connecting lines{ f_addLowSwingPoint(lowValue, barIndex) => // Calculate opposite-type differences (with most recent high) oppPriceDiff = (array.size(swingHighValues) > 0) ? lowValue - array.get(swingHighValues, 0) : 0.0 oppPctDiff = (array.size(swingHighValues) > 0) ? oppPriceDiff / array.get(swingHighValues, 0) * 100 : 0.0 oppTimeDiff = (array.size(swingHighBarIndexes) > 0) ? barIndex - array.get(swingHighBarIndexes, 0) : 0 // Calculate same-type differences (with previous low) samePriceDiff = (array.size(swingLowValues) > 0) ? lowValue - array.get(swingLowValues, 0) : 0.0 sameTimeDiff = (array.size(swingLowBarIndexes) > 0) ? barIndex - array.get(swingLowBarIndexes, 0) : 0 labelText = "" patternL = "" if array.size(swingLowValues) > 0 patternL := (lowValue < array.get(swingLowValues, 0)) ? "&#671;&#671;" : "&#668;&#671;" if array.size(swingHighValues) > 0 textx = delta=="Percent"?(str.tostring(oppPctDiff, format.percent)):str.tostring(oppPriceDiff, "#.##") labelText := str.tostring(patternL) + "₩n" + textx + "₩n&#9201;" + str.tostring(oppTimeDiff) //"H↓L "+ str.tostring(oppPriceDiff, "#.##") if array.size(swingLowValues) > 0 and cyclelab labelText := labelText + "₩n&#671;&#7439;&#7457; &#7428;&#655;&#7428;&#671;&#7431;₩n" + "&#9201;" + str.tostring(sameTimeDiff) //+ str.tostring(samePriceDiff, "#.##") // Create label at swing low point newLabel = label.new(barIndex, lowValue, labelText, textcolor = #d75442, style=label.style_label_up, color=color.new(#000000, 100), size=ts, text_formatting = text.format_bold) // Store swing low data array.unshift(swingLowValues, lowValue) array.unshift(swingLowBarIndexes, barIndex) array.unshift(swingLowLabels, newLabel) // connection line betwn consecutive swing lows if array.size(swingLowValues) > 1 prevBar = array.get(swingLowBarIndexes, 1) prevValue = array.get(swingLowValues, 1) newLine = rangeLines?line.new(prevBar, prevValue, barIndex, lowValue, color=rnglineColor, width=1, style = line.style_solid):na array.unshift(lowToLowLines, newLine) // Calculate and store differences for this low-to-low line priceDiff = lowValue - prevValue timeDiff = barIndex - prevBar array.unshift(lowToLowPriceDiffs, priceDiff) array.unshift(lowToLowTimeDiffs, timeDiff) // Draw bearish line if the last swing was of the opposite type (from a high to this low) if array.size(swingHighValues) > 0 and lastSwingType != "low" prevHighBar = array.get(swingHighBarIndexes, 0) prevHighValue = array.get(swingHighValues, 0) newBearishLine = line.new(prevHighBar, prevHighValue, barIndex, lowValue, color=lineDnColor, width=lw, style = line.style_solid) array.unshift(bearishLines, newBearishLine) bearishPdiff = lowValue - prevHighValue bearishTdiff = barIndex - prevHighBar array.unshift(bearishPriceDiffs, bearishPdiff) array.unshift(bearishPrcDiffs, oppPctDiff) array.unshift(bearishTimeDiffs, bearishTdiff) //} // 업데이트 the current swing low point if a new is more extreme, recalculates differences, 업데이트 the lab text, and connecting lines{ f_업데이트LowSwingPoint(lowValue, barIndex) => if lowValue < array.get(swingLowValues, 0) array.set(swingLowValues, 0, lowValue) array.set(swingLowBarIndexes, 0, barIndex) oppPriceDiff = (array.size(swingHighValues) > 0) ? lowValue - array.get(swingHighValues, 0) : 0.0 oppPctDiff = (array.size(swingHighValues) > 0) ? oppPriceDiff / array.get(swingHighValues, 0) * 100 : 0.0 oppTimeDiff = (array.size(swingHighBarIndexes) > 0) ? barIndex - array.get(swingHighBarIndexes, 0) : 0 samePriceDiff = (array.size(swingLowValues) > 1) ? lowValue - array.get(swingLowValues, 1) : 0.0 sameTimeDiff = (array.size(swingLowBarIndexes) > 1) ? barIndex - array.get(swingLowBarIndexes, 1) : 0 labelText = "" patternL = "" if array.size(swingLowValues) > 1 patternL := (lowValue < array.get(swingLowValues, 1)) ? "&#671;&#671;" : "&#668;&#671;" if array.size(swingHighValues) > 0 textx = delta=="Percent"?(str.tostring(oppPctDiff, format.percent)):str.tostring(oppPriceDiff, "#.##") labelText := str.tostring(patternL)+ "₩n"+ textx + "₩n&#9201;" + str.tostring(oppTimeDiff) //"L↑H "+ str.tostring(oppPriceDiff, "#.##") if array.size(swingLowValues) > 1 and cyclelab labelText := labelText + "₩n&#671;&#7439;&#7457; &#7428;&#655;&#7428;&#671;&#7431;₩n" + "&#9201;" + str.tostring(sameTimeDiff) //+ str.tostring(samePriceDiff, "#.##") // 업데이트 label for current swing low lbl = array.get(swingLowLabels, 0) label.set_xy(lbl, barIndex, lowValue) label.set_text(lbl, labelText) // 업데이트 low-to-low connection if it exists if array.size(swingLowValues) > 1 and array.size(lowToLowLines) > 0 prevBar = array.get(swingLowBarIndexes, 1) prevValue = array.get(swingLowValues, 1) line.set_xy1(array.get(lowToLowLines, 0), prevBar, prevValue) line.set_xy2(array.get(lowToLowLines, 0), barIndex, lowValue) array.set(lowToLowPriceDiffs, 0, lowValue - prevValue) array.set(lowToLowTimeDiffs, 0, barIndex - prevBar) // 업데이트 bearish connection if exists if array.size(swingHighValues) > 0 and array.size(bearishLines) > 0 prevHighBar = array.get(swingHighBarIndexes, 0) prevHighValue = array.get(swingHighValues, 0) line.set_xy1(array.get(bearishLines, 0), prevHighBar, prevHighValue) line.set_xy2(array.get(bearishLines, 0), barIndex, lowValue) array.set(bearishPriceDiffs, 0, lowValue - prevHighValue) array.set(bearishPrcDiffs, 0, (lowValue - prevHighValue)/prevHighValue * 100) array.set(bearishTimeDiffs, 0, barIndex - prevHighBar) 0. //} if array.size(highToHighLines) > 0 and array.size(lowToLowLines) > 0 linefill.new(array.get(highToHighLines, 0), array.get(lowToLowLines, 0), color.rgb(0, 0, 0, 95)) // Process pivs { var int direction = 0 direction := (not na(pH) and na(pL)) ? 1 : (not na(pL) and na(pH)) ? -1 : direction bool directionChanged = direction != nz(direction[1]) bool bullish = direction == 1 bool bearish = direction == -1 bool bull = direction[1]==-1 and direction==1 bool bear = direction[1]==1 and direction==-1 if direction==1 if lastSwingType != "high" f_addHighSwingPoint(pH, bar_index) lastSwingType := "high" else f_업데이트HighSwingPoint(pH, bar_index) if direction==-1 if lastSwingType != "low" f_addLowSwingPoint(pL, bar_index) lastSwingType := "low" else f_업데이트LowSwingPoint(pL, bar_index) //} // Function for geometric averaging { f_geometric_avg(_source, _condition, _length) => var float geom_avg = na var float[] valuesArray = array.new_float() if _condition if _source > 0 array.push(valuesArray, _source) while array.size(valuesArray) > _length array.shift(valuesArray) n = array.size(valuesArray) if n > 0 logSum = 0.0 for val in valuesArray logSum += math.log(val) geom_avg := math.exp(logSum / n) else geom_avg := na geom_avg var float sourcebull = na var float sourcebear = na var int sourcebullt = na var int sourcebeart = na if array.size(bullishPriceDiffs)>0 and array.size(bullishPrcDiffs)>0 sourcebull := delta=="Percent"?array.get(bullishPrcDiffs, 0) : array.get(bullishPriceDiffs, 0) sourcebullt:=array.get(bullishTimeDiffs, 0) conditionbull = lastSwingType=="low" and lastSwingType[1]== "high" rma_valuebull = f_geometric_avg(sourcebull, conditionbull, avgln) rma_valuebullt = f_geometric_avg(sourcebullt, conditionbull, avgln) if array.size(bearishPriceDiffs)>0 and array.size(bearishPrcDiffs)>0 sourcebear := delta=="Percent"?array.get(bearishPrcDiffs, 0) : array.get(bearishPriceDiffs, 0) sourcebeart:=array.get(bearishTimeDiffs, 0) conditionbear = lastSwingType=="high" and lastSwingType[1] == "low" rma_valuebear = f_geometric_avg(math.abs(sourcebear), conditionbear, avgln) rma_timebear = f_geometric_avg(sourcebeart, conditionbear, avgln) //} //Table{ var table_loc = locationtable == 'Top Right' ? position.top_right : locationtable == 'Bottom Right' ? position.bottom_right : locationtable == 'Top Center' ? position.top_center : locationtable == 'Top Left' ? position.top_left : position.bottom_left var table_size = sizetable == 'Large' ? size.large : sizetable == 'Normal' ? size.normal : sizetable == 'Small' ? size.small : size.tiny var table = showtable ? table.new(table_loc, 16, 16, #2a2e39, #1e1e1e, 2, #1f232f, 2) : na table_cell(column, row, txt, signal = false) => table.cell(table, column, row, txt, 0, 0, signal ? #ffffff : #ffffff, text_size = table_size) table_cell_bg(column, row, col) => table.cell_set_bgcolor(table, column, row, col) if barstate.islast and showtable table_cell(0, 0, "STATISTICS TABLE") table_cell(0, 1, "&#610;&#7431;&#7439;&#7437;&#7431;&#7451;&#640;&#618;&#7428;₩n&#7424;&#7456;&#7431;&#640;&#7424;&#610;&#618;&#628;&#610;") table_cell(1, 1, "&#120723; &#7448;&#640;&#618;&#7428;&#7431;") table_cell(2, 1, "&#120723; &#7451;&#618;&#7437;&#7431;") table_cell(0, 2, '&#7452;&#7448;&#7451;&#640;&#7431;&#628;&#7429;') table_cell(0, 3, '&#7429;&#7439;&#7457;&#628;&#7451;&#640;&#7431;&#628;&#7429;') table_cell(1, 2, "+"+str.tostring(rma_valuebull, delta=="Percent"?format.percent:format.mintick)) table_cell(1, 3, "-"+str.tostring(rma_valuebear, delta=="Percent"?format.percent:format.mintick)) table_cell(2, 2, str.tostring(rma_valuebullt, format.mintick)) table_cell(2, 3, str.tostring(rma_timebear, format.mintick)) table.cell_set_text_font_family(table, 0,0, font.family_monospace) table.cell_set_text_formatting(table, 1, 1, text.format_bold) table.cell_set_text_formatting(table, 2, 1, text.format_bold) table.cell_set_text_formatting(table, 0, 2, text.format_bold) table.cell_set_text_formatting(table, 0, 3, text.format_bold) table.cell_set_text_color(table, 0, 1, color.gray) table.cell_set_text_size(table, 0, 1, size.small) table.merge_cells(table, 0,0,2,0) //}
프로필 이미지
갈랑교
2025-05-21
348
글번호 191027
지표
답변완료

부탁드립니다 항상 감사합니다

Input: rsiLen(14), rsiCut(50), macdFastLen(12), macdSlowLen(26), macdSignalLen(9), tp1Ratio(0.995), tp2Ratio(0.990), tp3Ratio(0.985), slRatio(1.01), volumeMultiplier(2.0), 평균거래량기간(20), 시작시간(93000), 종료시간(150000); Var: rsiVal(0), macdFastEMA(0), macdSlowEMA(0), macdMain(0), macdSignal(0), macdHist(0), 진입가(0), TP1(0), TP2(0), TP3(0), SL(0), 거래량기준(0), 텍스트ID(0), TL1(0), TL2(0), TL3(0), TL4(0), 손익라벨(0), 매도조건(false), 청산1(false), 청산2(false), 청산3(false); // 1. RSI + MACD 계산 rsiVal = RSI(rsiLen); If CurrentBar = 1 Then Begin macdFastEMA = Close; macdSlowEMA = Close; End Else Begin macdFastEMA = (Close * (2 / (macdFastLen + 1))) + macdFastEMA[1] * (1 - (2 / (macdFastLen + 1))); macdSlowEMA = (Close * (2 / (macdSlowLen + 1))) + macdSlowEMA[1] * (1 - (2 / (macdSlowLen + 1))); macdMain = macdFastEMA - macdSlowEMA; macdSignal = (macdMain * (2 / (macdSignalLen + 1))) + macdSignal[1] * (1 - (2 / (macdSignalLen + 1))); macdHist = macdMain - macdSignal; End; // 2. 거래량 조건 거래량기준 = Average(Volume, 평균거래량기간); // 3. 조건 진입 If sTime >= 시작시간 and sTime <= 종료시간 and 매도조건 = false Then Begin If rsiVal < rsiCut and macdHist < 0 and macdHist[1] > 0 and Volume > 거래량기준 * volumeMultiplier Then Begin 진입가 = Close; TP1 = 진입가 * tp1Ratio; TP2 = 진입가 * tp2Ratio; TP3 = 진입가 * tp3Ratio; SL = 진입가 * slRatio; // 자동 매도 포지션 진입 SellShort("ShortEntry") Next Bar at Market; // 손익비 박스 TL_Delete(TL1); TL_Delete(TL2); TL_Delete(TL3); TL_Delete(TL4); Text_Delete(손익라벨); TL1 = TL_New(Date, Time, SL, Date + 1, Time, SL); TL2 = TL_New(Date, Time, TP3, Date + 1, Time, TP3); TL3 = TL_New(Date, Time, SL, Date, Time, TP3); TL4 = TL_New(Date + 1, Time, SL, Date + 1, Time, TP3); TL_SetColor(TL1, RGB(255,200,200)); TL_SetColor(TL2, RGB(255,200,200)); TL_SetColor(TL3, RGB(255,200,200)); TL_SetColor(TL4, RGB(255,200,200)); TL_SetSize(TL1, 1); TL_SetSize(TL2, 1); TL_SetSize(TL3, 1); TL_SetSize(TL4, 1); // 손익비 계산 및 라벨 표시 손익라벨 = Text_New(Date, Time, (SL + TP3)/2, "손익비 " + NumToStr((진입가 - TP3) / (SL - 진입가), 1) + ":1"); Text_SetStyle(손익라벨, 1, 0); Text_SetColor(손익라벨, RGB(200, 0, 0)); 매도조건 = true; 청산1 = false; 청산2 = false; 청산3 = false; End; End; // 4. 청산 조건 (비율 분할 청산 시뮬레이션) If 매도조건 Then Begin // TP1 도달 시 If 청산1 = false and Close <= TP1 Then Begin Alert("TP1 도달: 30% 청산"); 청산1 = true; End; // TP2 도달 시 If 청산2 = false and Close <= TP2 Then Begin Alert("TP2 도달: 50% 청산"); 청산2 = true; End; // TP3 도달 시 If 청산3 = false and Close <= TP3 Then Begin Alert("TP3 도달: 나머지 전량 청산"); 청산3 = true; 매도조건 = false; End; // SL 도달 시 전체 손절 If Close >= SL Then Begin Alert("손절가 도달: 전량 청산"); 청산1 = true; 청산2 = true; 청산3 = true; 매도조건 = false; End; End; 검증시 오류가나서 구현할수있게 부탁드립니다 감사합니다
프로필 이미지
윤호석
2025-05-21
247
글번호 191026
지표
답변완료

수식 문의드립니다.

안녕하세요. 시스템 수식에서.. 차트에 지표값을 출력하고 싶은데요. 가능할까요? 진입신호명을 지표값으로 출력 가능하겠죠? 예를들어 이평값이나 진입 캔들의 시가를 신호명으로 사용하고자 합니다.
프로필 이미지
율담
2025-05-21
239
글번호 191021
시스템
답변완료

문의드립니다.

실시간으로 지표값이 적용이 안된다고 문의드렸었는데요.. var : HH(0),LL(0),진입효율(0); if I_MarketPosition == 1 Then { if I_MarketPosition != I_MarketPosition[1] Then { HH = H; LL = L; } Else { if H > HH Then HH = H; if L < LL Then LL = L; } 진입효율 = (HH-I_AvgEntryPrice)/(HH-LL)*100; } if I_MarketPosition == -1 Then { if I_MarketPosition != I_MarketPosition[1] Then { HH = H; LL = L; } Else { if H > HH Then HH = H; if L < LL Then LL = L; } 진입효율 = (I_AvgEntryPrice-LL)/(HH-LL)*100; } Plot1(진입효율); 해당 수식은 이거였구요. 일단 원인을 찾았습니다. I_AvgEntryPrice 이 값이 리턴이 잘 안됩니다. 진입 신호가 들어왔는데.. 이 값이 0인 경우가 가끔있어요. 그래서 진입효율값이 엉망으로 나오네요. 그래서 다른값으로 하려고했는데.. I_MarketPosition 이 값도 모든 신호에서 작동하는게 아니더군요. 포지션이 변경되면 리턴이 되는지 확인해봤는데.. 이것도 제때 값을 리턴을 못합니다. 한번 확인해보시길 바랍니다. 지표에서는 MarketPosition을 사용못하기 때문에.. I_MarketPosition 을 사용해야하는것 같은데요. 이게 잘 작동안하네요.
프로필 이미지
율담
2025-05-21
218
글번호 191020
사용자 함수
답변완료

수식변환요청

다음 수식 변환 부탁드립니다 감사합니다 A=Lowest(L,25,지수)*1.20; B=valuewhen(1,A,A); CrossUp(C,B(25))
프로필 이미지
김승빈
2025-05-21
256
글번호 191019
종목검색
답변완료

수식 부탁 드립니다

5일 지수이동평균선을 분봉에 나타나게 하고 싶은데.. 혼자서 해결 할려고 검색을 아무리해도 나오지가 않네요ㅠㅠ 5일 지수이동평균선만 분봉에만 나타났으면 하는 바램에 부탁 드려봅니다
프로필 이미지
뭉게뭉게
2025-05-21
180
글번호 191018
시스템
답변완료

수식 부탁드립니다.

1) 매수, 매도 진입 조건 프라이스 채널 돌파시 진입 15봉 최고가를 실시간 가격이 상향 돌파할 때 : 매수 15봉 최저가를 실시간 가격이 하향 돌파시 : 매도 2) 재진입 조건 첫 진입 후 초기 손절되었다가 (1ATR) . 최초 진입가를 다시 같은방향으로 재돌파 할 경우 예) 매도 전략: 매도진입후 손절 후 최초진입가를 다시 하향 돌파 시 매수 전략: 매수진입후 손절 후 다시 상향 돌파 시 재진입은 최대 2회까지만 허용 (총 3회 진입). 이 후 같은방향의 돌파신호는 무시. 각 재진입마다 동일한 손절/목표 적용 봉 내 재진입 금지(손절된 경우, 동일 봉 내에서는 재진입 불허. 다음봉부터 재진입) 2) 매수, 매도 청산 조건 (반대 방향 15봉 돌파시 청산) 15봉 최고가 또는 최저가를 실시간 가격(C)이 돌파할 때. EX) 매수포지션에서 15봉 하단선 하향돌파시 청산후 바로 매도포지션 진입 5) 목표가 익절 조건 목표가= 3R = 3ATR 6) 손절 조건 15봉 상하단선 돌파하지 않더라도, 1ATR 손실시 포지션 손절. 초기 손절 조건 1ATR(각종목마다 설정) 손실시 손절. -> 매수, 매도 조건 동일. 재진입시에도 1ATR 손절 동일. 7) 기타 일봉 차트 기준 정말 감사드립니다!!!
프로필 이미지
제이디잭
2025-05-21
224
글번호 191017
시스템