Announcement

Collapse
No announcement yet.

Problem with Bollinger Functions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with Bollinger Functions

    This is concerning functions upperBB, lowerBB, and middleBB.

    I have been working with a script that utilizes these functions. A user input value for one of the function parameters in the premain() function calls for the input of the period length of these functions.

    Everything was operating normally, until today when I realized that if I ever change the value of this parameter, all the functions that use upperBB, lowerBB, or middleBB go "dead". It seems that if I use any value other than the original default value, these functions return nothing. I ran a test script I created, using just:

    function main() {
    uBB=upperBB(100,2,hl2());
    return uBB.getValue(0);
    }

    Now, if I use any other value besides 100 in there for the period length, the EFS returns null. If I set the value back to 100, the EFS returns the upper bollinger value. What is happening?

    I noticed something similar to this before with another EFS I created. Whenever I would enter a value other than the last saved value in a function parameter box, the script would return nothing. As soon as the value was restored, the EFS behaved normally. This is very frustrating.

  • #2
    Bring up the Formula Output window.

    Now, answer these 2 questions:

    1. Why is the counter value 100 in the Formula Output window after you click the left mouse button in the chart?

    2. What's all that bInit "junk" doing?

    PHP Code:
    var bInit false;
    var 
    counter 0;
    var 
    uBB;
    function 
    preMain()
    {
      
    setStudyTitle("uBB Test");
      
    setPriceStudy(true);
    }
    function 
    main()
    {
      if (
    bInit == false)
      {
        
    uBB upperBB(100,2,hl2());
      }
      if (
    uBB.getValue(0) == null)
      {
        
    counter++
      }
      return 
    uBB.getValue(0);
    }
    function 
    onLButtonDown(barIndexyValue)
    {
      
    debugPrintln("counter = " counter);

    Last edited by SteveH; 04-24-2011, 10:04 PM.

    Comment

    Working...
    X