A Better Way To Code - TheRumpledOne - page 3

 

Ok, the plot thickens...

int start()

{

int limit;

int counted_bars=IndicatorCounted();

if(counted_bars<0) return(-1); // YOU CAN ACTIVATE THIS ONE

if(counted_bars>0) counted_bars--;

limit=Bars-counted_bars;

if( limit >= my.stop )

{

for(int i=limit; i>=0; i--)

{

// LOAD BUFFERS

TestBuffer = limit ;

} //for

} // if( limit >= my.stop )

Comment( "Limit=", limit, "\n",

"counted_bars=", counted_bars, "\n",

"Bars=", Bars, "\n",

"my.stop=", my.stop, "\n",

" ") ;

return(0);

}

The input my.stop

extern int my.stop = 3 ;

is set to 3.

So the loop should not execute if limit is less than 3.

The current buffer, TestBuffer[0], has not been assigned a value so... where's it coming from?

There's something I need to learn about MT4!!

 

bool

SetIndexBuffer(

int

index,

double

array[]

)

Binds the array variable declared at a global level to the custom indicator pre-defined buffer.

Maybe the keyword is BINDS!

More testing....

 

Load the attached code on a M1 chart and watch.

Interesting...

Files: