Recently I started using an indicator that had been written by another programmer and initially it was doing a pretty good job. However,eventually I started getting annoyed with one particular implementation...
...or rather lack of implementation.
The indicator itself was a pretty simple affair and in essence all it did was to draw a series of lines starting from a predefined point. I'd drop the indicator on the chart, drag the zero line and the rest of the lines would be redrawn automatically, relative to it's position.
The problem came when I wanted to change the orientation of the lines and make the zero line the top rather than the bottom. The way the original programmer had coded it meant that the user would have to go into the settings, scroll down the list, identify the correct setting and change it from true to false.
Now instead of drawing the lines from zero upwards, it would draw them from zero downwards.
What a long winded way to accomplish a simple task!
So I decided it would be much simpler - and cooler - to have a button on the chart that would toggle the settings state from true to false. That way I wouldn't have to mess around with settings and instead could change the value by the click of a button.
Sounds pretty sweet right?
Well here's how you can do it too... (more…)