Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

VWAP improvements (anchored, custom session, prior session highlight, Labels)

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

  • NinjaTrader_ChelseaB
    replied
    Hello StoneMan78,

    It looks like you are on the right path.

    Leave a comment:


  • StoneMan78
    replied
    Chelsea B.

    Thank you for the links, the dotnetperls tutorial was particularly useful. I believe the "C# program that uses List indexes and for-loop" example it provides would be a good framework for the anchoring logic of this indicator. The for-loop would examine each bar on the chart, and index bar numbers to the list where Bars.IsFirstBarOfSession is true. From there[list.count - UserInput] would return the bar number to anchor the VWAP on. Does this basic summary of the anchoring logic seem right you?

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    StoneMan78,

    Below is a link to the microsoft documentation List<T>.
    Represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and manipulate lists.


    And a link to the dotnetperls tutorials.


    They would be in the order they are added.

    The 2rd last session would be found with the[list.Count - 2]. The third last session would be[list.Count - 3]..

    Leave a comment:


  • StoneMan78
    replied
    Hello Chelsea B.

    I see what you are saying, the current bar function (pasted below) could be used to store only the bar numbers when when Bars.IsFirstBarOfSession is true.



    You then say in the last reply, "You could add each session close bar number to a list." I like that idea. My question is, how would you create that list? If there 50 bars in a chart and bar (0, 9, 19, 29, 39) are all the first bars of the session. How you go about finding which is the first, second, third, etc. entry in that list? Is there a way we can successfully navigate a dynamic list like this? If so, could you explain it to me? At this point I guess this is more of a fundamental question about coding but it seems to be the lynch pin to tie this logic together. Thanks for your help by the way!

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello StoneMan78,

    The bool would give the user the choice of the default behavior or your custom behavior.

    How you approach looping through the data could be gone about in different ways. You could add each session close bar number to a list when Bars.IsFirstBarOfSession is true on each bar close perhaps.
    Then you could have the vwap be from that saved bar. If the user selects 3 it uses the index of the list count minus 3 for 3 sessions ago..

    Leave a comment:


  • StoneMan78
    replied
    Hello Chelsea B.

    Thank you for your reply. Let me know if we are on the same page here, and if this logic lines up with what you are suggesting.

    To begin we count with an int how many "trues" you get from a bool, which returns as true when Bars.IsFirstBarOfSession is true.

    Then, the logic I am thinking of is the user inputs an int which will denote where they want the loop to stop. So if the user inputs 3, the algorithm will loop through three sessions, then stop the loop with some code like this -> (userinput == count). Then, the VWAP logic can begin at the first bar from three sessions ago.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello StoneMan78,

    You would need to design the custom logic.

    A bool input could be used in a condition that when true would reset at the first bar of a session when Bars.IsFirstBarOfSession is also true..

    An int input could be used to have a counter that counts the number of sessions if you are doing a loop through the data.

    There is sample code of using a counter.

    Leave a comment:


  • StoneMan78
    replied
    Hello Chelsea B.,

    Thank you for that suggestion. My next questions revolves around a design choice when it comes to anchoring the VWAP. You could either have the user input (from above) count how many sessions back you want to anchor the VWAP, or, you could tie the anchor point directly to a specific date. I think to start it would be easier to count how many sessions back you you want to anchor from the current one. Any suggestions on how (Bars.IsFirstBarOfSession) could be manipulated using the NinjaScriptProperty attribute method you showed in your last reply to achieve this?

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello StoneMan78,

    You could add a public bool using the NinjaScriptProperty attribute and an auto-getter and setter to make an input for the user.

    Below is a link to the help guide on the NinjaScriptProperty attribute which has sample code.

    Leave a comment:


  • StoneMan78
    replied
    Hello all, I've searched the forums and found a script for VWAP in NT8. Figured this could be a useful addition to this conversation and that this script would be a good starting place to build an anchored VWAP. In the code, of I'm not mistaken,
    (Bars.IsFirstBarOfSession) is used to anchor the VWAP to the start of the most recent section in the chart. The question then, for the ninjatrader team, is how can you go about turning this static parameter into something dynamic that the user can adjust? I've hacked together some basic indicators in Ninja script before (I'm by no means an experienced coder) and would love to help bring an open source anchored VWAP to the community with some assistance. Thank you.

    Hello I understand that there is a VWAP indicator available as part of the OrderFlow option. But before I shell the $ to buy the needed lifetime license, I am trying to look for any free VWAP indicator that I can put to test as part of my evaluating the NT platform (new to NT). I am effectively looking for a VWAP indicator
    Attached Files

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello RangerTrader,

    Welcome to the NinjaTrader forums!

    Your vote is submitted as well for SFT-4766.

    Thanks for your vote.

    Leave a comment:


  • RangerTrader
    replied
    Please add my vote for an Anchored VWAP SFT-4766, would be great if it was a drawing tool.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello iq200,

    Thanks for your voice.

    I've submitted your vote for SFT-4766.

    Leave a comment:


  • iq200
    replied
    Hi Chelsea - Please add my vote for this. Thanks.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello DeskTroll,

    Please note, we receive many requests and cannot reasonably implement all requested features or changes. Interest is tracked internally and if enough interest is tracked, it would be weighed against how feasible it would be to make those changes to consider implementing, so we cannot offer an ETA or promise of fulfillment.

    When new features are implemented, they will be listed in the Release Notes page of the Help Guide. The ID number may be different than the internal feature request tracking ID, but the description of the feature will let you know if that feature has been implemented.

    Release Notes - https://ninjatrader.com/support/help...ease_notes.htm

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by charlesugo_1, 05-26-2026, 05:03 PM
0 responses
82 views
0 likes
Last Post charlesugo_1  
Started by DannyP96, 05-18-2026, 02:38 PM
1 response
154 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by CarlTrading, 05-11-2026, 05:56 AM
0 responses
162 views
0 likes
Last Post CarlTrading  
Started by CarlTrading, 05-10-2026, 08:12 PM
0 responses
101 views
0 likes
Last Post CarlTrading  
Started by Hwop38, 05-04-2026, 07:02 PM
0 responses
289 views
0 likes
Last Post Hwop38
by Hwop38
 
Working...
X