theultimator5
Forums › ProRealTime forum Italiano › Supporto ProBuilder › theultimator5
- This topic has 3 replies, 2 voices, and was last updated 17 hours ago by
Ciccarelli Franco.
Viewing 4 posts - 1 through 4 (of 4 total)
-
-
12/04/2025 at 12:04 PM #254243
Ivan buongiorno,
tempo fa hai pubblicato un interessante indicatore “Wick to body” , ora trovo su tradingview un similare (in oggetto) che mi sembra migliore.
Puoi tradurlo?
https://it.tradingview.com/script/33GvrEgb-Echo-Chamber-theUltimator5/
12/04/2025 at 2:12 PM #254247Ecco:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180// ---------------------------------------------------------// PRC_Echo Chamber (Pattern Projection)// version = 0// 04.12.2025// Iván González @ www.prorealcode.com// Sharing ProRealTime knowledge// ---------------------------------------------------------DEFPARAM DrawOnLastBarOnly = True// --- PARAMETERS ---// Length: Correlation window (bars to compare)Length = 20// Lookback: How many bars to look back in historyLookback = 500// ProjectionLen: How many bars to project into the futureProjectionLen = 20// --- INTERNAL VARIABLES ---bestCorrelation = -1.0bestIndex = 0currentScale = 0.0historyScale = 0.0// Execute only on the last bar to optimize resourcesIF islastbarupdate THEN// 1. GET CURRENT SEQUENCE// Fill an array with recent close prices$currentSeq[0] = 0SumX = 0.0SumX2 = 0.0FOR i = 0 TO Length - 1 DOval = Close[i]$currentSeq[i] = val// Prepare data for correlation (X = Current Sequence)SumX = SumX + valSumX2 = SumX2 + (val * val)NEXTMeanX = SumX / LengthStDevX = SQRT((SumX2 / Length) - (MeanX * MeanX))// 2. PATTERN SEARCH// Iterate backwards in history to find the best match// Start after the current window to avoid self-comparisonStartIndex = Length + ProjectionLenEndIndex = LookbackFOR k = StartIndex TO EndIndex DOSumY = 0.0SumY2 = 0.0SumXY = 0.0// Collect historical segment (Y)FOR j = 0 TO Length - 1 DOhistVal = Close[k + j]currVal = $currentSeq[j] // Note: currentSeq[0] is current CloseSumY = SumY + histValSumY2 = SumY2 + (histVal * histVal)SumXY = SumXY + (currVal * histVal)NEXT// Calculate Pearson Correlation rMeanY = SumY / LengthStDevY = SQRT((SumY2 / Length) - (MeanY * MeanY))// Avoid division by zero if price is flatIF (StDevX * StDevY) <> 0 THENCovariance = (SumXY / Length) - (MeanX * MeanY)Correlation = Covariance / (StDevX * StDevY)ELSECorrelation = 0ENDIF// Save best resultIF Correlation > bestCorrelation THENbestCorrelation = CorrelationbestIndex = kENDIFNEXT// 4. DRAW RESULTSIF bestIndex > 0 THEN// A) Highlight found historical segment// Calculate range to draw the boxmaxH = High[bestIndex]minL = Low[bestIndex]FOR j = 0 TO Length - 1 DOmaxH = MAX(maxH, High[bestIndex + j])minL = MIN(minL, Low[bestIndex + j])NEXT// Draw rectangle in the pastx1 = BarIndex - bestIndex - Length + 1x2 = BarIndex - bestIndexDRAWRECTANGLE(x1, maxH, x2, minL) COLOURED(100, 200, 250, 50) BORDERCOLOR(100, 200, 250)DRAWTEXT("Match History", x1, maxH) ANCHOR(BOTTOM, INDEX, VALUE) COLOURED(100, 200, 250)// B) Future Projection// Scale historical price to current price// Scale factor based on ranges (High - Low of the period)rangeHist = maxH - minLrangeCurr = Highest[Length](High) - Lowest[Length](Low)IF rangeHist <> 0 THENscaleFactor = rangeCurr / rangeHistELSEscaleFactor = 1ENDIF// Anchor point (last close)anchorPrice = Close[0]histAnchor = Close[bestIndex]// Draw projection line by lineFOR m = 1 TO ProjectionLen DO// bestIndex is the end of the pattern. The future is at bestIndex - midxFuture = bestIndex - m// Stop if index is out of bounds (negative index)IF idxFuture < 0 THENBREAKENDIFpriceHistFuture = Close[idxFuture]priceHistPrev = Close[idxFuture + 1]// Price transformation: Adjustment by scale and anchor// Projecting the variationprice1raw = Close[bestIndex - (m - 1)]price2raw = Close[bestIndex - m]// Transformval1 = anchorPrice + (price1raw - histAnchor) * scaleFactorval2 = anchorPrice + (price2raw - histAnchor) * scaleFactor// X Coordinates (Future)xStart = BarIndex + m - 1xEnd = BarIndex + mDRAWSEGMENT(xStart, val1, xEnd, val2) COLOURED(255, 105, 180) STYLE(dottedline, 2)NEXT// 5. INFORMATION PANELtxtCorr = round(bestCorrelation * 100, 2)txtDateYear = year[bestIndex]txtDateMonth = month[bestIndex]txtDateDay = day[bestIndex]txtTimehour = hour[bestIndex]txtTimeminute = minute[bestIndex]if gettimeframe<86400 thenDRAWTEXT("ECHO CHAMBER", -200, -100) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0)DRAWTEXT("Corr.: #txtCorr#%", -200, -120) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(125, 125, 220)DRAWTEXT("Date: #txtDateYear#/#txtDateMonth#/#txtDateDay#", -200, -140) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(200, 200, 200)DRAWTEXT("Time: #txtTimehour#:#txtTimeminute#", -200, -160) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(200, 200, 200)drawrectangle(-290, -80, -110, -180)ANCHOR(TOPRIGHT, XSHIFT, YSHIFT)elseDRAWTEXT("ECHO CHAMBER", -200, -100) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0)DRAWTEXT("Corr.: #txtCorr#%", -200, -120) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(125, 125, 220)DRAWTEXT("Date: #txtDateYear#/#txtDateMonth#/#txtDateDay#", -200, -140) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(200, 200, 200)drawrectangle(-290, -80, -110, -160)ANCHOR(TOPRIGHT, XSHIFT, YSHIFT)endifENDIFENDIFRETURN1 user thanked author for this post.
12/04/2025 at 7:01 PM #254257Grazie , sei stato velocissimo, forse già era disponibile.
12/05/2025 at 12:11 PM #254270Non mi funziona in modalità manuale
-
AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)
