Passing a parameter to an indicator with iCustom()

To add comments, please log in or register
Bill Morris
287
Bill Morris  

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?

Simon Gniadkowski
17683
Simon Gniadkowski  
Change the indicator so it uses an extern that sets the Period.
Bill Morris
287
Bill Morris  
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.
William Roeder
18674
William Roeder  
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, ....
Bill Morris
287
Bill Morris  
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.
To add comments, please log in or register