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 Hash at current bar...

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

    Draw Hash at current bar...

    I'm drawing a 20 EMA line overlaying price.... Easy !
    I need to also draw the same plot except using the Hash style.
    I've looked through the forum and found a dizzying array of plot
    examples using "PlotStyle.Hash" but no variation has helped.
    I know I'm probably leaving a critical line out of some section but, I'm lost.

    Can somebody get me started on the right track?
    Thank you in advance.

    #2
    Try a plot like this:

    Add(new Plot(new Pen(Color.Red,1), PlotStyle.Hash, "MyEMAhashline"));


    Dan
    eDanny
    NinjaTrader Ecosystem Vendor - Integrity Traders

    Comment


      #3
      Randwulf, you can simply modify the existing EMA indicator to draw with hashmarks instead of a line:

      1) Tools -> Edit NinjaScript -> Indicator -> select EMA
      2) Right-click in the editor window and select "save as" and rename it to something like "myNewEMA"
      3) change the plot style to PlotStyle.Hash as indicated by eDanny:
      Code:
      // change from this:
      Add(new Plot(Color.Orange, "EMA"));
      // to this:
      Add(new Plot(new Pen(Color.Orange,1), PlotStyle.Hash, "EMA"));
      AustinNinjaTrader Customer Service

      Comment


        #4
        Thx for the timely replies gentlemen...

        I Neglected to mention an important piece of info.... sorry
        I'm doing this from within a strategy.
        I know the obvious question is why? However, can it be done ?

        eDanny,
        That's exactly the line I used in the "Initialize" section but,
        I've tried things like MyEMAhashline.Set(EMA(20)[0] in "OnBarUpdate" to no avail.

        Austin,
        Your reply was the tip that I had not mentioned this being from
        within a strategy

        Comment


          #5
          Randwulf, there is no way for a strategy to directly plot hash marks. You can add an indicator that plots hash marks to the strategy though. Please take a look at the attached indicator and strategy. The indicator will plot the hash marks by itself, and I've added a reference to the indicator inside the strategy.
          Attached Files
          AustinNinjaTrader Customer Service

          Comment


            #6
            Austin,
            I realized after my last post what you were getting at.
            I created the Indicator like you suggested & it indeed plots accordingly.

            The reason I was looking for other ways of referencing the indicator, was
            strictly to be able to change the hash color with logic when it was either
            up or down from last bar...

            I'm guessing that it would have to be addressed in the indicator code ?
            Two different plots with two different pen colors or something ?

            P.S. Any way to have it plotted last on bar update? It' being hidden by
            other plots...
            Thx again...
            Last edited by Randwulf; 01-12-2010, 05:43 PM.

            Comment


              #7
              EMA colors

              There's also an indicator with up colors blue and down colors red . . . EMAColors. this is in the indicator files. You can then change the plot style to hash as suggested in the previous posts.

              Hope this helps.

              Comment


                #8
                Originally posted by Randwulf View Post
                The reason I was looking for other ways of referencing the indicator, was
                strictly to be able to change the hash color with logic when it was either
                up or down from last bar.
                I think this may be what the post right before this one is saying, but have you seen the reference sample titled Multi-Colored Plots? The same idea would apply for hash plots as well.
                AustinNinjaTrader Customer Service

                Comment


                  #9
                  John.2000 & Austin,
                  I was indeed able to modify a copy of EMA_Colors to work as instructed...
                  Thank you all for your time and suggestions.
                  This is truly an impressive support community.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by llanqui, Today, 11:10 AM
                  1 response
                  15 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by reynoldsn, 05-10-2024, 07:04 PM
                  2 responses
                  21 views
                  0 likes
                  Last Post reynoldsn  
                  Started by llanqui, Today, 10:29 AM
                  1 response
                  12 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by Trader146, 05-10-2024, 09:17 PM
                  1 response
                  22 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by bourasrafik, Today, 03:26 PM
                  0 responses
                  5 views
                  0 likes
                  Last Post bourasrafik  
                  Working...
                  X