| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| How can I capture an indicators max/min values ? https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=800 |
Page 1 of 1 |
| Author: | lucklogic [ Fri Sep 07, 2012 1:11 pm ] |
| Post subject: | How can I capture an indicators max/min values ? |
Hi, Suppose that I want to use WPR indicator whose output values that varies between 0 and 100 but I want to capture that max value and the min value within a predefined lookback of 300 blocks Eg max values achieved = -5 min value achieved = - 87 Now how could I do that ??? |
|
| Author: | NeoTrader [ Fri Sep 07, 2012 4:36 pm ] |
| Post subject: | Re: How can I capture an indicators max/min values ? |
This is only something that i think might work...didn't tested it but you should grasp the concept. Code: Select all happy trading, NeoTrader - |
|
| Author: | lucklogic [ Sat Sep 08, 2012 10:47 am ] |
| Post subject: | Re: How can I capture an indicators max/min values ? |
Thank you that is most helpful. I will have a play. Also might utilise function ; int ArrayMinimum( double array[], int count=WHOLE_ARRAY, int start=0) Searches for the element with minimum value. The function returns position of this minimum element in the array. |
|
| Author: | NeoTrader [ Sat Sep 08, 2012 12:16 pm ] |
| Post subject: | Re: How can I capture an indicators max/min values ? |
hi lucklogic, Sure, this would be also possible...you can also try to use your Lockback value as count and the shift value of the bar as start ... The same is also possible with ArrayMaximum for the Max Value. happy weekend, NeoTrader - |
|
| Author: | lucklogic [ Sat Sep 08, 2012 3:03 pm ] |
| Post subject: | Re: How can I capture an indicators max/min values ? |
Code: Select all Thanks again |
|
| Author: | NeoTrader [ Sat Sep 08, 2012 3:39 pm ] |
| Post subject: | Re: How can I capture an indicators max/min values ? |
hi lucklogic, It would be a cleaner solution to use ArrayResize(WprArray, LookBack)... this way the array will resize automatically to the value of your LookBack...in case you are going to change this value in your testing...or make it available es external Parameter Maybe you also need to set the Array as a timeSeries via ArraySetAsSeries(WprArray, true); happy weekend, NeoTrader - |
|
| Author: | gaheitman [ Sat Sep 08, 2012 4:38 pm ] |
| Post subject: | Re: How can I capture an indicators max/min values ? |
It's not clear (to me, at least) why we are using an array in the first place. The code posted does not actually reference the array in a useful manner, it is only looking at the value we just put in it. We could just use a simple double to hold the result of the call to GetWPR(i). In order to determine the best path forward, we need to know in what context you need this information. Are you using it in an EA, an indicator or a script? I would code them all differently. George |
|
| Author: | lucklogic [ Sat Sep 08, 2012 5:16 pm ] |
| Post subject: | Re: How can I capture an indicators max/min values ? |
Yes I see that you are (of course) correct. Both methods work, array or double and I'm happy that I can now capture the max/min. I want to use the info in an EA |
|
| Author: | gaheitman [ Sat Sep 08, 2012 5:39 pm ] |
| Post subject: | Re: How can I capture an indicators max/min values ? |
I don't know how CPU intensive the WPR calculation is but if you keep track of it in an array, you might want to use it as a circular buffer so you only update the new value (look at the CentralBankInterventionModule() code in some of the EAs Steve has done). George |
|
| Author: | lucklogic [ Sun Sep 09, 2012 9:00 am ] |
| Post subject: | Re: How can I capture an indicators max/min values ? |
I don't know how CPU intensive the WPR calculation is but if you keep track of it in an array, you might want to use it as a circular buffer so you only update the new value (look at the CentralBankInterventionModule() code in some of the EAs Steve has done). George Code: Select all |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|