Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Input for days ago comparison

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

    Input for days ago comparison

    Hello,

    Just trying to setup a simple strategy that compares the values of the current bar against the previous x number of bars. I am trying to use the analyzer to run through different values for previous bars back.

    Here's what the code looks like.
    Code:
    // Set 1
    if ((Low[0] < Low[X])
    && (Close[0] > SMA1[0]))
    {
    EnterLong(Convert.ToInt32(DefaultQuantity), "");
    }
    When using the strategy analyzer if I input anything other than X = 1 the analyzer won't take any trades.

    Any input would help

    Thanks

    #2
    Hello IBProfyn,

    Welcome to the NinjaTrader forums!

    Are you ensuring there are that many bars ago first, so that index error is not caused?
    Hello, I want to create an indicator that show data in a chart but calculate in other charttime different to the time of the chart where is showed. For example:


    if (CurrentBar < X)
    return;
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    91 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    137 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    121 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    72 views
    0 likes
    Last Post PaulMohn  
    Working...
    X