Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trying to get combined volume RTH but getting ETH

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Trying to get combined volume RTH but getting ETH

    Hi, I'm trying to get the max combined volume RTH session but I'm getting ETH.
    As volumetric are not the main dataseries, I added the following line where I specified a different Trading Hours template.
    AddVolumetric(null, BarsPeriodType.Day, 1, VolumetricDeltaType.BidAsk, 1, "CME US Index Futures RTH",true);

    I don't know what could be wrong. Any ideas?
    Thank you!


    This is my code:

    public class POCdeOF : Strategy
    {
    private double price;
    private double price0=0;
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Strategy here.";
    Name = "POCdeOF";
    Calculate = Calculate.OnEachTick;
    EntriesPerDirection = 1;
    EntryHandling = EntryHandling.AllEntries;
    IsExitOnSessionCloseStrategy = true;
    ExitOnSessionCloseSeconds = 30;
    IsFillLimitOnTouch = false;
    MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
    OrderFillResolution = OrderFillResolution.Standard;
    Slippage = 0;
    StartBehavior = StartBehavior.WaitUntilFlat;
    TimeInForce = TimeInForce.Gtc;
    TraceOrders = false;
    RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
    StopTargetHandling = StopTargetHandling.PerEntryExecution;
    BarsRequiredToTrade = 20;
    // Disable this property for performance gains in Strategy Analyzer optimizations
    // See the Help Guide for additional information
    IsInstantiatedOnEachOptimizationIteration = true;
    }
    else if (State == State.Configure)
    {

    AddVolumetric(null, BarsPeriodType.Day, 1, VolumetricDeltaType.BidAsk, 1, "CME US Index Futures RTH",true);
    }
    }

    protected override void OnBarUpdate()
    {
    if (Bars == null)
    return;

    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = BarsArray[1].BarsType as
    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;


    if (barsType == null)
    return;



    if (BarsInProgress == 1)
    {
    if(price0 !=barsType.Volumes[CurrentBar].GetMaximumVolume(null, out price))
    {
    Print("Maximum Combined: " + barsType.Volumes[CurrentBar].GetMaximumVolume(null, out price) + " at price: " + price);
    price0=barsType.Volumes[CurrentBar].GetMaximumVolume(null, out price);
    }
    }

    #2
    Hello gtheaded,

    Thanks for your post.

    Daily futures bars are always ETH based and you cannot change or apply another trading hours template to it so it would be expected that from a daily bar you would only get ETH values.

    I would suggest constructing a daily bar from minute bars as these you can then apply different trading hours. For example, a daily bar in minutes would be 1440. So please try:

    AddVolumetric(null, BarsPeriodType.Minute, 1440, VolumetricDeltaType.BidAsk, 1, "CME US Index Futures RTH",true);

    Comment


      #3
      Amazing! it is working now.
      Thank you!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X