Vertical Fibonacci Time Ratios Drawing Tool Request

Hi.

Can someone please share how to make the Vertical Fib Time Ratios please?

ThinkOrSwim has it, and it’s a Godsend.

I have just been experimenting trying to figure out some vertical line tools. I did make one that does something like what you have here. I was interested in a similar thing which I also made, which does even lines, and another which does fib lines that are 1,1,2,3,5,8,13. I might put them all on community indicators, but here is some code.

const predef = require("./tools/predef")
const { px, du, op } = require("./tools/graphics")

const FibonacciTime = {

    linesByMultiple(anchors, props, multiples) {
        const nDiff = anchors[1]
            ? (anchors[1].x.value - anchors[0].x.value)
            : 0;
        
        let lines = [];
        multiples.forEach(function(multiple,index){
            lines.push({
                tag: 'Line',
                a: anchors[1] 
                    ? {
                        x: du(anchors[0].x.value+(nDiff*multiple)),
                        y: anchors[0].y
                    }
                    : anchors[0],
                b: anchors[1] 
                    ? {
                        x: du(anchors[0].x.value+(nDiff*multiple)),
                        y: anchors[1].y
                    }
                    : anchors[0],
                infiniteStart: true,
                infiniteEnd: true
            });
        });
        return lines;
    },

    lines(anchors, props) {
        
        return this.linesByMultiple(anchors, props, [.236, .382, .5, .618, .786, 1]);

    },

    render({anchors, props}) {
        const nDiff = anchors[1]
            ? (anchors[1].x.value - anchors[0].x.value)
            : 0;

        if (anchors[1] && anchors[1].y.value == anchors[0].y.value) {
            anchors[1].y.value = anchors[0].y.value+0.0000001;
        }

        return {
            items: [
                {   
                    tag: 'LineSegments',
                    key: 'anchorline',
                    lines: [
                        {
                            tag: 'Line',
                            a: anchors[0],
                            b: {
                                  x: anchors[0].x,
                                  y: anchors[1].y
                            },
                            infiniteStart: true,
                            infiniteEnd: true
                        }
                    ],
                    lineStyle: {
                        lineWidth: 2,
                        lineStyle: 3,
                        color: props.color
                    }
                },
                {
                    tag: 'LineSegments',
                    key: 'fiblines',
                    lines: this.lines(anchors, props),
                    lineStyle: {
                        lineWidth: 2,
                        lineStyle: 3,
                        color: props.color
                    }
                },

                
            ]
        }
    },
    anchorRestraints({anchors}) {
        return [];   
    },

    anchorStyles({props}) {
        return [
            { color: 'aqua' },
        ]
    }
}


module.exports = {
    name: "FibonacciTime",
    description: "Fibonacci Time",
    drawing: FibonacciTime,
    params: {
        color: predef.paramSpecs.color('#21618C'),
    },
    maxN: 2
}

Wow. thanks for the great work!

I just realized that I don’t have access to Tradovate API, so I can’t import your scripts yet. Please let me know once you have uploaded it on the Community Indicators.

God bless.

Van

To use the above you’d just need to add the code module and create a file and paste the contents. However, I did go ahead and add 3 drawing tools to the community indicators earlier this evening so you should be able to find them there I think. This one is called “Fibonacci Time”.

Hi Brian. Thank you very much!! God bless.

Hi Brian.

Thanks for sharing the fantastic tool. Additionally, I’m wondering if we can change the style of each vertical line.

For example, we can change each line’s thickness, color, solid-or-dash, etc.

An example would be the default Tradovate’s Fib Retracement tool, which we can edit every single horizontal line.

Maybe you can kindly show me a few more lines of codes?

THANK YOU!! and God bless