Why there is a mismatch between an indicator drawing and its buffer output when all being equal?
-
I’m attempting to write a simple EA using two costume indicators: “FIP_Line” and “TMA”. When I check the output of the two FIP_Line’s buffers using the indicator tester (or trace), I get a perfect match between the drawing of the FIP_Line’s signal line and the indicator tester line (see snapshot 1 for one buffer output). However, while using the same data as above (5M chart) and the same parameters for the indicator and the tester (see snapshots 2 and 3), there is a clear mismatch between the 3 lines drawn on the chart by TMA and the 3 indicator tester lines (see snapshot 4, 5 and 6). Can someone explain to me why I have this trouble with the TMA buffers’ output? I attach here both indicators for you to play with.
Thanks, Ron
Snapshot 1: http://www.screencast.com/t/OSks0NPhw
Snapshot 2:http://www.screencast.com/t/6ZVivi8pNg
Snapshot 3:http://www.screencast.com/t/FspqXjnEF03p
Snapshot 4:http://www.screencast.com/t/5liRU7KadI3t
Snapshot 5:http://www.screencast.com/t/POdJiLss3aM
Snapshot 6:http://www.screencast.com/t/8AkBAHVqg
TMA.mq4FIP_Line.mq4......
FIP_Line.mq4
TMA.mq4 -
I'm not very good with indicators and I don't know how exactly this happens, but you can see it yourself. Start the EA in Visual Mode. Let it draw the pink line from Trace. Add the indicator and watch. You will see that always for the current candle the pink line and the indicator's line match, but for the past few lines the indicator's line is repainted. The pink line does not show those repaints.
-
Thank you Admin. You are 100% correct regarding the perfect match at the current bar with the visual mode. It is really strange that the indicator lines diverge from the trace lines when they leave the current bar. Yet, the perfect match at the current bar is true for the TMA but not for the FIP_Line where the 2 lines slightly diverge also at the current bar (see the snapshot). This is also pretty strange and unclear to me....
-
This is how the indicator works. It's not the "Indicator tester" or "Trace" that shows wrong values. Sometimes I introduce bugs in the code, but I'm 99% sure that the block is working very fine

The huge number (21... ) is also known as EMPTY_VALUE and this number is how indicators tell the EA that there is no value to be shown. That's why the constant is called EMPTY_VALUE
