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

Draw Objects in multi-timeframe indicators

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

    Draw Objects in multi-timeframe indicators

    Hello,
    I have a multi-timeframe indicator with four plots including the primary one. All works fine apart from when I code Draw.ArrowUp or Draw.ArrowDown signals. The arrows all occur at the correct bars, but all occur at the bottom of the screen instead of the Y axis position where I have coded them to appear. Is this an issue with the multi-timeframe?

    Below is a sample of the code I have used for the Arrow signal.
    Code:
    if(((Values[3][0] < 50 || Values[1][0] < 50) && CrossBelow(Values[0], 50, 1)) //660T or 5Min < 50 & Main CrossBelow 50
    			|| (Values[0][0] < 50 && (CrossBelow(Values[3], 50, 1) || CrossBelow(Values[1], 50, 1)))) //Main < 50 & 660T or 5Min CrossBelow 50
    				
    			{
    				Alert("myAlertStochK02", Priority.High, "StochK cross 50 bear signal", NinjaTrader.Core.Globals.InstallDir+@"\sounds\Alert1.wav", 10, Brushes.Red, Brushes.Black);
    				ArrowDown myTriangleDownB = Draw.ArrowDown(this, "MyTriangleDown" + CurrentBar, false, 0, High[0] + TickSize, Brushes.Magenta);
    				myTriangleDownB.OutlineBrush = Brushes.Black;
    			}
    Thank you.

    #2
    Hello GeorgeW,

    Thanks for your post.

    With a multi time frame indicator, do you have the code shown in your post segmented by the BarsInProgress? Each bars object will call the OnBarUpdate() so when you use High[0] as a reference to a y location, each bars object will provide a High[0] that points to that bars object unless the code you show is only run when BarsInProgress == 0.

    Can you provide a screenshot of the chart?
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello Paul,

      Thanks for your response.

      I have wrapped all the OnBarUpdate code within if (BarsInProgress == 0), so it should presumably be seeing one instance of High[0]. I have attached an image of the chart for your information.

      Thank you.
      Attached Files

      Comment


        #4
        Hello GeorgeW,

        Thanks for your reply.

        The screen shot shows an indicator scale on the left side and a price scale on the right. The price scale shows that price is in the area of 1.8. Looking at the arrows compared to the indicator scaling the arrows are plotted just above 0 and below 5 so I suspect the arrows are being plotted to the indicator scale and not on the price panel scale.

        Please set (or add if not there), in State.SetDefaults, DrawOnPricePanel = true;

        Reference: http://ninjatrader.com/support/helpG...pricepanel.htm


        Edit - clarified adding if not there.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          That has worked, Paul. Thank you.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by DJ888, 04-16-2024, 06:09 PM
          4 responses
          12 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by terofs, Today, 04:18 PM
          0 responses
          7 views
          0 likes
          Last Post terofs
          by terofs
           
          Started by nandhumca, Today, 03:41 PM
          0 responses
          6 views
          0 likes
          Last Post nandhumca  
          Started by The_Sec, Today, 03:37 PM
          0 responses
          3 views
          0 likes
          Last Post The_Sec
          by The_Sec
           
          Started by GwFutures1988, Today, 02:48 PM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Working...
          X