Download MetaTrader 5
To add comments, please log in or register
Do you need OpenCL? MQL5 can provide it!
Jan
170
Jan 2016.09.23 15:55 

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
170
Jan 2016.09.23 15:59  

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
8016
Keith Watford 2016.09.23 18:42  
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
13656
whroeder1 2016.09.23 18:44  
Two colors, two buffers.
Jan
170
Jan 2016.09.23 21:15  
Thank you guys! :)
Jan
170
Jan 2016.09.27 16:34  

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
1571
Fernando Carreiro 2016.09.27 17:20  
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
8016
Keith Watford 2016.09.27 17:23  

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
170
Jan 2016.09.28 14:58  
If I use the this indicator https://www.mql5.com/en/code/8685 - How can I get the different values?
whroeder1
13656
whroeder1 2016.09.28 17:21  
/
To add comments, please log in or register