Question About iCustom

 

Hi there,


So I made a custom indicator, and the proper value of this custom indicator is contingent upon its value in previous bars...


So for example let's say this custom indicator's algorithm is as followed,


1st day of calculation: Value = The Closing price of security = 2

2nd day: 1st day's Value +1 = 3

3rd day: 2nd day's value +1 = 4

4rth day: 3rd day's value +1 = 5


Then on the last day (4th day), the value of the custom indicator is supposed to be 5


Now, when I use the iCustom function on the 5th day and use 1 as the shift (so it's supposed to call its value in the previous day (Day 4)), instead of returning the value 5 as intended, it's returning the Closing price of the security on day 4, which is not 5...


Is there a way to call the custom indicator from an expert advisor such that it calculates the value from the beginning and hence makes it return 5 instead of the previous day's Closing price?

Is there a way to choose how many bars ago the indicator should begin calculating when you call it via iCustom?

 
childofprodigy:

Hi there,


So I made a custom indicator, and the proper value of this custom indicator is contingent upon its value in previous bars...


So for example let's say this custom indicator's algorithm is as followed,


1st day of calculation: Value = The Closing price of security = 2

2nd day: 1st day's Value +1 = 3

3rd day: 2nd day's value +1 = 4

4rth day: 3rd day's value +1 = 5


Then on the last day (4th day), the value of the custom indicator is supposed to be 5


Now, when I use the iCustom function on the 5th day and use 1 as the shift (so it's supposed to call its value in the previous day (Day 4)), instead of returning the value 5 as intended, it's returning the Closing price of the security on day 4, which is not 5...


Is there a way to call the custom indicator from an expert advisor such that it calculates the value from the beginning and hence makes it return 5 instead of the previous day's Closing price?

Is there a way to choose how many bars ago the indicator should begin calculating when you call it via iCustom?

I've got the exact same problem. I need my custom indicator to look through several bars back to give me an accurate value. When I call icustom from an EA it dones't do that, it only looks at the most recent bar.


I've even found this bug using the standard iMA Moving average indicator. If you use a large enough period, such as 2000, then the value that the iMA gives the EA and the value for the indicator for any bar will be different.