//This namespace holds Indicators in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Indicators
{
public class ComprasGraf1000 : Indicator
{
private BuySellVolume buySellVolume;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Alerta cuando el volumen de ventas en una barra es menor que 200 contratos.";
Name = "ComprasGraf1000";
Calculate = Calculate.OnEachTick;
IsOverlay = false;
//AddPlot(Brushes.Orange, "VentaPlot");
}
else if (State == State.DataLoaded)
{
buySellVolume = BuySellVolume();
}
}
protected override void OnBarUpdate() zz0.hsllsi65gcmzz
{
if (CurrentBars[0] < 1)
return;
// Acceso al volumen de ventas actualizado de BuySellVolume
double volumenDeVentas = buySellVolume.Sells[0];
if (volumenDeVentas < 200)
{
Alert("CompraAlta", Priority.High, "Compras Grafico 1000: " + volumenDeVentas.ToString("N0") + " contratos", "Alert1.wav", 10, Brushes.Green, Brushes.White);
}
}
With this code what it does is write the updated sales number every few seconds (after having configured the indicator in the graph and having selected CONFIGURATE ON EACH TICK)
If I insert the indicator and in the CONFIGURATE option I select ON BAR CLOSE, it sends a message to the alert file every time a new bar is started PURCHASES GRAPH 1000:0 CONTRACTS
and what I want it to do is ONLY send me an ALERT when at the end of a bar the number of sales is less than 200
Thank you very much for the help

Comment