price index for a query of Historical data displayIndex = [0, VisibleBarsCount - 1] -1 If the bar is no such index (a hole or out of bounds)


SYNTAX


public int GetBarOffset (int displayIndex)


PARAMETERS


displayIndex — int


RETURN


int


EXAMPLE


using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using PTLRuntime.NETScript;
using PTLRuntime.NETScript.Charts;

namespace GetBarOffsetExamples
{
     public class GetBarOffsetExamples : NETStrategy
     {
         public override void OnQuote()
         {
         int bar_off = CurrentChart.GetBarOffset(1);
         Print(bar_off);
    
         Instrument inst = Instruments.Current;
         BarData Bars = GetHistoricalData(new HistoricalDataRequest(inst,Period.Day)) as BarData;
         Print(Bars.Close(bar_off));    
         }
     }
}