Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using a custom indicator in Strategy Builder

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

    Using a custom indicator in Strategy Builder

    Hello,

    I have a custom indicator. The basic logic is this:

    protected override void OnBarUpdate()
    {

    Trend[0] = 0;
    if (Value[0] > Value[1])
    Trend[0] = 1;
    else if (Value[0] < Value[1])
    Trend[0] = -1;
    Print(Trend[0]);
    }


    So in my output box i get either a 1 or -1 every time the bar updates. That all works well. My question is what can I add to the code so that when I call this indicator through the strategy builder I can go long for 1 and short for -1. Or do I have to copy this code and variable into a strategy? See the attached pic for a visual explanation.

    #2
    Hello evanp90,

    Thanks for your post.

    To be able to read the +1/0/-1 signal, you would need to provide a plot from the indicator to the strategy builder (Tip: would also work in the Market analyzer).

    If "Trend" is not already a plot, you could certainly add a plot and assign the same values. The plot can be used with a "Transparent" brush meaning it would not visibly show on a chart but its value would still be available to the strategy builder (or market analyzer). For an example of using a transparent plot to provide an input to either the strategy builder or the market analyzer you can review the coding for the indicator "CandleStick Pattern" in your NinjaTrader. In addition here is a link to a thread showing the process in a video: http://ninjatrader.com/support/forum...762#post453762

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    602 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    347 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    560 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    559 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X