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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    45 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    21 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    31 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X