Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Timeframe/Period input parameter

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

    Timeframe/Period input parameter

    How can I create an input parameter where users can choose a timeframe?

    use case for this would be to dynamically choose a timeframe that I'll use inside
    State.Configure
    AddDataSeries();

    what I actually need to do for my current script is to check if a new candle has appeared on the selected timeframe

    I've seen on this post
    https://forum.ninjatrader.com/forum/...e-in-indicator

    we can try to use custom PropertyEditor
    [PropertyEditor("NinjaTrader.Gui.Tools.InputEditor" )]

    can I setup a custom variable which will be BarsPeriodType
    and then have an int variable for the time?​

    EDIT: I've found out I can use NinjaTrader.Gui.Tools.BarsPeriodTypeSelector or NinjaTrader.Gui.Tools.BarsPeriodTypeEditor

    what is the difference between the 2?
    also it offers options like HeikenAshi, can I limit it to only time based values?

    Ideal would be the panel that opens up when you add an Additional Data series when making a new indicator with Use primary instrument already selected
    Click image for larger version

Name:	image.png
Views:	369
Size:	24.3 KB
ID:	1238013

    but I guess that's not possible
    Last edited by LuxSpuzy; 03-05-2023, 04:08 PM.

    #2
    Hello LuxSpuzy,

    Thanks for your post.

    Please note that you must hard code parameters in the AddDataSeries() method as stated in the help guide.

    From the AddDataSeries() help guide page: "Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided."

    AddDataSeries(): https://ninjatrader.com/support/help...dataseries.htm

    That said, user-defined Time inputs could be created on the Inputs section of the Inputs and Variables Screen of the Strategy Builder. See this attached screenshot.

    Note that this input cannot be used for added data series in the Additional Data screen of the Strategy Builder.

    'NinjaTrader.Gui.Tools.BarsPeriodTypeSelector' and 'NinjaTrader.Gui.Tools.BarsPeriodTypeEditor' are not documented or supported and goes beyond the support we would be able to provide in the Support department. Using undocumented/unsupported code would be up to your discretion.

    Ultimately, arguments should be hard-coded when calling the AddDataSeries() method in a custom NinjaScript as stated in the help guide.

    Let me know if I may assist further.
    Attached Files
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    546 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X