going crazy with the backtest of my indicator

 

I am having an indicator with 5 buffers

The first two buffers are lines.

The following three buffers are drawing arrows/symbols.

SetIndexBuffer(2,BuyBuffer);
SetIndexBuffer(3,SellBuffer);
SetIndexBuffer(4,ExitBuffer);

Now I am writing an EA, which checks when the BuyBuffer, the SellBuffer or the ExitBuffer is !=0

When I do the backtest, than I can see many more Symbols on the chart, than the EA is ordering.

The EA also buys sometimes a long or a short order, without I can see a symbol on the chart.

HOW COULD THIS BE??

I think I can see EVERY symbol, when there is something written in the buffer?!

 
  1. indicator repaints
  2. wrong use of icustom
  3. EA's logic is wrong
//z
 

Thank you, for your answer.

The indicator isn't repainting, the iCustom function is correctly in use (as far as I see) and my EA logic is right.

First I have only written in my journal with print(...)

When something != 0 is in buffer 2, 3 or 4. Here I also got not some moments I can see in the chart!

I think, this could not be possible, because I can the symbol at a specific time on the chart, but I didn't get the moment with:

if(iCustom(NULL,0,"...",...,4,0) != 0)

Print("..");

 

Well, as your code is obviously correct, and MT4 isn't inclined to do random trades, then clearly you have a faulty computer. I suggest you take it back to where you purchased it & either ask for a refund or a replacement.

Or maybe go through a similar process that I do occasionally (as a software developer of over 35 years commercial experience) and say to yourself, "This computer is not doing what I'm telling it to do. Maybe I need to re-examine some of my assumptions."

BTW once I did come across a computer that would occasionally malfunction and keep running - a mainframe register would occasionally flip a bit, and it had no parity checking for it.

 

another posible solution is that your indicator code does not produce good outputs.

maybe you forgot to initialize the buffers.

so check icustom in your ea with following code:

double result=iCustom()....
if(result!=0 && result!=EMPTY_VALUE && result!=EMPTY){

}
 
sunshineh:

Now I am writing an EA, which checks when the BuyBuffer, the SellBuffer or the ExitBuffer is !=0

When I do the backtest, than I can see many more Symbols on the chart, than the EA is ordering.

You're looking at not zero but not drawn is probably EMPTY_VALUE
 

Hi,

thank you very much for your answers!

Now I checked the given indicator and it is not working with IndicatorCounted( ). The indicator is calculating every open-bar-time the hole indicator new.

Could this cause the error?

 
How should we know? You didn't post the code.
Reason: