Passing a parameter to an indicator with iCustom()

 

I have a Custom Indicator that displays different values depending on what Period() is used in the chart it is attached to.

I have no extern variable to set the the period because it just uses Period() to set up the indicator.

How can I pass a value to the indicator to let it know which Period to use to get the value I want?

 
Change the indicator so it uses an extern that sets the Period.
 
RaptorUK:
Change the indicator so it uses an extern that sets the Period.
Actually I decided to put the actual calculation in a function in an include file, that way I can call it directly and don't have to put in any error checking to make sure the user doesn't accidentally enter an invalid Period into an extern variable.
 
FoxGuy:

I have a Custom Indicator that displays different values depending on what Period() is used in the chart it is attached to.

I have no extern variable to set the the period because it just uses Period() to set up the indicator.

How can I pass a value to the indicator to let it know which Period to use to get the value I want?

  1. No extern variables needed
  2. iCustom( symbol, timeframe, ....
 
WHRoeder:
  1. No extern variables needed
  2. iCustom( symbol, timeframe, ....
I have been trying to make that work, but no matter what I do I keep getting 0. I'm guessing that it has something to do with the fact that the indicator uses Period() to determine what buffers, line styles, etc to use, but I'm not sure. It just seems to make more sense to me to move the actual calculation into an Include file and pass it a timeframe and bar#, then I can call it from any function and not have to load the indicator.
Reason: