Conversión de Indicator Code
Forums › ProRealTime foro Español › Soporte ProBuilder › Conversión de Indicator Code
- This topic has 4 replies, 3 voices, and was last updated 5 months ago by Iván.
Viewing 5 posts - 1 through 5 (of 5 total)
-
-
06/10/2024 at 7:00 PM #233707
Hola, ¿alguien podría ayudarme a convertir este código de indicador para que sea compatible con la plataforma ProRealTime?
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758// Saty Phase Oscillator// Copyright (C) 2022-2024 Saty Mahajan// A useful range-based signal to monitor various phases of the market.//@version=5indicator("Saty Phase Oscillator")// Standard Colorsgreen = color.rgb(0,255,0)red = color.rgb(255,0,0)magenta = color.rgb(255,0,255)light_gray = color.rgb(200,200,200)gray = color.rgb(150,150,150)dark_gray = color.rgb(100,100,100)// Pivot Datapivot = ta.ema(close, 21)above_pivot = close >= pivot// Phasesextended_up_zone = plot(100.0, color = light_gray, linewidth = 1)distribution_zone = plot(61.8, color = gray, linewidth = 1)neutral_up_zone = plot(23.6, color = dark_gray, linewidth = 1)neutral_down_zone = plot(-23.6, color = dark_gray, linewidth = 1)accumulation_zone = plot(-61.8, color = gray, linewidth = 1)extended_down_zone = plot(-100.0, color = light_gray, linewidth = 1)// # Bollinger Band Compression Signalbband_offset = 2.0 * ta.stdev(close, 21)bband_up = pivot + bband_offsetbband_down = pivot - bband_offsetcompression_threshold_up = pivot + (2.0 * ta.atr(14))compression_threshold_down = pivot - (2.0 * ta.atr(14))expansion_threshold_up = pivot + (1.854 * ta.atr(14))expansion_threshold_down = pivot - (1.854 * ta.atr(14))compression = above_pivot ? (bband_up - compression_threshold_up) : (compression_threshold_down - bband_down)in_expansion_zone = above_pivot ? (bband_up - expansion_threshold_up) : (expansion_threshold_down - bband_down)expansion = compression[1] <= compression[0]compression_tracker = falseif expansion and in_expansion_zone > 0compression_tracker := falseelse if compression <= 0compression_tracker := trueelsecompression_tracker := falsecompression_signal = plot(0, color = compression_tracker ? magenta : dark_gray, linewidth = 2)// # Compressing / Expanding / Expandedvar tbl = table.new(position.top_right, 1, 1)if barstate.islasttable.cell(tbl, 0, 0, 'Compression', bgcolor = magenta)if compression_tracker == falsetable.clear(tbl,0,0,0,0)// Saty Phase Oscillator Signalraw_signal = ((close - pivot) / (3.0 * ta.atr(14))) * 100oscillator = ta.ema(raw_signal, 3)phase_oscillator = plot(oscillator, linewidth = 2, color = compression_tracker ? magenta : (oscillator >= 0.0 ? green : red), title = "Phase Oscillator")06/11/2024 at 2:00 PM #23374206/11/2024 at 4:41 PM #23375706/11/2024 at 6:26 PM #23376806/12/2024 at 7:53 AM #233779Disculpadme. Hubo un problema cuando publiqué y al editar el post parece que el código no se copió correctamente:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778//--------------------------------------------------------////PRC_Saty Phase Oscillator//version = 0//11.06.24//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//--------------------------------------------------------////-----Inputs---------------------------------------------//length=21multbb=2//--------------------------------------------------------////-----Pivot Data-----------------------------------------//pivot=average[length,1](close)AbovePivot=close>=pivot//--------------------------------------------------------////-----Bollinger Band Compression Signal------------------//bbandOffset=multbb*STD[length](close)bbandUp=pivot+bbandOffsetbbandDown=pivot-bbandOffsetcompressionThresholdUp=pivot+2*averagetruerange[14]compressionThresholdDown=pivot-2*averagetruerange[14]expansionThresholdUp=pivot+1.854*averagetruerange[14]expansionThresholdDown=pivot-1.854*averagetruerange[14]if abovepivot thencompression=bbandUp-compressionThresholdUpinExpansionZone=bbandUp-expansionThresholdUpelsecompression=compressionThresholdDown-bbandDowninExpansionZone=expansionThresholdDown-bbandDownendifexpansion=compression[1]<=compressioncompressionTracker=0if expansion and inExpansionZone>0 thencompressionTracker=0elsif compression<=0 thencompressionTracker=1endif//--------------------------------------------------------////-----Phases---------------------------------------------//extendedUpZone=100distributionZone=61.8neutralUpZone=23.6neutralDownZone=-23.6accumulationZone=-61.8extendedDownZone=-100//--------------------------------------------------------////-----Saty Phase Oscillator Signal-----------------------//rawSignal=(close-pivot)/(3*averagetruerange[14])*100oscillator=average[3,1](rawSignal)//--------------------------------------------------------////-----Phase Oscillator Colours---------------------------//if compressionTracker thenr=255g=0b=255rs=255gs=0bs=255if islastbarupdate thendrawtext("Compression",-100,-80)anchor(topRIGHT ,XSHIFT ,YSHIFT )drawrectangle(-200,-60,-10,-100)anchor(topRIGHT ,XSHIFT ,YSHIFT )fillcolor(r,g,b,50)endifelseif oscillator >=0 thenr=0g=255b=0elser=255g=0b=0endifrs=100gs=100bs=100endif//--------------------------------------------------------//return oscillator as "Phase Oscillator" coloured(r,g,b)style(line,3),extendedUpZone coloured(200,200,200),distributionZone coloured(150,150,150),neutralUpZone coloured(100,100,100),neutralDownZone coloured(100,100,100),accumulationZone coloured(150,150,150),extendedDownZone coloured(200,200,200),0 coloured(rs,gs,bs)style(line,2)1 user thanked author for this post.
-
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)
Find exclusive trading pro-tools on
Similar topics: