# BuySellPressure

#### Description <a href="#description_11" id="description_11"></a>

The BuySellPressure indicator displays the buy or sell pressure for the current bar. Furthermore, these trades are classified as "buy" or “sell”. For this classification, a "buy" is assumed any time the transaction has occurred at or above the ask. Inside trades are not taken into account.

**Caution: This is a real-time indicator. It will only work on and with real-time data and cannot therefore be used for historical information.**

**When the properties dialog for the indicator is open and changes are made, then the indicator must be reloaded. Doing so will delete all previously accumulated data.**

See [*BuySellVolume*](https://indicators.agenatrader.com/standard-indicators/buysellvolume).

#### Usage <a href="#usage_12" id="usage_12"></a>

```csharp
BuySellPressure()
BuySellPressure(IDataSeries inSeries)

//For the values of buy pressure
BuySellPressure().BuyPressure[int barsAgo]
BuySellPressure(IDataSeries inSeries).BuyPressure[int barsAgo]

//For the values of sell Pressure
BuySellPressure().SellPressure[int barsAgo]
BuySellPressure(IDataSeries inSeries).SellPressure[int barsAgo]
```

#### Return value <a href="#return-value_12" id="return-value_12"></a>

**double**

When using this method with an index (e.g. **BuySellPressure**().BuyPressure\[**int** barsAgo] ), the value of the indicator will be outputted for the referenced bar.

**Caution:** **If BuySellPressure is used with EoD data, the value 50 will always be outputted.** - BuySellPressure().SellPressure\[0] = 50 - BuySellPressure().SellPressure\[0] = 50

#### Parameters <a href="#parameters_11" id="parameters_11"></a>

inSeries Input data series for the indicator

#### Visualization <a href="#visualization_13" id="visualization_13"></a>

![BuySellPressure](https://agenatrader.github.io/AgenaIndicator-documentation/media/BuySellPressure.jpg)

#### Example <a href="#example_12" id="example_12"></a>

```csharp
protected override void OnInit()
{
  BuySellPressure().CalculateOnClosedBar = false;
}

protected override void OnCalculate()
{
  if (Close[0] > DonchianChannel(20).Upper[5])
  {
    if (IsHistoricalMode || BuySellPressure().BuyPressure[0] > 70)
    OpenLong();
  }
}
```
