Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Linking complex custom indicator to strategy

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

    Linking complex custom indicator to strategy

    I've build a complex custom indicator and now I'm trying to build a simple strategy using it in order to be able to backtest it. The challenge I'm having is that unlike RSI, SMA, etc. indicators, this indicator prints a Dot when a series of events happen, so there is not really a value returned from the indicator.

    To simplify:

    If (series of events == true)
    {
    'print dot'
    }

    When the dot is printed, I go long/short at the close of the range bar.

    I need to write a strategy, that would be able to link to this 'ultimate' condition in the indicator in which the dot is being printed. Is there a way to link my strategy to this indicator?


    Thanks for any help!

    #2
    Hello ds1111,

    Thank you for your post.

    Your indicator would need to produce a value that can be accessed by your strategy such as a boolean that indicates a condition is true:

    Indicator: if (series of events == true) { customBool.Set(true); }
    Strategy: if (yourIndicator().customBool[0]) { Print("Do something"); }

    We recommend using a BoolSeries so that there is a value for each bar. For a reference on using a BoolSeries in your indicator and accessing that in your strategy please visit the following link: http://www.ninjatrader.com/support/f...ead.php?t=4991

    For a reference on adding indicators to strategies please visit the following link: http://www.ninjatrader.com/support/f...ead.php?t=3228

    For a reference on BoolSeries please visit the following link: http://www.ninjatrader.com/support/h...ries_class.htm

    Please let me know if I may be of further assistance.

    Comment


      #3
      Awesome... exactly what I need! NT Rocks! Thanks.

      Comment


        #4
        Still need help - problem with calling complex indicator in strategy

        Can you let me know what am I doing wrong (see attachment)?


        Do I need to load the entire 'overload' for the indicator?

        Do you have an example with a more complex indicator (with several parameters) being called on a strategy?
        My indicator has 15 parameters, I hope there is a easy way to call the exposed boolseries without referring to the entire signature of the indicator.

        Thanks.
        Attached Files
        Last edited by ds1111; 04-04-2012, 06:42 PM.

        Comment


          #5
          Hello ds1111,

          Thank you for your response.

          Instead of defining multiple parameters for your indicator you can create another indicator that uses the same parameters but has a reduced set of user inputs. The parameters would be pre-defined in your indicator and there would be no need to set them when calling the indicator in your strategy. You could consider this a system version, where only a few inputs are 'settable'.

          Another option would be to create an overload for Intellisense that would allow you to quickly enter your indicators method and parameters.
          For information on creating input parameters please visit the following link: http://www.ninjatrader.com/support/f...ead.php?t=5782
          For information on sequencing parameters please visit the following link: http://www.ninjatrader.com/support/f...ead.php?t=4770
          For information on Intellisense please visit the following link: http://www.ninjatrader.com/support/h...tellisense.htm

          In addition you could set the parameters to be called once and then use a variable that is called, using the Pivots indicator for example:

          protected override void OnStartUp()
          {
          testInd = Pivots(PivotRange.Daily, HLCCalculationMode.CalcFromIntradayData, 0, 0, 0, 1);
          }


          Now instead of calling Pivots and defining each parameter, I can simply call the variable testInd.

          Please let me know if I may be of further assistance.

          Comment


            #6
            wow... all great options... let me try one of them, and I will post here if I have any problems...
            tx a lot!

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            649 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            370 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            109 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            573 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            576 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X