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

Render Draw Signals from 3rd Party Indicator with Secondary Data Series

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

    Render Draw Signals from 3rd Party Indicator with Secondary Data Series

    Hello:

    Newbie to Ninjascript but seasoned in C#. Missing something obvious here.

    3rd Party Indicator does not support non time based charts like Renko. So, trying to create a custom indicator that adds a secondary time data series and then assign this indicator to that data series so it will fire signals and send back to primary data series chart. (Had added the other data series to the chart and it did draw signals perfectly in both time frames (plot from panel 2 into panel 1) but equidistant (spacing) was horrid!)

    2 Problems:

    1. My custom indicator does not draw anything on primary chart (tested text in OnBarUpdate and it showed on each bar.)
    2. My custom indicator goes into infinite "calculating" on primary chart until you click the chart.

    Have tried tons of code in OnBarUpdate event and keep thinking something is needed there?

    Here is the core code:

    (snip)

    else if (State == State.Configure)
    {
    // Secondary Data
    AddDataSeries(Data.BarsPeriodType.Minute, 1);
    }
    else if (State == State.DataLoaded)
    {
    // Custom Indicator to Draw Signal
    drawSignal = 3rdPartyIndicator(BarsArray[1],false,null,0,etc....)
    }

    }

    protected override void OnBarUpdate()
    {
    if (CurrentBar < 1) return;

    // Something here????
    }

    (snip)

    Thanks,

    CQ

    #2
    NT:

    As follow-up, using NT 8 and have pounded your manual, your examples, loaded 3rd party examples, Indicator Club tutorial and YouTube.

    Might have missed/misunderstood NT framework fundamentals somewhere?

    Thanks,

    CQ

    Comment


      #3
      NT:

      Found more help about not being able to add indicator in an indicator.

      So, new code is NOT in endless "Calculating..." anymore, yet signals don't show?

      (snip)

      if (State == State.SetDefaults)
      {
      AddPlot(Brushes.Blue,"plotSignal");
      }
      else if (State == State.Configure)
      {
      // Secondary Data
      AddDataSeries(Data.BarsPeriodType.Minute, 1);
      }
      else if (State == State.DataLoaded)
      {
      // Custom Indicator to Plot
      plotSignal = 3rdPartyIndicator(BarsArray[1],false,null,0,etc....)
      }

      }

      protected override void OnBarUpdate()
      {
      if (CurrentBar < 1) return;

      Value[0] = plotSignal[1]; // Tried [0] too.
      }

      (snip)

      Thanks,

      CQ

      Comment


        #4
        Hello futures2018!,

        From the provided samples it is not apparent what the problem is. Being that the signals do not show up, this is likely related to how the custom indicator is setting its plot.

        I tried your snip replacing the indicator for the SMA and see that works:


        Code:
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                AddPlot(Brushes.Blue,"plotSignal");
            }
            else if (State == State.Configure)
            {
                // Secondary Data
                AddDataSeries(Data.BarsPeriodType.Minute, 1);
            }
            else if (State == State.DataLoaded)
            {
                // Custom Indicator to Plot 
                plotSignal = SMA(BarsArray[1],12);
            }
        }
        
        protected override void OnBarUpdate()
        {
            Value[0] = plotSignal[0];
        }
        You would likely need to review how your indicator is setting the plot value to better understand the problem. Depending on how it has been programmed may not allow for a signal to be passed in this use case.

        Are you able to see any values from the indicator when not passing the secondary BarsArray to the indicator? It may also not be programmed in a way to accept input. If the script is not using "Input" specifically (see SMA) it would not be able to use the passed in data.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Thank Jesse:

          Did try this yesterday.

          Think problem is the 3rd party indicator is draw objects over bar not plots. (Can see the draw objects on the charts when selecting and right clicking (tag names.))

          Not really sure how to implement this from indicator example, if even possible?

          CQ

          PS: Also read board inquires (today) and fully expected to be able to read the draw object collection off charts, if indicators cannot be implemented in ninjascript. Yet, it appears this is not possible. Can you verify that the chartobject and drawobjects collections will not have the signals on current chart when looping through them? This would nix strategies and render all 3rd party indicator purchases useless.

          Comment


            #6
            Hello futures2018!,

            Think problem is the 3rd party indicator is draw objects over bar not plots. (Can see the draw objects on the charts when selecting and right clicking (tag names.))
            That would likely be the problem. It may be possible to observe these objects from your script, however keep in mind it is not a reliable way to pick up signals. reading the drawing object collection at different times in the scripts life-cycle can produce different results.

            There are some samples on this page of how to access this collection of drawing objects: https://ninjatrader.com/support/help...ub=drawobjects

            This will not work in Historical data, this should work going forward in realtime.

            If you plan to export the script as a compiled assembly while using this syntax, you also need to use the considerations page and dynamic: https://ninjatrader.com/support/help...assemblies.htm

            For a third party indicator to be able to be used for a signal, the developer really needs to expose the data as a plot or series. Using markers on a chart can be a good way to depict manual trading scenarios but this is generally not suggested for use as an automated signal. You can ask the developer of this item if they can update the script to include the data as a Plot as one option as well.


            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              NT:

              Thank you for this detailed and sufficient explanation. Will run down these links when possible.

              The remark "Will not work in historical data..." concerns me since back testing a strategy is crucial.

              Thanks again,

              CQ

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by jclose, Today, 09:37 PM
              0 responses
              5 views
              0 likes
              Last Post jclose
              by jclose
               
              Started by WeyldFalcon, 08-07-2020, 06:13 AM
              10 responses
              1,414 views
              0 likes
              Last Post Traderontheroad  
              Started by firefoxforum12, Today, 08:53 PM
              0 responses
              11 views
              0 likes
              Last Post firefoxforum12  
              Started by stafe, Today, 08:34 PM
              0 responses
              11 views
              0 likes
              Last Post stafe
              by stafe
               
              Started by sastrades, 01-31-2024, 10:19 PM
              11 responses
              169 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Working...
              X