Problem mit Daily High und Low in meinem Indikator myCandle-V14
Forums › ProRealTime Deutsch forum › ProBuilder Support › Problem mit Daily High und Low in meinem Indikator myCandle-V14
- This topic has 6 replies, 2 voices, and was last updated 1 month ago by Thomas.
-
-
10/16/2024 at 11:29 AM #239053
Ich kann Folgendes im Code nicht lösen. Im 1h (und höher) Chart werden die Tageshöchst- und -tiefstwerte korrekt dargestellt. Aber ab den Minutencharts wird es falsch dargestellt, weil es die Zeit von 0 Uhr bis 1 Uhr zu berechnen scheint?!? Könnte Ihr da noch einmal helfen?
Screenshot: https://1drv.ms/i/s!AlLFPjbX_wf1oNsVJQddLiHqsqe67w?e=F8LGFh
Indikator hier im Forum: https://www.prorealcode.com/prorealtime-indicators/mycandle-v1-4/Code myCandle123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230// myCandel-Infos-V1.3// 18.06.2019 (Release 1.2)// 18.04.2020 (Release 1.3)// 01.05.2020(Release 1.4)// Thomas Geisler// Sharing ProRealTime knowledge// https://www.prorealcode.com/library/defparam drawonlastbaronly=true // Zeichung nur am letzten Bar//--init--alpha = 255TP = myEATR/2 //Position for Infoslookback = 1// Info = 1// IntradayTrend// DayTrend = 1// Centerline = 1// HighLowIntraday = 1// HighLow = 1// Arrows = 1// Trendforce = 1// OBVforce = 1//-- end--//--Info--// previous Candle Range[1] and ATR[10] and EMA-ATR[20]of ATR[1]myRange = round(Range[1])myATR = round(AverageTrueRange[10](close[0]))myEATR = round(ExponentialAverage[20](AverageTrueRange[10](close[0])))// Forex without round//myRange = Range[1]//myATR = AverageTrueRange[10](close[0])//myEATR = ExponentialAverage[20](AverageTrueRange[10](close[0]))//--centerline (DM0) and intraday range (DMR)mytdayhigh=DHigh(0)mytdaylow=DLow(0)DM0 = (mytdayhigh-mytdaylow)/2+mytdaylowDMR = round((mytdayhigh-mytdaylow))//--rounded range of last five daysD1 = DHigh(1)-DLow(1)D2 = DHigh(2)-DLow(2)D3= DHigh(3)-DLow(3)D4 = DHigh(4)-DLow(4)D5 = DHigh(5)-DLow(5)DMA = round((D1+D2+D3+D4+D5)/5)//--end--//--Dailys highest high and lowest Low--if day <> day[1] thendayindex = dayindex + 1dayhigh = 0daylow = close//dayopen = open//dayclose = closeif dayindex > lookback thenfor j = 1 to barindexif dayindex[j] = dayindex - lookback thenmydayhigh = dayhigh[j]mydaylow = daylow[j]breakendifnextendifendifdayhigh = max(dayhigh,high)daylow = min(daylow,low)//--end--//--show or not, Daily High / Low Lineif HighLow = 1 thenmydayhigh2 = mydayhighmydaylow2 = mydaylowendif// change color od Day Hig/Low LinesIf mydayhigh[0] > mydayhigh[1] and mydaylow[0] > mydaylow[1] thendha = 0dhb = 255dla = 255dlb = 0elsif mydayhigh[0] < mydayhigh[1] and mydaylow[0] < mydaylow[1] thendha = 255dhb = 0dla = 0dlb = 255elsif mydayhigh[0] > mydayhigh[1] and mydaylow[0] < mydaylow[1] or mydayhigh[0] < mydayhigh[1] and mydaylow[0] > mydaylow[1]thendha = 255dhb = 153dla = 255dlb = 153endif//--end--//--show or not, centerline, center of range between intraday high/low--If CenterLine = 1 thenmytdaycenter = DM0elsemytdaycenter = undefinedendifif mytdaycenter[0] > mytdaycenter[1] thencla = 0clb = 255elsif mytdaycenter[0] < mytdaycenter[1] thencla = 255clb = 0endif//--end--// Ranges Candels in different colour and print today daily range (High/Low)If Info = 1 thenDrawText(" <> #DMR#/#DMA#",barindex,open+TP+TP,Dialog,Bold,10) coloured(153,153,153,alpha)if myATR > ExponentialAverage[20](myATR) or myRange > myATR thenDrawText(" #myRange#/#myATR#/#myEATR#",barindex,open,Dialog,Bold,10) coloured(255,153,0,alpha)elseDrawText(" #myRange#/#myATR#/#myEATR#",barindex,open,Dialog,Bold,10) coloured(153,153,153,alpha)endifendif//--end--//-- proof close over/under Centerline and/or close over/under yesterday high/low--If DayTrend = 1 thenif close < mydayhigh[1] and close > mydaylow[1] thenDrawText(" DT inside",barindex,open+TP,Dialog,Bold,10) coloured(153,153,153,alpha)elsif close > mydayhigh[1] thenDrawText(" DT over",barindex,open+TP,Dialog,Bold,10) coloured(0,255,0,alpha)elsif close < mydaylow[1] thenDrawText(" DT under",barindex,open+TP,Dialog,Bold,10) coloured(255,0,0,alpha)endifendifIf IntradayTrend = 1 thenif close > DM0 thenDrawText(" IDT over",barindex,open-TP,Dialog,Bold,10) coloured(0,255,0,alpha)elseDrawText(" IDT under",barindex,open-TP,Dialog,Bold,10) coloured(255,0,0,alpha)endifendif//--end--//--Show Intraday HighLow as dotted line--If HighLowIntraday = 1 thenmytdayhigh = DHigh(0)mytdaylow = DLow(0)elsemytdayhigh = undefinedmytdaylow = undefinedendif//--end--//--Arrows--//Trend bzw Trend forceif Arrows = 1 thenif Periods10not20 = 1 then //Periods 10BullTrend = (Close - LOWEST[10](LOW)) / AVERAGETRUERANGE[10]BearTrend = (HIGHEST[10](HIGH) - Close) / AVERAGETRUERANGE[10]Trend = (BullTrend - BearTrend)TrendEMA = ExponentialAverage[10](Trend)// On Balance Volumen zur Bestimmung der Kaufkraft der Bewegung/TrendmyOBV = OBVmyOBVA1 = ExponentialAverage[10](myOBV)else //Periods 20BullTrend = (Close - LOWEST[20](LOW)) / AVERAGETRUERANGE[20]BearTrend = (HIGHEST[20](HIGH) - Close) / AVERAGETRUERANGE[20]Trend = (BullTrend - BearTrend)TrendEMA = ExponentialAverage[20](Trend)// On Balance Volumen zur Bestimmung der Kaufkraft der Bewegung/TrendmyOBV = OBVmyOBVA1 = ExponentialAverage[20](myOBV)endifif Trendforce = 1 and OBVforce = 1 thenIf Trend > TrendEMA and myOBV > myOBVA1 then //and myOBV > myOBVA2 thenDRAWARROWup(barindex,low-TP) coloured(0,255,0,alpha)elsif Trend < TrendEMA and myOBV < myOBVA1 then //and myOBV < myOBVA2 thenDRAWARROWdown(barindex,high+TP)coloured(255,0,0,alpha)endifelsIf OBVforce = 1 and not Trendforce thenif myOBV > myOBVA1 then //and myOBV > myOBVA2 thenDRAWARROWup(barindex,low-TP) coloured(0,255,0,alpha)elsif myOBV < myOBVA1 then //and myOBV < myOBVA2 thenDRAWARROWdown(barindex,high+TP)coloured(255,0,0,alpha)endifelsIf Trendforce = 1 and not OBVforce thenif Trend > TrendEMA thenDRAWARROWup(barindex,low-TP) coloured(0,255,0,alpha)elsif Trend < TrendEMA thenDRAWARROWdown(barindex,high+TP)coloured(255,0,0,alpha)endifendifendif//--end--// Show or not Heikin Ashi Lineif HAline = 1 thenonce haOpen = openonce haClose = CloseN = 0if barindex = 0 thenhaOpen = openhaClose = closeelsif N = 0 thenhaClose =(Open+High+Low+Close)/4haOpen =(haOpen[1]+haClose[1])/2endifif haOpen[0] > haOpen[1] thenhaa = 0hab = 255elsehaa = 255hab = 0endifendif//--end--// To show Outsidebar use external Indicator OutsideBarColorSolo.itfReturn mydayhigh2 COLOURED (dha,dhb,0)style(line,3) AS "High", mydaylow2 COLOURED (dla,dlb,0)style(line,3) AS "Low", mytdayhigh COLOURED (0,204,255)style(dottedline,1) AS "Today High", mytdaylow COLOURED (204,102,0)style(dottedline, 1) AS "Today Low", mytdaycenter COLOURED (cla,clb,0 )style(line,2) as "Today Centerline", haOpen COLOURED (haa,hab,0 )style(dottedline,1)as "Heikin Ashi Line"// End and make moneyVielen Dank!!!!
10/16/2024 at 12:16 PM #239065Die Tagesleiste schließt um 010000 (1 Uhr morgens), bis dahin ist die Tagesleiste die des Vortages. Der neue Balken beginnt um 010000 Uhr.
Wenn Sie einen Zeitrahmen von 1 Stunde verwenden, hat die Leiste, die um 00:00 Uhr geöffnet wird, den neuen Tag als Datum, aber immer den alten Wochentag (DayOfWeek). Erst um 010000 wird DayOfWeek aktualisiert.
10/16/2024 at 4:34 PM #239093Wie kann ich denn folgendes realisieren? Ich benötige für mytdayhigh und mytdaylow die Werte des aktuellen Börsentages. Für mydayhigh und mydaylow benötige ich aber die vom Vortag. Wo mache ich denn den Fehler? Ist er in der Schleife “//–Dailys highest high and lowest Low–“? Roberto, könnten Sie mir ggf das anpassen?
10/16/2024 at 5:03 PM #239097Bitte posten Sie die ITF-Datei.
10/17/2024 at 8:14 AM #23911610/17/2024 at 12:11 PM #239144Ich habe Ihren Code geändert, indem ich die Daten NICHT am Ende der täglichen Kerze, sondern bei 000000 aktualisiert habe, und dabei ein Array verwendet habe, sodass Dlow(0) zu $myDlow[0] wurde usw. für die anderen bis zum 5. Tag.
Probieren Sie es aus.
Sie sollten die neue ITF-Datei, die ich angehängt habe, importieren, damit Sie dieselben Originalvariablen finden, die korrekt deklariert sind.
Der Code dient lediglich dazu, dass Sie sofort die am ersten Teil des Codes vorgenommenen Änderungen sehen können:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337// myCandel-Infos-V1.4// 18.06.2019 (Release 1.2)// 18.04.2020 (Release 1.3)// 01.05.2020(Release 1.4)// TEMP 2024 (UN-Release 1.5)// Thomas Geisler// Sharing ProRealTime knowledge// https://www.prorealcode.com/library/DEFPARAM CalculateOnLastBars = 10000defparam drawonlastbaronly=true // Zeichung nur am letzten Bar//--init--alpha = 255TP = myEATR//2 //Position for Infos//TP = 0.1 //Position for Infoslookback = 1// Info = 1// IntradayTrend = 1// DayTrend = 1// Centerline = 1// HighLowIntraday = 1// HighLow = 1// Arrows = 1// Trendforce = 1// OBVforce = 1// LStyle// myATR = 14// myEATR = 200//-- end--//-- INFO --// Section rounded for indices other for Share and Forex// -- ROUNDED --IF BarIndex = 0 THENFOR i = 0 TO 5$myDhigh[i] = 0$myDlow[i] = 0NEXTENDIFIF (OpenTime = 000000) OR ((OpenTime > 000000) AND (OpenTime[1] > OpenTime)) THENFOR i = 5 DOWNTO 1$myDhigh[i] = $myDhigh[i - 1]$myDlow[i] = $myDlow[i - 1]NEXT$myDhigh[0] = high$myDlow[0] = low////--range of last five daysD1 = $myDhigh[1] - $myDlow[1]//DHigh(1)-DLow(1)D2 = $myDhigh[2] - $myDlow[2]//DHigh(2)-DLow(2)D3 = $myDhigh[3] - $myDlow[3]//DHigh(3)-DLow(3)D4 = $myDhigh[4] - $myDlow[4]//DHigh(4)-DLow(4)D5 = $myDhigh[5] - $myDlow[5]//DHigh(5)-DLow(5)//ENDIF$myDhigh[0] = max(high,$myDhigh[0])$myDlow[0] = min(low,$myDlow[0])IF Decimals < 2 THEN// previous Candle Range[1] and ATR[14]or(3) and Extra-ATR[200]myRange = round(Range[1])myATR = round(AverageTrueRange[3](close[0]),0)myEATR = round(ExponentialAverage[20](AverageTrueRange[10](close[0])))//--centerline (DM0) and intraday range (DMR)myintdayhigh = $myDhigh[0]myintdaylow = $myDlow[0]DM0 = (myintdayhigh-myintdaylow)/2+myintdaylowDMR = round((myintdayhigh-myintdaylow))//--rounded average range of last five daysDMA = round((D1+D2+D3+D4+D5)/5)//--end -- ROUNDEDELSE// -- NOT ROUNDED --myRange = Range[1]myATR = AverageTrueRange[8](close[0])myEATR = ExponentialAverage[20](AverageTrueRange[10](close[0]))//--centerline (DM0) and intraday range (DMR)myintdayhigh = $myDhigh[0]myintdaylow = $myDlow[0]DM0 = (myintdayhigh-myintdaylow)/2+myintdaylowDMR = (myintdayhigh-myintdaylow)//--rounded range of last five daysDMA = (D1+D2+D3+D4+D5)/5//--end -- NOT ROUNDEDENDIF// -- end INFO --//--Dailys highest high and lowest Low--if day <> day[1] thendayindex = dayindex + 1dayhigh = 0daylow = close//dayopen = open//dayclose = closeif dayindex > lookback thenfor j = 1 to barindexif dayindex[j] = dayindex - lookback thenmydayhigh = dayhigh[j]mydaylow = daylow[j]breakendifnextendifendifdayhigh = max(dayhigh,high)daylow = min(daylow,low)//--end--//--show or not, Daily High / Low Lineif HighLow = 1 thenmydayhigh2 = mydayhighmydaylow2 = mydaylowdha = 255dhb = 0dhc = 255dla = 0dlb = 255dlc = 255endif////////// Area for Day-Line colour changes//// Daily high red, daily low green or change it//// change color od Day Hig/Low Lines//If mydayhigh[0] > mydayhigh[1] and mydaylow[0] > mydaylow[1] then//dha = 255//dhb = 0//dhc = 0//dla = 0//dlb = 255//dlc = 0//elsif mydayhigh[0] < mydayhigh[1] and mydaylow[0] < mydaylow[1] then//dha = 0//dhb = 255//dhc = 0//dla = 255//dlb = 0//dlc = 0//elsif mydayhigh[0] > mydayhigh[1] and mydaylow[0] < mydaylow[1] or mydayhigh[0] < mydayhigh[1] and mydaylow[0] > mydaylow[1]then//dha = 255//dhb = 153//dhc = 0//dla = 255//dlb = 153//dlc = 0//endif//////--end--// change color for INSIDE DAYs and Trend Up/Down//If mydayhigh[0] > mydayhigh[1] and mydaylow[0] > mydaylow[1] then//dha = 0//dhb = 153//dhc = 153//dla = 255//dlb = 51//dlc = 153//elsif mydayhigh[0] < mydayhigh[1] and mydaylow[0] < mydaylow[1] then//dha = 255//dhb = 51//dhc = 153//dla = 0//dlb = 153//dlc = 153//elsif mydayhigh[0] > mydayhigh[1] and mydaylow[0] < mydaylow[1] or mydayhigh[0] < mydayhigh[1] and mydaylow[0] > mydaylow[1]then//dha = 255//dhb = 153//dhc = 0//dla = 255//dlb = 153//dlc = 0//endif//--end--//--show or not, centerline, center of range between intraday high/low--If CenterLine = 1 thenmyintdaycenter = DM0elsemyintdaycenter = undefinedendifif myintdaycenter[0] > myintdaycenter[1] thencla = 0clb = 255elsif myintdaycenter[0] < myintdaycenter[1] then//cla = 255//clb = 0cla = 0clb = 255endif//--end--//Backround from Directinal MovementIF Background = 1 AND Centerline = 1 THENIF CLOSE > myintdaycenter THENBACKGROUNDCOLOR(204,255,204,164)ELSIF CLOSE < myintdaycenter THENBACKGROUNDCOLOR(255,204,204,164)ENDIFENDIF// Ranges Candels in different colour and print today daily range (High/Low)// For Rounded and not roundedIf Info = 1 thenIF Decimals < 2 THEN // Chande position / space// In PRT you have to increase the percentage distance of the chart from the window edge!DrawText(" <> #DMR#/#DMA#",barindex,open+TP+TP,Dialog,Standard,10) coloured(153,153,153,alpha)if myATR > ExponentialAverage[20](myATR) or myRange > myATR thenDrawText(" #myRange#/#myATR#/#myEATR#",barindex,open,Dialog,Bold,10) coloured(255,0,255,alpha)elseDrawText(" #myRange#/#myATR#/#myEATR#",barindex,open,Dialog,Standard,10) coloured(168,168,168,alpha)endif// not roundedELSE // Chande position / space// In PRT you have to increase the percentage distance of the chart from the window edge!DrawText(" <>#DMR#/#DMA#",barindex,open+TP+TP,Dialog,Standard,10) coloured(153,153,153,alpha)if myATR > ExponentialAverage[20](myATR) or myRange > myATR thenDrawText(" #myRange#/#myATR#/#myEATR#",barindex,open,Dialog,Bold,10) coloured(255,0,255,alpha)elseDrawText(" #myRange#/#myATR#/#myEATR#",barindex,open,Dialog,Standard,10) coloured(168,168,168,alpha)endifendifENDIF//--end--//-- proof close over/under Centerline and/or close over/under yesterday high/low--If DayTrend = 1 thenif close < mydayhigh[1] and close > mydaylow[1] thenDrawText(" DT inside",barindex,open+TP,Dialog,Bold,10) coloured(153,153,153,alpha)elsif close > mydayhigh[1] thenDrawText(" DT over",barindex,open+TP,Dialog,Bold,10) coloured(0,255,0,alpha)elsif close < mydaylow[1] thenDrawText(" DT under",barindex,open+TP,Dialog,Bold,10) coloured(255,0,0,alpha)endifendifIf IntradayTrend = 1 thenif close > DM0 thenDrawText(" IDT over",barindex,open-TP,Dialog,Bold,10) coloured(0,255,0,alpha)elseDrawText(" IDT under",barindex,open-TP,Dialog,Bold,10) coloured(255,0,0,alpha)endifendif//--end--//--Show Intraday HighLow as dotted line--If HighLowIntraday = 1 thenmyintdayhigh = $myDhigh[0]myintdaylow = $myDlow[0]elsemyintdayhigh = undefinedmyintdaylow = undefinedendif//--end--//--Arrows--//Trend bzw Trend forceif Arrows = 1 thenif Periods10not20 = 1 then //Periods 10BullTrend = (Close - LOWEST[10](LOW)) / AVERAGETRUERANGE[10]BearTrend = (HIGHEST[10](HIGH) - Close) / AVERAGETRUERANGE[10]Trend = (BullTrend - BearTrend)TrendEMA = ExponentialAverage[10](Trend)// On Balance Volumen zur Bestimmung der Kaufkraft der Bewegung/TrendmyOBV = OBVmyOBVA1 = Average[10](myOBV)else //Periods 20BullTrend = (Close - LOWEST[20](LOW)) / AVERAGETRUERANGE[20]BearTrend = (HIGHEST[20](HIGH) - Close) / AVERAGETRUERANGE[20]Trend = (BullTrend - BearTrend)TrendEMA = ExponentialAverage[20](Trend)// On Balance Volumen zur Bestimmung der Kaufkraft der Bewegung/TrendmyOBV = OBVmyOBVA1 = Average[20](myOBV)endifif Trendforce = 1 and OBVforce = 1 thenIf Trend >= TrendEMA and myOBV >= myOBVA1 thenDRAWARROWup(barindex+1,low-TP) coloured(0,255,0,alpha)elsif Trend =< TrendEMA and myOBV =< myOBVA1 thenDRAWARROWdown(barindex+1,high+TP)coloured(255,0,0,alpha)endifelsIf OBVforce = 1 and not Trendforce thenif myOBV => myOBVA1 thenDRAWARROWup(barindex+1,low-TP) coloured(0,255,0,alpha)elsif myOBV =< myOBVA1 thenDRAWARROWdown(barindex+1,high+TP)coloured(255,0,0,alpha)endifelsIf Trendforce = 1 and not OBVforce thenif Trend > TrendEMA and Trend >= 0 thenDRAWARROWup(barindex+1,low-TP) coloured(0,255,0,alpha)elsif Trend < TrendEMA and Trend <= 0thenDRAWARROWdown(barindex+1,high+TP)coloured(255,0,0,alpha)endifendifendif//--end--// Show or not Heikin Ashi Lineif HAline = 1 thenonce haOpen = openonce haClose = CloseN = 0if barindex = 0 thenhaOpen = openhaClose = closeelsif N = 0 thenhaClose =(Open+High+Low+Close)/4haOpen =(haOpen[1]+haClose[1])/2endifif haOpen[0] > haOpen[1] thenhaa = 0hab = 255elsehaa = 255hab = 0endifendif//--end--// To show Outsidebar use external Indicator OutsideBarColorSolo.itf//High/Low Daylines koennen über den Dialog eingestellt werden.Return mydayhigh2 AS "High", mydaylow2 AS "Low", myintdayhigh AS "Today High", myintdaylow AS "Today Low", myintdaycenter as "Today Centerline", haOpen as "Heikin Ashi Line" //haOpen COLOURED (haa,hab,0 )style(line,1)as "Heikin Ashi Line"// mit vorgefaerbten High/Low Daylines//Return mydayhigh2 COLOURED (dha,dhb,dhc)style(line,2) AS "High", mydaylow2 COLOURED (dla,dlb,dlc)style(line,2) AS "Low", myintdayhigh AS "Today High", myintdaylow AS "Today Low", myintdaycenter as "Today Centerline", haOpen as "Heikin Ashi Line" //haOpen COLOURED (haa,hab,0 )style(line,1)as "Heikin Ashi Line"// myintdaycenter COLOURED (255,255,255 )style(line,2) as "Today Centerline" // Feste Farbe//Return mydayhigh2 AS "High", mydaylow2 AS "Low", myintdayhigh AS "Today High", myintdaylow AS "Today Low", myintdaycenter as "Today Centerline", haOpen COLOURED (haa,hab,0 )style(line,1)as "Heikin Ashi Line"//END10/18/2024 at 9:09 AM #239177Grazie Roberto. Es sieht alles super aus. Ich warte jetzt mal auf einen Overnight-Handel ausserhalb der Vortagesspanne (0-1Uhr). Ich würde mich ja gerne mit einem Gläschen Wein oder Grappa bedanken, aber das lassen leider die Regeln wohl nicht zu 😉 Nochmals Grazie mille Roberto
Sobald alles fertig ist poste ich die neue Version wieder.
Gracias y un cordial saludo desde España. Thomas
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on