Candle By Candle Flip Indicator

I tried using Grok to figure this out… but I have no coding knowledge and I can’t get this to work.

Basically, I want to have a CBC Flip Indicator.
This indicator can be found on Tradingview. “CBC Flip by AsiaRoo”

In Tradingview, it has a function to change the background, but I don’t need that. I just want it to plot the triangles

Can someone figure this out for me?


Tradingview Code

// This Pine Script™️ code is subject to the terms of the Mozilla Public License 2.0 at Mozilla Public License, version 2.0
// ©️ friksa & AsiaRoo

//@version=5
indicator(“CBC Flip”, timeframe = “”, timeframe_gaps = true, overlay = true)

cbc = false
cbc := cbc[1]
if cbc and close < low[1]
cbc := false
if not cbc and close > high[1]
cbc := true

plotshape(not cbc and cbc[1], style=shape.triangledown, location=location.abovebar, color=color.rgb(228, 102, 102), size=size.tiny, title=‘Bears’, display=display.all - display.status_line)
plotshape(cbc and not cbc[1], style=shape.triangleup, location=location.belowbar, color=color.rgb(120, 206, 176), size=size.tiny, title=‘Bulls’, display=display.all - display.status_line)

// Background colour
bgcolor(cbc and not cbc[1] ? color.rgb(255, 235, 59, 71) : not cbc and cbc[1] ? color.rgb(5, 185, 240, 59) : na)

alertcondition(not cbc and cbc[1], ‘Bears’, ‘Bears in Control’)
alertcondition(cbc and not cbc[1], ‘Bulls’, ‘Bulls in Control’)

you need to fist pull the historical data using the map(d,i,history) and then access the high and low of the previous bars. then you need to invoke either the graphic handler or function handler that works with the graphic module to draw something like triangle or dot as there are no native shapes in Tradovate. I am code developer. drop me an email on timmfain@gmail.com so I can see how I can help.

We also use it more effectively on the 10m timeframe as I am sure you already know.

i can help with that if you need a custom indicator for tradovate or want to adapt a pinescript one just write back here or dm me and i’ll check if i can get it working