Understanding Barebone Gradient Candles: A Guide for MetaTrader 5 Traders

Mike 2021.06.25 07:39 33 0 0
Attachments

Hey traders! Today, let's dive into the world of candlestick patterns, specifically the Barebone Gradient Candles indicator for MetaTrader 5. If you’ve been searching for a solid example of DRAW_COLOR_CANDLES, you might have noticed it’s a bit hard to come by. A lot of the comments out there are less than helpful, and the official documentation doesn’t really clarify the plot limitations. Just a heads up, PLOT_COLOR_INDEXES is capped at 64 in length, which means you’ll be working within the range of [0; 63].

Now, one challenge I faced was figuring out how to transition from one color to another smoothly—what we call a gradient. This code includes a mathematical function that generates a gradient from color X to color Y. If anyone out there has a more efficient method, I’d love to hear your thoughts!

Feel free to drop your suggestions or improvements in the comments. Remember, this code is a work-in-progress and completely free for everyone to use. You can even strip away the licensing specifics if you prefer, but please keep the // AUTHORS: list commented for credit.

Changelog:

  • v1.01: Fixed the order, which was inverted. I was missing a 1.0 percentage calculation.

Working example

List
Comments 0