Indicator bug

To add comments, please log in or register
Michael Breu
745
Michael Breu  

Hi everyone,

I have an indicator that does not create new signals after it has been put on a chart. In other words, the indicator shows signals that occured in the past, but it does not generate new signals once it's on the chart. When I place the indicator on the chart again after letting some time pass, it will generate and show signals in that same period where it didn't generate any signals initially.

It also seems like the indicator is repainting old signals when I put it back on the chart. Not sure what the issue is, but it might be an easy and quick fix for a more experienced coder.


Source code is attached, would be great if you could help me out.

Files:
Naguisa Unada
524
Naguisa Unada  

Insert the following on line 110.

if (counted_bars == 0)
   limit -= atrPeriod;
Michael Breu
745
Michael Breu  
Naguisa Unada:

Insert the following on line 110.

I did, new signals are now generated, but this happens on almost every bar. The signals are not generated with the logic of the indicator anymore.

Naguisa Unada
524
Naguisa Unada  
Michael Breu:

I did, new signals are now generated, but this happens on almost every bar. The signals are not generated with the logic of the indicator anymore.

The first problem is an "Array out of range" error, which has been resolved. It has nothing to do with new trouble.

It takes a lot of time to analyze and modify the way signals are generated. I don't know whether I can help you.

Keith Watford
Moderator
20372
Keith Watford  
Michael Breu:

I did, new signals are now generated, but this happens on almost every bar. The signals are not generated with the logic of the indicator anymore.

It's a badly designed indicator.

You can try replacing

string signalSentAlready = "NONE";
if (symbol == "0" || symbol == "") symbol = Symbol();
    for(int i = 0; i < limit; i++)

with

static string signalSentAlready = "NONE";
if (symbol == "0" || symbol == "") symbol = Symbol();
    for(int i = limit-1; i >= 0; i--)

That should stop you getting the repeat signals.

Not compiled, not tested.

William Roeder
20210
William Roeder  
Naguisa Unada: Insert the following on line 110.

See also How to do your lookbacks correctly.

To add comments, please log in or register