Using the TradeStation OHLCPeriodsAgo function
This quicktips demonstrates how to use the TradeStation OHLCPeriodsAgo function to find the high/low/open/close for the previous day/week/month or year. The technique works on time based charts, e.g. minute, daily, weekly charts (i.e. NOT Kagi, Kase, Volume bars etc).
The quick-tips 10 program
vars: oPeriodOpen1(0), oPeriodHigh1(0), oPeriodLow1(0), oPeriodClose1(0), oPeriodOpen2(0), oPeriodHigh2(0), oPeriodLow2(0), oPeriodClose2(0); // OHLCPeriodsAgo( PeriodType, PeriodsAgo, oPeriodOpen, oPeriodHigh, oPeriodLow, oPeriodClose ) // PeriodType sets the time period on which to base values (1 = Day, 2 = Week, 3 = Month, 4 = Year) Value1 = OHLCPeriodsAgo( 2, 1, oPeriodOpen1, oPeriodHigh1, oPeriodLow1, oPeriodClose1 ); Value3 = oPeriodHigh1; Value4 = oPeriodLow1; Plot1( Value3 ); Plot2( Value4 ); Value1 = OHLCPeriodsAgo( 3, 1, oPeriodOpen2, oPeriodHigh2, oPeriodLow2, oPeriodClose2 ); Value5 = oPeriodHigh2; Value6 = oPeriodLow2; Plot3( Value5 ); Plot4( Value6 );