loopy problem

 

I'm hoping someone can help here. I'll post the code.

I can't seem to get the loop working in my code. It only ever wants to run through the loop during the last 2 or 3 candles. I've even taken out IndicatorCounted() and used Bars-1. I get the same result. Can anyone help out here?

Thanks.

Files:
 
nondisclosure:

I'm hoping someone can help here. I'll post the code.

I can't seem to get the loop working in my code. It only ever wants to run through the loop during the last 2 or 3 candles. I've even taken out IndicatorCounted() and used Bars-1. I get the same result. Can anyone help out here?

Thanks.

 
EAVirgin:
nondisclosure:

I'm hoping someone can help here. I'll post the code.

I can't seem to get the loop working in my code. It only ever wants to run through the loop during the last 2 or 3 candles. I've even taken out IndicatorCounted() and used Bars-1. I get the same result. Can anyone help out here?

Thanks.

Sorry, I didn't understand how to reply. Please post the Heiken_Ashi indicator without which your indicator won't run.
 
EAVirgin:
EAVirgin:
nondisclosure:

I'm hoping someone can help here. I'll post the code.

I can't seem to get the loop working in my code. It only ever wants to run through the loop during the last 2 or 3 candles. I've even taken out IndicatorCounted() and used Bars-1. I get the same result. Can anyone help out here?

Thanks.

Sorry, I didn't understand how to reply. Please post the Heiken_Ashi indicator without which your indicator won't run.


Here ya go. It's the same thing as 'Heiken Ashi'. I just made a copy so the file name was underlined. I thought that might have been the problem.

Thanks again for looking at it.

Files:
 
nondisclosure:

This file will better show you what is going on. It's only drawing one arrow (not both), it's only doing it for the last few bars (not all in the chart) and only 1 arrow's data element is showing up in the data window. What the duece is going on? anyone?

I've attached the indicator that I wrote for this. It shows nothing useful, but I'm trying to chase down as to why this is happening.

Files:
 
nondisclosure:
nondisclosure:

This file will better show you what is going on. It's only drawing one arrow (not both), it's only doing it for the last few bars (not all in the chart) and only 1 arrow's data element is showing up in the data window. What the duece is going on? anyone?

I've attached the indicator that I wrote for this. It shows nothing useful, but I'm trying to chase down as to why this is happening.

you must add the line

#property indicator_buffers 2

to your code. As far as why it seems that only the last few bars are being calculated - they are all being calculated, they are too high or too low to be seen on the chart.

this is because in your calculation of average range, you have not zeroed out the averagerange variable each time you calculate it.

add the line avgRange=0; just ahead of the for counter=i loop.

I was able to deduce all of this with two techniques:

I compared your code to the code for the bands indicator.

I used Print statements in the code to print intermediate values.

good luck.

Reason: