Announcement

Collapse
No announcement yet.

Study on study problem

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

  • Study on study problem

    I'm playing around with a study that takes its input from another study. My code below doesn't seem to plot anything. Am i doing something wrong?
    TIA

    ------------------------------------

    // Indicator to plot Donchian channel over Accumulation/Distribution

    var accDistSeries = null;
    var upperBandSeries = null;
    var lowerBandSeries = null;

    function main()
    {
    if( getBarState() == BARSTATE_NEWBAR )
    {
    accDistSeries = accDist();
    upperBandSeries = upperDonchian( 10, accDistSeries );
    lowerBandSeries = lowerDonchian( 10, accDistSeries );

    val1 = accDistSeries.getValue(0);
    val2 = upperBandSeries.getValue(0);
    val3 = lowerBandSeries.getValue(0);

    return new Array( val1, val2, val3 );
    }

    return;
    }

  • #2
    eminitrader
    The enclosed revision fixes the problems. Comments are in the script
    For information on getBarState() see this article in the EFS KnowledgeBase
    Alex

    PHP Code:
    var accDistSeries null;
    var 
    upperBandSeries null;
    var 
    lowerBandSeries null;

    function 
    main(){

        if( 
    getBarState() == BARSTATE_ALLBARS){//should be ALLBARS not NEWBAR
            
    accDistSeries accDist();
            
    upperBandSeries upperDonchian10accDistSeries );
            
    lowerBandSeries lowerDonchian10accDistSeries ); 
        }
    //closes the ALLBARS condition

        
    var val1 accDistSeries.getValue(0);//added var
        
    var val2 upperBandSeries.getValue(0);//added var
        
    var val3 lowerBandSeries.getValue(0);//added var

        
    return new Array( val1val2val3 );
        
    }
    //end of function main

    //the following lines removed
    //return;
    //} 

    Comment


    • #3
      Great thanks Alexis

      Originally posted by Alexis C. Montenegro
      eminitrader
      The enclosed revision fixes the problems. Comments are in the script
      For information on getBarState() see this article in the EFS KnowledgeBase
      Alex

      PHP Code:
      var accDistSeries null;
      var 
      upperBandSeries null;
      var 
      lowerBandSeries null;

      function 
      main(){

          if( 
      getBarState() == BARSTATE_ALLBARS){//should be ALLBARS not NEWBAR
              
      accDistSeries accDist();
              
      upperBandSeries upperDonchian10accDistSeries );
              
      lowerBandSeries lowerDonchian10accDistSeries ); 
          }
      //closes the ALLBARS condition

          
      var val1 accDistSeries.getValue(0);//added var
          
      var val2 upperBandSeries.getValue(0);//added var
          
      var val3 lowerBandSeries.getValue(0);//added var

          
      return new Array( val1val2val3 );
          
      }
      //end of function main

      //the following lines removed
      //return;
      //} 

      Comment

      Working...
      X