| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Help needed with iCustom https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=1088 |
Page 1 of 1 |
| Author: | K-Lander [ Mon Nov 19, 2012 1:05 pm ] |
| Post subject: | Help needed with iCustom |
Hello all, Maybe this is too basic but I am in my first steps as a wannabe coder, so bear with me... I am trying to call an indi from an EA, to no avail. I only have the ex4 file so I don´t know if this is even possible. I have no idea of the parameters the indi needs (no external ones though), so what I am doing is this: I want to get the indi´s values of the last 8 bars and pick the highest and lowest values, so: For (i=1;i<9;i++) { Indi = iCustom(NULL,0,"INDINAME", 1, i); if (Indi > IndiHigh) IndiHigh = Indi; if (Indi < IndiLow) IndiLow = Indi; } However, iCustom does not read the indi´s values. IndiHigh and IndiLow remain zeroed. As I said, I only have the indi´s ex4 file. If this is not possible, I thought I may code an indi that reads in real time the ex4 output on the screen, a sort of mirror that can be called in turn by iCustom. Anyway, any help here will be greatly appreciated. Thanks a lot, K-Lander |
|
| Author: | gaheitman [ Mon Nov 19, 2012 1:12 pm ] |
| Post subject: | Re: Help needed with iCustom |
When you have the indicator on a chart does it appear with values in the data window? If so, you can get it with iCustom(). You'll probably want to call it with mode = 0, which will give you the first indicator buffer. George |
|
| Author: | K-Lander [ Mon Nov 19, 2012 1:21 pm ] |
| Post subject: | Re: Help needed with iCustom |
Hello George, Yes, the indicator is on the chart and shows its current value on the upper left corner of the indi´s window, along with its continuous line. I tried with mode=0, yet nothing different happened. |
|
| Author: | gaheitman [ Mon Nov 19, 2012 1:39 pm ] |
| Post subject: | Re: Help needed with iCustom |
Actually, I meant to look in the data window (Ctrl-D) and see what data is listed there. I'll need to see the code where you initialize the Indi[] array as well as have a copy of the indicator to see what's wrong. Feel free to post here or PM me. George |
|
| Author: | K-Lander [ Mon Nov 19, 2012 1:51 pm ] |
| Post subject: | Re: Help needed with iCustom |
Actually, I meant to look in the data window (Ctrl-D) and see what data is listed there. I'll need to see the code where you initialize the Indi[] array as well as have a copy of the indicator to see what's wrong. Feel free to post here or PM me. George[/quote] Sorry... Yes, the indi´s history appears in the data window. Here I declare the variables. Maybe there is something related to the array missing?: int Indi[8]; int IndiHigh, IndiLow; For (i=1;i<9;i++) { Indi = iCustom(NULL,0,"INDINAME", 1, i); if (Indi > IndiHigh) IndiHigh = Indi; if (Indi < IndiLow) IndiLow = Indi; } |
|
| Author: | gaheitman [ Mon Nov 19, 2012 2:13 pm ] |
| Post subject: | Re: Help needed with iCustom |
Arrays are referenced from 0 to <array size> - 1. Also, you have to use the actual indicator name in the call to iCustom().... The following code will scan the last 8 values and alert you with the high and low values. Code: Select all |
|
| Author: | garyfritz [ Mon Nov 19, 2012 2:31 pm ] |
| Post subject: | Re: Help needed with iCustom |
Unless you have other plans for the Indi[] values, there's no need to use an array. You're only using the latest value of the indicator. You could replace Indi with Indi and it would work the same. |
|
| Author: | K-Lander [ Mon Nov 19, 2012 3:45 pm ] |
| Post subject: | Re: Help needed with iCustom |
Hello George. It seems to be working fine now. I guess the problem was in the array management. The indi´s name was ok. Thanks a bunch, really... K |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|