Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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);
    Paul H.NinjaTrader Customer Service

    Comment


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

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Brevo, Today, 01:45 AM
      0 responses
      4 views
      0 likes
      Last Post Brevo
      by Brevo
       
      Started by aussugardefender, Today, 01:07 AM
      0 responses
      3 views
      0 likes
      Last Post aussugardefender  
      Started by pvincent, 06-23-2022, 12:53 PM
      14 responses
      241 views
      0 likes
      Last Post Nyman
      by Nyman
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      9 responses
      384 views
      1 like
      Last Post Gavini
      by Gavini
       
      Started by oviejo, Today, 12:28 AM
      0 responses
      6 views
      0 likes
      Last Post oviejo
      by oviejo
       
      Working...
      X