PriorValue

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Market Analyzer Column >

PriorValue

Previous page Return to chapter overview Next page

Definition

Contains the last value of CurrentValue. PriorValue is assigned the value of CurrentValue immediately before CurrentValue is updated.

 

Property Value

A double containing the last value contained in CurrentValue before its most recent update

 

Syntax

PriorValue

 

 

Example

ns


protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
{
  if (marketDataUpdate.MarketDataType == MarketDataType.Last)
  {
      CurrentValue = marketDataUpdate.Price;
 
      // Trigger an alert if the current Last price update is greater than the previous one
      if(CurrentValue > PriorValue)
          Alert("MA Alert", Priority.High, "Check Market Analyzer", "", 30, Brushes.Black, Brushes.White);
  }
}