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

Help Turning Lines of an indicator on and off

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

    Help Turning Lines of an indicator on and off

    Hello - I have developed a simple indicator that shows ema lines on the screen at different intervals. I would like some direction as to how I can program the lines to turn off (hide) when I trigger it with a mouse click. I would also like to turn the lines from solid to dashes after they cross. Is there any sample code I can use a base? Thanks

    #2
    Hello cpabiz20k,

    Thank you for your post.

    For the mouse click you mentioned, this would likely be best achieved by adding a button to the chart that you can click to toggle the plots on/off. We have a reference sample that demonstrates how to make WPF modifications, such as adding buttons, here:


    To turn the lines "off" you could likely have the logic toggle the isVisible property to false:


    There are a couple of sample scripts that demonstrate toggling plot colors in the following thread:
    Hi, I am trying to recreate the basic function of the Visible checkbox seen in indicators like EMA which can toggle on/off the plot visibility while retaining the plot color. Past related posts have suggested making plot bars transparent but such loses the plot color if the workspace is saved then reopened later. Can you please


    To change the lines to a dash after they cross, you could access the desired plot from the Plots collection and then change its stroke to a dash:



    There is an indicator that is publicly available on our NinjaTrader Ecosystem website that adds a toolbar to allow you toggle different items on the chart that may also be a helpful example:
    Here is a basic guideline of how to import NinjaScript add-ons in NinjaTrader 8:

    Note — To import NinjaScripts you will need the original .zip file.

    To Import:
    1. Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
    2. From the Control Center window select the menu Tools > Import > NinjaScript Add-on...
    3. Select the downloaded .zip file
    4. NinjaTrader will then confirm if the import has been successful.

    Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'

    Once installed, you may add the indicator to a chart by:
    • Right-click your chart > Indicators... > Select the Indicator from the 'Available' list on the left > Add > OK

    Here is a short video demonstration of the import process:
    Please let me know if I can be of further assistance.

    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      This is very helpful - thank you. Is there any help you can give on how to identify the plot drawn from a custom indicator (in the main display screen) so I can trigger it to off?

      Comment


        #4
        Hello cpabiz20k,

        Thank you for your reply.

        What are you referring to as the main display screen? Do you mean you need to identify it one time only so you can add that plot to a script programmatically, or are you referring to a way to identify the plot from a specific screen via programming consistently? I'm not quite sure what you mean. You could always double-click on a specific plot from a chart window to pull up the indicators window with the indicator the plot belongs to selected. From there, you can likely narrow down the plot based on the color.

        I look forward to your clarification.
        Emily C.NinjaTrader Customer Service

        Comment


          #5
          Hello - I have an indicator that has multiple ema lines on it. I would like to program a button for each line and then be able to hide or make visible each line (individually). I hope that helps.
          Thanks

          Comment


            #6
            Originally posted by cpabiz20k View Post
            Hello - I have an indicator that has multiple ema lines on it. I would like to program a button for each line and then be able to hide or make visible each line (individually). I hope that helps.
            Thanks
            Hello,

            Thank you for your reply.

            In that case, you could make several WPF modifications to add multiple buttons. Then in the button click event handlers, you would set the logic to toggle the color of the designated EMA plot line for that button between transparent vs. the original color of the button.

            Please let us know if we may be of further assistance.
            Emily C.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by rhyminkevin, Today, 04:58 PM
            3 responses
            46 views
            0 likes
            Last Post Anfedport  
            Started by iceman2018, Today, 05:07 PM
            0 responses
            5 views
            0 likes
            Last Post iceman2018  
            Started by lightsun47, Today, 03:51 PM
            0 responses
            7 views
            0 likes
            Last Post lightsun47  
            Started by 00nevest, Today, 02:27 PM
            1 response
            14 views
            0 likes
            Last Post 00nevest  
            Started by futtrader, 04-21-2024, 01:50 AM
            4 responses
            50 views
            0 likes
            Last Post futtrader  
            Working...
            X