Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Irukandji, Yesterday, 02:53 AM
    2 responses
    17 views
    0 likes
    Last Post Irukandji  
    Started by adeelshahzad, Today, 03:54 AM
    0 responses
    3 views
    0 likes
    Last Post adeelshahzad  
    Started by CortexZenUSA, Today, 12:53 AM
    0 responses
    3 views
    0 likes
    Last Post CortexZenUSA  
    Started by CortexZenUSA, Today, 12:46 AM
    0 responses
    1 view
    0 likes
    Last Post CortexZenUSA  
    Started by usazencortex, Today, 12:43 AM
    0 responses
    5 views
    0 likes
    Last Post usazencortex  
    Working...
    X