Convert code – pivot ribbon
Forums › ProRealTime English forum › ProBuilder support › Convert code – pivot ribbon
- This topic has 1 reply, 2 voices, and was last updated 6 months ago by Iván.
Viewing 2 posts - 1 through 2 (of 2 total)
-
-
06/01/2024 at 2:24 AM #233359
I would appreciate if you can convert the following code below
Code123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124// Saty Pivot Ribbon// Copyright (C) 2022-2023 Saty Mahajan//// A 3 EMA Ribbon system that simplifies measuring and using emas for trend and support/resistance.// Special thanks to Ripster for his education and EMA Clouds which inspired this indicator.//@version=5indicator('Saty Pivot Ribbon', 'Saty Pivot Ribbon', overlay=true)// Settingstime_warp = input.string("off", 'Time Warp', options=["off", "1m", "2m", "3m", "4m", "5m", "10m", "15m", "20m", "30m", "1h", "2h", "4h", "D", "W", "M", "Y"])fast_ema = input(title='Fast EMA Length', defval=8)pivot_ema = input(title='Pivot EMA Length', defval=21)slow_ema = input(title='Slow EMA Length', defval=34)bullish_fast_cloud_color = input(color.green, 'Bullish Fast Cloud Color')bearish_fast_cloud_color = input(color.red, 'Bearish Fast Cloud Color')bullish_slow_cloud_color = input(color.aqua, 'Bullish Slow Cloud Color')bearish_slow_cloud_color = input(color.orange, 'Bearish Slow Cloud Color')cloud_transparency = input(title='Cloud Transparency (0-100)', defval=60)show_fast_ema_highlight = input(false, 'Show Fast EMA Highlight')fast_ema_highlight_color = input(color.white, 'Fast EMA Highlight Color')show_pivot_ema_highlight = input(false, 'Show Pivot EMA Highlight')pivot_ema_highlight_color = input(color.white, 'Pivot EMA Highlight Color')show_slow_ema_highlight = input(false, 'Show Slow EMA Highlight')slow_ema_highlight_color = input(color.white, 'Slow EMA Highlight Color')show_conviction_arrows = input(true, 'Show Conviction Arrows')bullish_conviction_color = input(color.aqua, 'Bullish Conviction Arrow Color')bearish_conviction_color = input(color.yellow, 'Bearish Conviction Arrow Color')show_fast_conviction_ema = input(true, 'Show Fast Conviction EMA')fast_conviction_ema = input(13, 'Fast Conviction EMA Length')fast_conviction_ema_color = input(color.silver, 'Fast Conviction EMA Color')show_slow_conviction_ema = input(true, 'Show Slow Conviction EMA')slow_conviction_ema = input(48, 'Slow Conviction EMA Length')slow_conviction_ema_color = input(color.purple, 'Slow Conviction EMA Color')show_candle_bias = input(false, "Show Candle Bias")bias_ema = input(21, 'Bias EMA')// Time Warp timeframe// Set the appropriate timeframe based on trading modetimeframe_func() =>timeframe = timeframe.periodif time_warp == 'off'timeframe := timeframe.periodelse if time_warp == '1m'timeframe := '1'else if time_warp == '2m'timeframe := '2'else if time_warp == '3m'timeframe := '3'else if time_warp == '4m'timeframe := '4'else if time_warp == '5m'timeframe := '5'else if time_warp == '10m'timeframe := '10'else if time_warp == '15m'timeframe := '15'else if time_warp == '20m'timeframe := '20'else if time_warp == '30m'timeframe := '30'else if time_warp == '1h'timeframe := '60'else if time_warp == '2h'timeframe := '120'else if time_warp == '4h'timeframe := '240'else if time_warp == 'D'timeframe := 'D'else if time_warp == 'W'timeframe := 'W'else if time_warp == 'M'timeframe := 'M'else if time_warp == 'Y'timeframe := '12M'elsetimeframe := timeframe.period// Calculationsticker = ticker.new(syminfo.prefix, syminfo.ticker, session=session.extended)price = request.security(ticker, timeframe_func(), close, gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_on)fast_ema_value = request.security(syminfo.tickerid, timeframe_func(), ta.ema(price, fast_ema)[barstate.isrealtime ? 1 : 0], gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off)pivot_ema_value = request.security(syminfo.tickerid, timeframe_func(), ta.ema(price, pivot_ema)[barstate.isrealtime ? 1 : 0], gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off)slow_ema_value = request.security(syminfo.tickerid, timeframe_func(), ta.ema(price, slow_ema)[barstate.isrealtime ? 1 : 0], gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off)fast_conviction_ema_value = request.security(syminfo.tickerid, timeframe_func(), ta.ema(price, fast_conviction_ema)[barstate.isrealtime ? 1 : 0], gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off)slow_conviction_ema_value = request.security(syminfo.tickerid, timeframe_func(), ta.ema(price, slow_conviction_ema)[barstate.isrealtime ? 1 : 0], gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off)// Create plotsfast_ema_plot = plot(fast_ema_value, color=show_fast_ema_highlight ? fast_ema_highlight_color : na, title='Fast EMA')pivot_ema_plot = plot(pivot_ema_value, color=show_pivot_ema_highlight ? pivot_ema_highlight_color : na, title='Pivot EMA')slow_ema_plot = plot(slow_ema_value, color=show_slow_ema_highlight ? slow_ema_highlight_color : na, title='Slow EMA')// Fill in the plots to create cloudsfast_cloud_color = fast_ema_value >= pivot_ema_value ? color.new(bullish_fast_cloud_color, cloud_transparency) : color.new(bearish_fast_cloud_color, cloud_transparency)fill(fast_ema_plot, pivot_ema_plot, color=fast_cloud_color, title='Fast Cloud', transp=90)slow_cloud_color = pivot_ema_value >= slow_ema_value ? color.new(bullish_slow_cloud_color, cloud_transparency) : color.new(bearish_slow_cloud_color, cloud_transparency)fill(pivot_ema_plot, slow_ema_plot, color=slow_cloud_color, title='Slow Cloud', transp=90)// Conviction Arrows (default based on 13/48)bullish_conviction = fast_conviction_ema_value >= slow_conviction_ema_valuebearish_conviction = fast_conviction_ema_value < slow_conviction_ema_valuebullish_conviction_confirmed = bullish_conviction[0] == true and bullish_conviction[1] == falsebearish_conviction_confirmed = bearish_conviction[0] == true and bearish_conviction[1] == falseplotshape(bullish_conviction_confirmed and show_conviction_arrows, style=shape.triangleup, color=bullish_conviction_color, location=location.belowbar, size=size.small)plotshape(bearish_conviction_confirmed and show_conviction_arrows, style=shape.triangledown, color=bearish_conviction_color, location=location.abovebar, size=size.small)fast_conviction_ema_plot = plot(fast_conviction_ema_value, color=show_fast_conviction_ema ? fast_conviction_ema_color : na, title='Fast Conviction EMA')slow_conviction_ema_plot = plot(slow_conviction_ema_value, color=show_slow_conviction_ema ? slow_conviction_ema_color : na, title='Slow Conviction EMA')// Candle Biasbias_ema_value = request.security(syminfo.tickerid, timeframe_func(), ta.ema(price, bias_ema)[barstate.isrealtime ? 1 : 0], gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off)above_pivot = close >= bias_ema_valuebelow_pivot = close < bias_ema_valueup = open < closedoji = open == closedown = open > closebias_candle_color = above_pivot and up and show_candle_bias ? bullish_fast_cloud_color :below_pivot and up and show_candle_bias ? bearish_slow_cloud_color :above_pivot and down and show_candle_bias ? bullish_slow_cloud_color :below_pivot and down and show_candle_bias ? bearish_fast_cloud_color :doji and show_candle_bias ? color.gray :naplotcandle(open,high,low,close,color = bias_candle_color, bordercolor = bias_candle_color, wickcolor = bias_candle_color)06/03/2024 at 12:21 PM #233434Hi!
Here you have the code:1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798//---------------------------------------------------------------------------////PRC_Saty Pivot Ribbon//version = 0//03.06.24//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//-----Inputs----------------------------------------------------------------//fastemaperiod=8fastconvictionemaperiod=13pivotemaperiod=21slowemaperiod=34slowconvictionemaperiod=48biasemaperiod=21transparency=100showemas=0//boolean "Show EMAs"colorcandles=0//boolean "Color Candles"showarrows=1//boolean "Show Arrows"//---------------------------------------------------------------------------//fastema=average[fastemaperiod,1](close)pivotema=average[pivotemaperiod,1](close)slowema=average[slowemaperiod,1](close)fastconvictionema=average[fastconvictionemaperiod,1](close)slowconvictionema=average[slowconvictionemaperiod,1](close)//---------------------------------------------------------------------------////-----Clouds----------------------------------------------------------------//if fastema>=pivotema thenrfc=76gfc=175bfc=80elserfc=255gfc=82bfc=82endifif pivotema>=slowema thenrsc=0gsc=188bsc=212elsersc=255gsc=152bsc=0endifcolorbetween(pivotema,fastema,rfc,gfc,bfc,transparency)colorbetween(pivotema,slowema,rsc,gsc,bsc,transparency)//---------------------------------------------------------------------------////-----Conviction Arrows-----------------------------------------------------//bullishconviction=fastconvictionema>=slowconvictionemabearishconviction=fastconvictionema<slowconvictionemabullishconvictionconfirmed=bullishconviction and bullishconviction[1]=0bearishconvictionconfirmed=bearishconviction and bearishconviction[1]=0if bullishconvictionconfirmed and showarrows thendrawarrowup(barindex,low-0.35*tr)coloured(0,188,212)elsif bearishconvictionconfirmed and showarrows thendrawarrowdown(barindex,high+0.35*tr)coloured(255,235,59)endif//---------------------------------------------------------------------------////-----Candle Bias-----------------------------------------------------------//biasema=average[biasemaperiod,1](close)abovepivot=close>=biasemabelowpivot=close<biasemaup=open<closedoji=open=closedown=open>closeif colorcandles thenif abovepivot and up thenrbar=76gbar=175bbar=80elsif belowpivot and up thenrbar=255gbar=152bbar=0elsif abovepivot and down thenrbar=0gbar=188bbar=212elsif belowpivot and down thenrbar=255gbar=82bbar=82elsif doji thenrbar=120gbar=123bbar=134endifdrawcandle(open,high,low,close)coloured(rbar,gbar,bbar)endif//---------------------------------------------------------------------------////-----Plot EMAs-------------------------------------------------------------//if showemas thena=255elsea=0endif//---------------------------------------------------------------------------//return fastema as "Fast EMA" coloured(255,255,255,a),pivotema as "Pivot EMA" coloured(255,255,255,a),slowema as "Slow EMA" coloured(255,255,255,a),fastconvictionema as "Fast Conviction EMA" coloured("silver")style(line,2), slowconvictionema as "Slow Conviction EMA" coloured("purple")style(line,2) -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
Find exclusive trading pro-tools on
Similar topics: