MPH Tick Countdown

How would you change this indicator so it would plot the countdown in white instead of black?

const lodash = require("lodash");
const predef = require("./tools/predef");
const meta = require("./tools/meta");

// Counts down the number of ticks left in a bar on a tick chart 
// directly above the current bar"
class mphTickCounter {
map(d, i, history) {
    const coordinates = {};
    const cd = this.chartDescription
    if (cd.underlyingType == "Tick") {
        // The value must be different every tick, otherwise the chart will not update.
        // However, if the value is set to the number of ticks, the chart will attempt
        // to autofit to include the number of ticks even if the value is not shown,
        // so we set the value to something around the current price, and expect to never
        // display the value.
        const newValue = 
            d.value() === this.lastValue ? d.value() + this.contractInfo.tickSize : d.value()
        this.lastValue = d.value()

        const maxTicks = cd.elementSize
        const remainingTicks = maxTicks - d.ticks()
        const text = remainingTicks > 0 ? remainingTicks.toString() : ""

        return { 
            ticks: {
                text: ["", text],
                x: [d.timestamp(), d.timestamp()],
                y: [d.low(), d.high()],
            value: newValue,
    } else {
        return {};


module.exports = {
name: "mphTickCountdown",
title: "[mph] Tick Countdown",
description: "Tick Countdown",
tags: ["mph"],
calculator: mphTickCounter,
params: {},
inputType: meta.InputType.BARS,
plotter: predef.plotters.zigzag(["ticks"]),
scaler: predef.scalers.multiPath(["lower", "higher"])

HI, How can We use this in our charts?
Im sure if this outputs to the dom then some css should be easy to add to a certian area of the page?

you can add it from the community indicators tab. in tradovate

I never knew that custom indicator was there… Very nice but you can’t see it.

Any coders out there know how to change the color?

function percentPlotter(canvas, indicatorInstance, history) {
for(let i=0; i<; ++i) {
const item = history.get(i);

if (item.percent !== undefined) {
const x = p.x.get(item);

const g = Math.max(Math.min(Math.round(item.percent * 255), 255), 0);
const b = Math.max(Math.min(Math.round(255 * (1 - item.percent)), 255), 0);

p.offset(x, 0),
p.offset(x, item.percent * 100),
color: toRgb(0, g, b),
relativeWidth: 0.5,
opacity: 1.0

I am unfamiliar with how you print to the chart so i dont know how to set the color of the ticks but the other community tick function has this RGB method using canvas… Maybe this indicator can use the same kind of function to make the tick count white

I’d like to have this too.

You would think someone at TradoVate would have the answer on how to change text color.

1 Like

After trying numerous other things unsuccessfully, I was able to find a pretty bad kluge that works temporarily. Each time you refresh the page, you have to remove and re-add the custom indicator, but it seems to work. Basically, if you trick the system into thinking it’s the jigsaw plugin by renaming the name property in module exports to “jigsaw” you get this:

One downside to this is it disables the price action swing study

Good point, @sirrous. So, I guess you can’t run them simultaneously. BTW…it was your other post on not being able to change the style on your custom swing that gave me the idea to try it on this indicator :slight_smile:

Jumping in on this - would be great to have a visible tick countdown. Has anyone discovered a solution?

I would love to be able to change the color on this to white or something lighter as I use the dark theme.

Yes, have been eagerly for someone to code a more visible tick countdown for quite sometime now…

Looked into this for a while but couldn’t sort out anyway to change the color for a zigzag plotter… and couldn’t find any examples in any of the built in indicators. This one may ultimately have to go to the wise men on the mountain to get answered @BWeis @Victor_Vins1

1 Like

Yes, and hacking the zigzag indicator to achieve this plot style is not ideal. It would be great to have a text plotter that lets us place text content in the plot and have control over color, font, etc.

1 Like