Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plotting simple dots on MA crossover

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

    Plotting simple dots on MA crossover

    I've been sifting through all the thumbnails of the NT7 shared indicators to get a working example, but there is not a single instance of someone successfully drawing a dot at the crossover of 2 moving averages.

    Can someone please give a code snippet example of how to print a dot at the intersection of 2 MA crossovers.

    Attached is a picture in another platform of what I would like to do. Just put dots at the crossover of 2 averages.
    The script code for this is very simple one line and it just works flawlessly.

    plot(cross(ma1, ma2) ? ma2 : na, color = (ma2 - ma1 > 0 ? fuchsia : blue) , style = circles, linewidth = 3)

    The C# equivalent to this is proving to be quite a bit more involved. I've got the math figured out and am 70% there. Just trying to figure out why CrossAbove() and DrawDot() don't really behave.

    Below is the basics of what I've been trying without luck. 2nd pic attached.
    It just plots a dot at the fast MA line, but only to the far right and it keeps redrawing.
    How do I get the dots to just plot and then stay at the crossover points like in the first picture?

    if (codots != false)
    {
    if (CrossAbove(Values[1], Values[0], chanlen))
    {
    //DrawDot("Bull Dot", true, 0, Values[0][0], Color.Blue);
    DrawDot("Bull Dot", true, 1, Values[0][0], Color.Blue);

    }

    }

    Can someone provide a few lines of code to point me in the right direction. I see there's a few MACDBB type indicators based on ascending/descending slope in the sharing area but they don't have an example of what I need.

    I'm hoping this is a very basic thing to do, but can't find a single code example Googling around.
    Attached Files

    #2
    Hello cpuzz,

    Thanks for your post and welcome to the forums!

    We have a working reference sample that will demonstrate the drawing of objects using the cross conditions here: http://ninjatrader.com/support/forum...ead.php?t=3419

    I think you have the code you need by using the if (CrossAbove()) method.

    Your DrawDot code is correct except for the "tag" name.

    If you use the same tag name for each object what happens is that the first object is removed from the chart and the new object is drawn as there can only be one unique name per object. In this mode then only the latest dot would be drawn.

    If you use a unique tag name for each dot, then each dot will remain on the chart. An easy way to create a unique name is to add the CurrentBar number to it, for example: DrawDot("Bull Dot"+CurrentBar, true, 1, Values[0][0], Color.Blue); If you were to look at the property of each dot drawn you would see a tag name (examples) of Bull Dot2345, Bull Dot19812.

    References:
    http://ninjatrader.com/support/helpG...crossabove.htm
    http://ninjatrader.com/support/helpG...currentbar.htm

    Comment


      #3
      Hello cpuzz, how are you?

      Regarding your indicator Wave Trend Oscillator - NinjaTrader Ecosystem​ ... Is it possible to plot dots a little bit faster?
      Can you code it for me? Or give me instructions how to code in order to plot dots a little bit faster. I use proprietary renko bars, and it's plotting one bar late.

      Thank you!

      Comment


        #4
        ty trying to download wave trend osc, but does not show up in my indicator file ????????ty vm

        Comment


          #5
          Hello tbillm,

          To import a NinjaScript into NinjaTrader 8 do the following:
          1. Download the script to your desktop, keep it in the compressed .zip file.
          2. From the Control Center window select Tools -> Import -> NinjaScript...
          3. Click the Desktop icon on the left to navigate to the desktop
          4. Select the downloaded .zip file -> then click Open
          5. NinjaTrader will then confirm if the import has been successful.
          Critical *Note that on any files that say "File already exists on your PC" that start with an "@" symbol are the ones that came preloaded inside of NinjaTrader so you would say "No" so that you do not override those files.

          Below is a link to the help guide on importing NinjaScripts.


          If the import is successful, ​the indicator will be listed with the name WaveTrendV2 in the Indicators window in the Available list.
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          558 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          324 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          545 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          547 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X