Displaying variable value defined under FOR loop

Hi guys,

I am trying to display the value of "pocn" for all symbols in the following exploration. Unfortunately, nothing shows up. Could anybody suggest a solution for this, I'm puzzled.

FirstVisibleBar = Status( "FirstVisibleBar" );
Lastvisiblebar = Status( "LastVisibleBar" );
BarsInDay = BarsSince( Day() != Ref( Day(), -1 ) ) ;
Bot = TimeFrameGetPrice( "L", inDaily, 0 );
Top = TimeFrameGetPrice( "H", inDaily, 0 );
Vol = TimeFrameGetPrice( "V", inDaily, 0 );
Range =  Top - Bot;
coverage = LastValue( Ref( ATR( 10 ), -1 ) );
den = ( coverage / 10 );
relTodayRange = 0;
x = 0;
basey = 0;
basex = 0;
Voloumeunit = 0;
pocn = Null;

for( i = IIf( FirstVisibleBar - 100 > 1, FirstVisibleBar - 100, FirstVisibleBar ); i < Lastvisiblebar AND i < BarCount - 1 ; i++ )
{
    if( BarsInDay[i] == 0 )
    {
        t = BarsInDay[i - 1];
        poc = 0;
        pocj = 0;
        midrange = int( relTodayRange / 2 ) + 1;

        for( j = 1; j <= relTodayRange + 1 ; j++ )
        {
            if( poc < x[j] )
            {
                poc = x[j];
                pocj = j;
            }
            else
                if( poc == x[j] )
                {
                    if( abs( midrange - j ) < abs( midrange - pocj ) )
                    {
                        poc = x[j];
                        pocj = j;
                    }
                }
        }
        pocn = LineArray( i, baseY + ( pocj ) * den, i + t, baseY + ( pocj ) * den );
        Plot( pocn, "", 7, styleLine | styleNoRescale );
        basex = 0;
        x = 0;
        Basex = i;
        baseY = Bot[i];
    }
}

Filter = 1;
AddColumn( pocn, "POC", 1.2 );

What I would like to achieve is that the exploration displays the value of "pocn" for each symbol.

Any thoughts on this would be greatly appreciated. Thanks for your time.

Most likely the formula is not doing what you think.
To get better understanding of what is happening in your code and how functions work, use advice given here: How do I debug my formula?

Run it under debugger single step and then you will find what is happening in your code.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.