I am trying to paint a bar in a tick-count chart. For example, 10 tick chart.
I would like to paint the bar(possibly candle) in 10 levels for each tick received. For the 1st tick, I would paint 1/10th of the bar, for 2nd tick, 2/10th of the bar, and so on. For the last 10th tick, the bar would be painted fully. Once the current bar becomes an old one, the painting for that bar should be removed.
I am thinking to use this as an alternative for the Tick counter.
Is this possible? If so, please kindly write a code for this.
Thanks.
HR
Coding help: how to plot a bar gradually?
I got it myself as below. It's the simple and basic, and someone might refine more.
Code: Select all
Var: Level(0);
Level = (h-l)*Ticks/BarInterval;
PlotPaintBar(L+Level ,Low,l,L+Level ,"",Yellow, BarInterval);
NoPlot(1)[1];
NoPlot(2)[1];
NoPlot(3)[1];
NoPlot(4)[1];
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
TJ,
thanks for the tips.
But your code does not clearly show when the tick bar will be completed, meanwhile, mine works like level gauge. When the last tick is to received, 9/10th of the bar gets colored yellow, and finally the last tick completely fills the bar with yellow. So, it is easier to know then end of a bar is approaching, I think.
HR
thanks for the tips.
But your code does not clearly show when the tick bar will be completed, meanwhile, mine works like level gauge. When the last tick is to received, 9/10th of the bar gets colored yellow, and finally the last tick completely fills the bar with yellow. So, it is easier to know then end of a bar is approaching, I think.
HR
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
TJ,
thanks for the tips.
But your code does not clearly show when the tick bar will be completed, meanwhile, mine works like level gauge. When the last tick is to received, 9/10th of the bar gets colored yellow, and finally the last tick completely fills the bar with yellow. So, it is easier to know then end of a bar is approaching, I think.
HR
I posted my simple suggestion before I saw your post.
A little more refinement.
It now changes color depending on the direction.
It now changes color depending on the direction.
Code: Select all
Var: GaugeLevel(0);
GaugeLevel = (h-l)*Ticks/BarInterval;
PlotPaintBar(Low+GaugeLevel,Low,Low,Low+GaugeLevel,"",iff(O>C,Blue,iff(O<C,Red,Yellow)), BarInterval);
NoPlot(1)[1];
NoPlot(2)[1];
NoPlot(3)[1];
NoPlot(4)[1];