PriceJump

An unusual price deviation in historical and live price data was detected. Automatically set by calling a price or contractUpdate function; sensitivity can be set with the Outlier variable. PriceJump can be evaluated in scripts for handling outliers and stock splits; afterwards reset it to 0 for 'arming' it for the next price deviation.

0 - No price jump since the last reset.
1 - Price outlier detected, see below.
2..10 - Stock split by the given factor detected, f.i. 4 for a 4:1 stock split.

Type:

int
 

Outlier

Sensitivity factor of the outlier detection for historical and for live prices (default = 1+2*sqrt(BarPeriod/1440)). All outliers above the given factor or below its reciprocal are suppressed with a 0.01 EMA factor. For instance, Outlier = 1.15; suppresses all outliers that deviate from the last price by more than 15% in any direction. PriceJump is set to 1 when an outlier was detected. Negative ask-bid spreads are suppressed. Set this to 0 for not fixing splits, outliers, and negative spread, and to 2 or above for treating splits as outliers. 

Type:

var
 

Remarks:

Example:

function run()
{
  ...
  Outlier = 1.05;  // detect and suppress price deviations by more than 5%
  if(PriceJump >= 2) { // stock split detected 
    printf("\nStock split %i:1 - close open contracts!",PriceJump);
    for(open_trades) cancelTrade(ThisTrade);
    PriceJump = 0;
    setf(TradeMode,PHANTOM); // suspend further trading
  }
  ...
}

See also:

tick, TickTime, price

 

► latest version online