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:	375
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 cmoran13, 04-16-2026, 01:02 PM
    0 responses
    51 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    31 views
    0 likes
    Last Post PaulMohn  
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    165 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    100 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    160 views
    2 likes
    Last Post CaptainJack  
    Working...
    X