The STRAT Latter-day-trader

I am looking to contact Latter-Day-Trader (CHINKIAT) about his LTD- The Strat indicator
It works quite well with one exception. After the first inside-bar is painted all subsequent bars paint as an inside-bar. The only work around is to toggle to another time frame and back again.

I am grateful for any help with this issue

I am not sure how you got that indicator because I don’t see it in my list of indicators that I have shared to the community.

Either way, I loaded a version that I do have and I don’t see the problem as you described. Not sure if it was fixed or I didn’t understand the scenario. Also, I never really traded or studied the STRAT. I just wrote the indicator.

I shared the version that I do have here: Tradovate

Hi, Is there a way to have inside candles colored depending on opening and closing. I’m trying to get inside candles that are bullish aqua blue and inside candles that are bearish magenta and a way to put a border around them. Thank you :slight_smile:

Yes to set the bar color. To paint a border would require more work using the Graphics API. To set the bar color, in the return object of the map() function, just have a property called “candlestick”. The value of that property is another object with one property called color.

First, you detect an inside bar and figure out its color:

map(d, i, history) {

// Your code goes here


// previous bar
const prior = history.prior();

let barColor = "white"; // default color
let isInside = false;
if (prior && prior.high() > d.high() && prior.low() < d.low()) {
     // inside bar
     isInside = true;
     barColor = (d.close() > d.open()) ? "aqua" : "magenta"; // may not be the correct color names
}

Normally, you see something like this at the end of the map() function:

return {
     ma: moving, // just a sample property to return
     candlestick: { color: barColor}, // sets the color of the bar
}

The problem with the above is that you have to explicitly set the color of the bars at all times since you are always returning it. An alternative way is to conditionally return candlestick when it matches your conditions. You do so by defining a return object and add properties to it.

const rtn = {
     ma: moving, // just a sample property to return
};

if (isInside) {
     rtn["candlestick"] = { color: barColor};
}

return rtn;

Good luck.

I made a quick video on how to code on up.

1 Like