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

How to plot DOTS in between 2 SMA?

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

    How to plot DOTS in between 2 SMA?

    Hi!

    I would like to plot a DOT to get the price in between 2 SMA lines.
    Eg.
    SMA(10): 11000
    SMA(20): 12000
    In between: 11500

    Any help on how to create an indicator to draw a DOT at 11500 in realtime?
    Thanks!

    Jim

    #2
    Jim,

    What you want to do is access the two SMA values and find the midpoint.

    Code:
    dotValue = (SMA(10)[0] + SMA(20)[0]) / 2;
    DrawDot("dot" + CurrentBar, true, 0, dotValue, Color.Red);
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      How to plot DOTS in between 2 SMA?

      And how can I adjust the size of the Dots? I am using the "DrawDot" formula and works fine but when it plots in the chart, and since I have it overlaying on the last Bars, it hides the OHLC Bars!

      The Dots seem to be designed to match the width of the Candle Stick Bars, so when I use the OHLC bars (which are narrower) the Dots look huge in comparisson and I can't see the Open or Close of such Bars.

      See the attached picture. Notice the Yellow, Pink and Orange Dots, which are hiding the OHLC Bars due to their size. However I am also using an Indicator (ATR Trailing), which uses a much smaller Dots. These last I could use but I can't change the size when I use the DrawDots formula.

      Thanks
      HJS
      Attached Files
      Last edited by HJSInvesting; 01-19-2009, 06:03 PM. Reason: Miising info in original Post

      Comment


        #4
        Hi HJS, unfortunately you cannot change the DrawDot size.

        You could try using DrawText with a symbol font and change the font size.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thanks for the input.

          Here's my working code:

          double dotValue = (SMA(sma1)[0] + SMA(sma2)[0]) / 2;

          textFont = new Font("Webdings",markersize);
          DrawText("dot" + CurrentBar, "n", 0, dotValue, Color.White, textFont, StringAlignment.Center, Color.Black, Color.Black, 1);
          Remember to add "private System.Drawing.Font textFont;" in the Variables section.

          Enjoy!

          Jim

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by trilliantrader, Today, 03:01 PM
          0 responses
          2 views
          0 likes
          Last Post trilliantrader  
          Started by pechtri, 06-22-2023, 02:31 AM
          9 responses
          122 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by frankthearm, 04-18-2024, 09:08 AM
          16 responses
          67 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by habeebft, Today, 01:18 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by benmarkal, Today, 12:52 PM
          2 responses
          19 views
          0 likes
          Last Post benmarkal  
          Working...
          X