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 CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    169 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    88 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    128 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    208 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    185 views
    0 likes
    Last Post CarlTrading  
    Working...
    X