| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Need help: data zeroes by Empty4 https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3326 |
Page 1 of 1 |
| Author: | giailang [ Thu Dec 12, 2013 4:28 pm ] |
| Post subject: | Need help: data zeroes by Empty4 |
When I try to calculate within my snippet, I found that Empty4 zeroes my fragment after decimal, though all variables are double. The same fragment runs ok within indicator. Please advise how to cope with this, without using NormalizeDouble? TIA, |
|
| Author: | phil_trade [ Thu Dec 12, 2013 4:34 pm ] |
| Post subject: | Re: Need help: data zeroes by Empty4 |
Hi giailang you should publish this code snippet So that we can understand cheers Philippe |
|
| Author: | giailang [ Thu Dec 12, 2013 4:55 pm ] |
| Post subject: | Re: Need help: data zeroes by Empty4 |
Thanks, it's so simple so I did not post. Here it goes Code: Select all I did add IndicatorDigits(Digits+1) to the code, but nothing change. When put inside the indicator, it works normally, but the iCustom has drawback of consuming too much RAM, increase each time the indicator is called. Thanks for your help. |
|
| Author: | garyfritz [ Thu Dec 12, 2013 5:19 pm ] |
| Post subject: | Re: Need help: data zeroes by Empty4 |
testbuf[] is a POINTER to an array of doubles, not the array itself. MQL should have thrown an error when you accessed the un-initialized pointer, but, well, MQL. If you just need an array of doubles, you would declare it as "double testbuf[100]". But you probably need an array that corresponds to your display buffers? If you want to display the values in testbuf[], you should use SetIndexBuffer(). That will tell MQL to allocate space to the array, and grow it by one every time a new bar is added to the chart. If you just want to use it for calculation, you have to allocate the space yourself. And I've forgotten the function for that and I just got an emergency call and have to leave. Someone will remember. |
|
| Author: | phil_trade [ Thu Dec 12, 2013 5:22 pm ] |
| Post subject: | Re: Need help: data zeroes by Empty4 |
I don't know if it's the bug with another varibale, but you Have "sym" param in TestData but use "symb" variable in it. Just a typo ? |
|
| Author: | milanese [ Thu Dec 12, 2013 5:31 pm ] |
| Post subject: | Re: Need help: data zeroes by Empty4 |
you should add in init() this: Code: Select all Cheers Tommaso |
|
| Author: | phil_trade [ Thu Dec 12, 2013 5:35 pm ] |
| Post subject: | Re: Need help: data zeroes by Empty4 |
You need to initialize array like this : Code: Select all Code: Select all cheers Philippe |
|
| Author: | giailang [ Fri Dec 13, 2013 3:34 am ] |
| Post subject: | Re: Need help: data zeroes by Empty4 |
Thanks Phil, that's my typo, in the real code it is sym. Thanks Garry for pointing out my declaration is only pointer, not array.Thanks Tomasso for the init code. Actually, I am trying to convert BB_MACD indicator into Signal detector. When finish my mod, I'll post it asap. |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|