I have a study with several symbols being displayed. I only need the last couple of symbols to be displayed on the charts. Can this be done with a count function. Any sample code would be great.
Announcement
Collapse
No announcement yet.
efs Optimization
Collapse
X
-
symbols??
do you mean SHAPES/LINES?? If so, yes - this can be done easily.
here is an example from my friend Steve (posted earlier)
PHP Code://outside MAIN
var yourcounter = 0;
//before your graphics statements
if (getBarState() == BARSTATE_NEWBAR) {
if (varcounter > 50)
varcounter =0;
else varcounter++;
//your graphics statements - just an example, they can be text, symbols, whatever, this is how you control the total number on the chart, to minimize performance issues
drawLineRelative( x1, y1, x2, y2, style, thickness, color ,"each"+varcounter ); //first line
drawLineRelative( x1, y1, x2, y2, style, thickness, color ,"is"+varcounter ); //second unique line
drawLineRelative( x1, y1, x2, y2, style, thickness, color ,"a"+varcounter );//third unique line
drawLineRelative( x1, y1, x2, y2, style, thickness, color ,"different"+varcounter );//fourth unique line
drawLineRelative( x1, y1, x2, y2, style, thickness, color ,"line"+varcounter ); //fifth unique line
drawLineRelative( x1, y1, x2, y2, style, thickness, color ,"every"+varcounter ); //sixth unique line
drawLineRelative( x1, y1, x2, y2, style, thickness, color ,"bar"+varcounter ); //seventh unique line
}
Brad Matheny
eSignal Solution Provider since 2000
-
shapecounter
Brad,
this is what I have so far
Function sell(){
if (getBarState() == BARSTATE_NEWBAR) {
if (getBarState() == BARSTATE_NEWBAR) {
if (shapecounter > 5)
shapecounter =0;
else shapecounter++;
}
drawShapeRelative(0,high()+.1.shape.DOWNARROW,"", Color.red,+shapecounter);
my main looks like
main()
shapecounter ++;
and of course I have
var shapecounter = 0;
above the function preMain();
Like I said earlier my goal in this is to only display the last five shapes on the chart to conserve cpu load.
Comment
Comment