Download MetaTrader 5

iCustom doesn't work... - I know how the iCustom Methode works!

To add comments, please log in or register
Jan
175
Jan  

Hey Guys,

I can imagine that here in the forum are a lot of threads like these. But my problem this time isn't that I don't know how the iCustom Methode works rather that it doesn't work...
The parameters for the  iCustom Methode are: 

double  iCustom(symbol, timeframe, name, [CustomIndicatorParameters1, CustomIndicatorParameters2 ...], mode, shift);

My Code looks so:

void OnTick(){
   
   superTrend = iCustom(NULL, 0, "SuperTrend", 10, 3.0, 0, 0);
   
   Comment("EMA25(e): ",EMA25," - EMA50(e): ",EMA50," - SuperTrend: ",superTrend);
}

I don't know why but I am getting wrong results... For example the SuperTrend is in the picture 1.12259 but the EA says  "SuperTrend: 2147483647.0"
Where is the problem and how can I fix that?

The input parameters for the SuperTrend Indicator are Nbr_Periods and Multiplier. So just 2 parameters who I gave the value 10 and 3.0 (standart values) in my iCustom Methode. But it doesn't work...

You can find the code for the SuperTrend Indicator in the attachment!
 

 

Greetings and thank you!

Files:
Jan
175
Jan  

UPDATE:

I found out that the EA returns the right value for the SuperTrend if the SuperTrend is below the market price... Why is that working?
So it's only wrong if the SuperTrend is above the market price!

 

Keith Watford
Moderator
10644
Keith Watford  
superTrend_lower = iCustom(NULL, 0, "SuperTrend", 10, 3.0, 0, 0);
superTrend_upper = iCustom(NULL, 0, "SuperTrend", 10, 3.0, 1, 0);

2147483647.0 is EMPTY_VALUE, which means that the line is not displayed


   if(superTrend_lower!=EMPTY_VALUE)
     {
      Print("SuperTrend is below price");
     }
   else
     {
      Print("SuperTrend is above price");     
     }


.

whroeder1
15725
whroeder1  
Two colors, two buffers.
Jan
175
Jan  
Thank you guys! :)
Jan
175
Jan  

I have again a problem with my iCustom, I think it is again a Buffer error... How can I get the 6 values for the daily pivot points?
You can find the code for the DailyPivotPoints Indicator in the attachment!

 

Files:
Fernando Carreiro
2320
Fernando Carreiro  
FrazeColder:

I have again a problem with my iCustom, I think it is again a Buffer error... How can I get the 6 values for the daily pivot points?
You can find the code for the DailyPivotPoints Indicator in the attachment!

The indicator "dailypivotpoints" that you have provided, displays the pivot points using Graphical Chart Objects and not standard indicator buffers, therefore you cannot use iCustom() to get the values.

You will have to either:

  1. Use Graphical Chart Objects manipulation to get the values from the chart objects. Personally however, I consider this is to be the worst solution of the 3 and don't recommend it.
  2. Code the equivalent calculations in the EA's code itself and not depend on an outside indicator for the pivot values. Since calculating pivot points, is quite simple, this would be my personal choice, but for more complex indicators, the next choice would be more acceptable.
  3. Code your own indicator that will use buffers to calculate and display the pivot points, and therefore allow the usage of iCustom() to get the data.
Keith Watford
Moderator
10644
Keith Watford  

The lines are drawn with objects, not buffers, so you cannot access their values with iCustom.

You can get their values with ObjectGet() or ObjectGetDouble() as long as the indicator is attached to the chart.

Jan
175
Jan  
If I use the this indicator https://www.mql5.com/en/code/8685 - How can I get the different values?
whroeder1
15725
whroeder1  
To add comments, please log in or register