Problems with using some indicators for an expert advisor

 

Hi,

I have a few indicators which I want to use for an expert advisor.

The indicators are having 4 buffers.

Buffer0 down-arrow

Buffer1 up-arrow

Buffer 2 small-down-point

Buffer 3 small-up-point

Between the points and the arrows I am drawing Trend lines with ObjectCreate(...OBJ_TREND..);


Now I have programmed an expert advisor which is using the indicators with iCustom(...) for Buffer0 and Buffer1.

When I run the expert advisor I can only the trend lines of the indicators (right chart)


I think this is normal, that I can't see the buffer values in my ea but the ea also doesn't the moment when the buffer is != 0.

How could this be?

But I see in the journal, what the nearly every tick the indicator are "initialized" and "loaded successfully".

As I see on the chart the indicators aren't repainting.

 
sunshineh:

Hi,

I have a few indicators which I want to use for an expert advisor.

I think this is normal, that I can't see the buffer values in my ea but the ea also doesn't the moment when the buffer is != 0.

Hi Sunshineh,

The quickest and easiest way to see your buffers is to display the buffers on the chart as COMMENTS or PRINT statements in your log.

That way you can see exactly what your buffer values are all the time...

Also be aware that an "Empty Buffer" actually has a large number in it....2147483647...and you can convert that to a ZERO (0) depending on your needs and how you are using the buffers.

if (TestValue1 == 2147483647) TestValue1 = 0;

Hope this helps,

Robert

 
Correct me if I am wrong but EAs don't display indicators that they call. The indicators do come up if you open a chart at the end of a back test but that is the same as putting the indicators on a chart like your first graph.
 
Ruptor:
Correct me if I am wrong but EAs don't display indicators that they call. The indicators do come up if you open a chart at the end of a back test but that is the same as putting the indicators on a chart like your first graph.

Hi Ruptor,

Whatever indicator values you can get from iCustom statements in your EA's...you can display the values in COMMENTS directly on your chart and PRINT statements in your logs.

Check out many of the EA's in the codebase here for examples.

Hope this helps,

Robert

 

Raptor is correct. EA's do-not display the indicators they call, Objects tho are always displayed.

Cosmicbeing is correct. You can Print or Comment the value of the indicator.

If the original poster is still head strong about showing indicator lines from within the EA, then he/she should do more google search about this topic because programmers here have come up with allot of creative solutions.

1) Create a template and name it tester.tpl saved it. When you test the indicator will auto come up. This is probably the easiest but have some limitations when the static value of the templates do-not match whats going on within the EA. Example is when the EA on-the-fly changes the Period or Parameters passed to the iCustom.

2) Try searching for WHRoeder code to help with the above limitation.

If you wrote your own indicator, understand how the indicator works, or know how to tweak the codes. You can also try modifying the indicator code to allow you to pass values to it via Global_Variable_Set.

Reason: