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

GetMaximumVolume returns end of session result (It can predict the future)

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

    GetMaximumVolume returns end of session result (It can predict the future)

    Hi there

    I'm getting the current POC of the day by doing:

    Code:
    barsType = BarsArray[4].BarsType as BarsTypes.VolumetricBarsType;
    double priceOfCurrentDaysPOC;
    double currentDaysPOC = barsType.Volumes[CurrentBars[4]].GetMaximumVolume(null, out priceOfCurrentDaysPOC);
    And when backtesting I would expect the value to change as price finds a new maximum value.:
    But what I see is the end of session result every time? I'm running it on a 20 Range TickReplay chart and the [4] represents an added data series of :

    Code:
     AddVolumetric(null, Data.BarsPeriodType.Day, 1, Data.VolumetricDeltaType.BidAsk, 1); // BarsInProgress = 4
    e.g. End of session Max volume = 4000
    But from start of session all the way to end of session my code will return 4000 even if theres only been 1 tick on the day (so the poc price should be the open)

    basically it somehow knows what the end of session max volume is.

    Hope that makes sense.

    Thank you,

    Tarik
    Last edited by tarikmedjber; 07-21-2022, 01:04 PM.

    #2
    Hello tarikmedjber,

    Thank you for your post.

    Are you running the strategy on each tick or on price change, or are you running it on bar close?

    I'm not seeing the same in my example script, the endo of session max volume starts out low and increases as more bars are processed - do you see the same testing with this script?

    Thanks in advance; I look forward to assisting you further.
    Attached Files
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hey Kate,

      Oops I made an error here. It was GetMaximumVolume and my own indicator that gets the current days VAH that I saw the issue happening BUT turns out GetMaximumVolume is fine and there is no issue there, just an issue with my indicator (so its my problem).

      I have an indicator that gets the VAH for the current day and it is that that is seeing the issue.

      I'll keep this thread open for now just in case I find the issue which can help someone in the future. But if I don't i'll delete it

      But yes running on OnPriceChange strategy, calling an OnBarClose indicator (which only does work on the first tick of a daily volumetric data series). Turns out as well, its not updating the live values, it is simply just getting the VAH value that was there when first running the strategy, and not updating live.

      e.g. current time = 12pm, strategy is enabled and starts at 2am, it will return the VAH of the 12pm (curren time 10 hours into the future) and then when the strategy catches up to current time and is now running live and the VAH changes, the return value does not change,

      I think this is my problem so i shall try to solve it

      Comment


        #4
        Morning,

        Fixed my issue

        Code:
        else if (State == State.DataLoaded)
        {
        barsType = BarsArray[1].BarsType as BarsTypes.VolumetricBarsType;
        }
        and instead calling it in the local scope whenever i want to use bars type NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = BarsArray[1].BarsType as BarsTypes.VolumetricBarsType;

        This solved the issue of seeing future values and/ or the live value never being updated.

        Tarik

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ScottWalsh, Today, 06:52 PM
        0 responses
        1 view
        0 likes
        Last Post ScottWalsh  
        Started by ftsc2022, 10-25-2022, 12:03 PM
        5 responses
        255 views
        0 likes
        Last Post KeyonMatthews  
        Started by ScottW, Today, 06:09 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by Board game geek, 10-29-2023, 12:00 PM
        14 responses
        244 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Waxavi, 04-19-2024, 02:10 AM
        4 responses
        56 views
        0 likes
        Last Post sonia0101  
        Working...
        X