int pos=Bars-counted_bars; //---- main calculation loop
while(pos>=0)
the indicator is only plotting the bars that the system tells it have "not already been counted"
for a test, change to:
int pos=1000;
while(pos>=0)
and it should always plot 1000 bars.
while(pos>=0)
the indicator is only plotting the bars that the system tells it have "not already been counted"
for a test, change to:
int pos=1000;
while(pos>=0)
and it should always plot 1000 bars.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Take a look at the following code:
#property indicator_separate_window #property indicator_buffers 8 #property indicator_color1 Red #property indicator_color2 Blue //---- buffers double ExtMapBuffer1[]; extern int length=15; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); string short_name = "Fucking test at:"; IndicatorShortName(short_name); //---- return(1); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); if (counted_bars<0) return(-1); //---- last counted bar will be recounted if (counted_bars>0) counted_bars--; int pos=Bars-counted_bars; //---- main calculation loop while(pos>=0) { double summation[1000]; summation[pos]=iATR(Symbol(),NULL,length,pos)*length; ExtMapBuffer1[pos]= (iClose(Symbol(),NULL,pos)-iClose(Symbol(),NULL,pos+length))/summation[pos]; pos--; } //---- return(0); } //+------------------------------------------------------------------+If I plot iClose(Symbol(),NULL,pos)-iClose(Symbol(),NULL,pos+length)) the ExtMapBuffer1 shows the right graph, and if I plot summation[pos] it also show the right values for all bars in past... but when i divide the two, I only get plots for the two last bars.
Anyone who can explain this phenomemon for me?
Thank you in advance,
Johan