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 NullPointStrategies, Today, 05:17 AM
    0 responses
    52 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    70 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    43 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    48 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X