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 Barry Milan, Today, 10:35 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by WeyldFalcon, 12-10-2020, 06:48 PM
    14 responses
    1,428 views
    0 likes
    Last Post Handclap0241  
    Started by DJ888, Yesterday, 06:09 PM
    2 responses
    9 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by jeronymite, 04-12-2024, 04:26 PM
    3 responses
    40 views
    0 likes
    Last Post jeronymite  
    Started by bill2023, Today, 08:51 AM
    2 responses
    16 views
    0 likes
    Last Post bill2023  
    Working...
    X