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

Referncing indicator with multiple plots in strategy

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

    Referncing indicator with multiple plots in strategy

    Slowly progressing from indicators to strategy.

    I have now build an indicator that has multiple plots and I want to reference those individual plot values in a strategy.


    double dblAtrCross = AtrCross(atrLength)[0]; // Get Indicator values 1 plot

    The above statement works ok but has 1 plot only

    double
    xyz = AtrCrossSignals(AtrCrossSignals.Plot0)[0];

    This one does not and I tried several combinations. Can some one help here?

    Thanks,
    leduc


    #2
    Hello Leduc,

    Thank you for your post.

    You should declare xyz in the variables region.
    private double xyz;

    If you want to assign Plot0 of indicator AtrCrossSignals to xyz, you would use the following:
    xyz = AtrCrossSignals(yourParametersHere).Plot0[0];
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Referencin indicator

      yes, got it now!!

      thanks
      leduc

      xyz = AtrCrossSignals(Close).Plot0[0];

      Last edited by leduc; 04-26-2010, 03:41 PM.

      Comment


        #4
        mmm, Still one question then.

        I am using an indicator plot to draw arrows in a strategy. It seems how ever that only the last signals are plotted....

        The indicator plot +200 for a buy and -200 for a sell. This works fine for the last buy and last sell signal but history is not plotted on the chart...

        This I find strange since the coloring of bars works fine which is also triggered by a indicator vaue...

        Any help is appreciated again.

        Attached is a screen print on how it ooks. Notice the small purple dots in the indicator below. On the far left there is a purple dot which is not marked with an up arrow on the chart...

        Coding below

        protectedoverridevoid OnBarUpdate()
        {
        double dblAtrRev = AtrCrossSignals(Close).Plot2[0];
        if (dblAtrRev == 200)
        {
        DrawArrowUp(
        "Up",false,0,Low[0]- 10* TickSize,Color.Green); }
        if (dblAtrRev == -200)
        {
        DrawArrowDown(
        "Down",false,0,High[0]+ 10* TickSize,Color.Red); }
        }
        }
        Attached Files

        Comment


          #5
          Hello Ludec,

          To resolve this you need a unique name for each object. Note your snippet below with + CurrentBar added to the name.

          protectedoverridevoid OnBarUpdate()
          {
          double dblAtrRev = AtrCrossSignals(Close).Plot2[0];
          if (dblAtrRev == 200)
          {
          DrawArrowUp(
          "Up" + CurrentBar,false,0,Low[0]- 10* TickSize,Color.Green); }
          if (dblAtrRev == -200)
          {
          DrawArrowDown(
          "Down" + CurrentBar,false,0,High[0]+ 10* TickSize,Color.Red); }
          }
          }
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            Very, Very helpfull:-) That did it, thanks again.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by hazylizard, Today, 08:38 AM
            2 responses
            8 views
            0 likes
            Last Post hazylizard  
            Started by geddyisodin, Today, 05:20 AM
            2 responses
            18 views
            0 likes
            Last Post geddyisodin  
            Started by Max238, Today, 01:28 AM
            5 responses
            47 views
            0 likes
            Last Post Max238
            by Max238
             
            Started by giulyko00, Yesterday, 12:03 PM
            3 responses
            13 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by habeebft, Today, 07:27 AM
            1 response
            16 views
            0 likes
            Last Post NinjaTrader_ChristopherS  
            Working...
            X