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

Background Color for the Trend Magic Indicator

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

    Background Color for the Trend Magic Indicator

    I've been trying to set the background color of the chart to match the TrendMagic indicator, but it is not a slope...
    It has areas where it is flat, so I dont know what to do.

    I've been attempting to do this in the strategy builder, as I do not know how to code.

    Here is the indicator:
    Trend Magic

    Click image for larger version  Name:	TrendMagic.png Views:	82 Size:	17.4 KB ID:	1221447

    UPDATE
    Here is the Indicator with the ability to change the background

    Thanks to TradeSimple(Dre)
    TrendMagicTSmod.zip
    TrendMagicTSmod.zip (If link above doesn't work)

    Click image for larger version  Name:	TrendMagic&Background.png Views:	5 Size:	91.1 KB ID:	1222369
    Last edited by Skyfall; 11-05-2022, 01:07 PM.

    #2
    Hello Skyfall,

    Thanks for your post.

    The TrendMagic indicator plot is set based on a private custom Series variable called lineColor. When lineColor[0] evaluates to 1, the color of the plot is set to a default color of green. When lineColor[0] evaluates to 0 or -1, the bar color is changed to a default color of red.

    To use the TrendMagic indicator's custom series "lineColor" in the Strategy Builder to change the color of the background, you would need to manually modify the TrendMagic indicator. A plot would need to be added to the indicator using the AddPlot() method and the plot would need to have the lineColor[0] value assigned to it.

    You could then reference that newly added plot in Strategy Builder strategy conditions. For example, if you call AddPlot() to add a plot to the indicator and assign lineColor[0] to that plot, you could reference if the added plot is -1, 0, or 1 to determine the color of the TrendMagic plot in a condition.

    See this help guide page for more information about AddPlot() and sample code: https://ninjatrader.com/support/help...t8/addplot.htm

    See this help guide page for more information about custom Series<T> variables: https://ninjatrader.com/support/help...t8/seriest.htm

    Below is a link to a forum post with helpful information about getting started with NinjaScript.
    https://ninjatrader.com/support/foru...040#post786040

    Let me know if I may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Hey Skyfall,

      See if this will help you. I made it a couple years ago but today added inputs so the user can change the settings. Not based on magic trend but trigger lines, fast one going above the slow one then changes the background color. (Both directions) You can adjust the numbers to match more of what u want.

      Are u familiar w/ triggerlines? The default is, Fast: 20-5. Trigger is 20 and average is 5 when it is greater than the Slower, which is, 39-9. trigger 39 average 9. Turns background seagreen & firebrick for down. I don't know how to make the background so you can change it to what u want.? Can't get it.

      I think u will like it. I tried to make what u wanted (behind the scenes, that is) last week but couldn't do it. I might try again with these instructions now, but I'm busy, I'll slide it in for ya, bra.

      Skyfall, good handle I like it. We got a little while before the sky falls, but not much longer
      Attached Files

      Comment


        #4
        Originally posted by trdninstyle View Post
        Hey Skyfall,

        See if this will help you. I made it a couple years ago but today added inputs so the user can change the settings. Not based on magic trend but trigger lines, fast one going above the slow one then changes the background color. (Both directions) You can adjust the numbers to match more of what u want.

        Are u familiar w/ triggerlines? The default is, Fast: 20-5. Trigger is 20 and average is 5 when it is greater than the Slower, which is, 39-9. trigger 39 average 9. Turns background seagreen & firebrick for down. I don't know how to make the background so you can change it to what u want.? Can't get it.

        I think u will like it. I tried to make what u wanted (behind the scenes, that is) last week but couldn't do it. I might try again with these instructions now, but I'm busy, I'll slide it in for ya, bra.

        Skyfall, good handle I like it. We got a little while before the sky falls, but not much longer
        Thanks for the script.

        Please, could you make this an Indicator instead of Strategy.

        omololu

        Comment


          #5
          Originally posted by omololu View Post

          Thanks for the script.

          Please, could you make this an Indicator instead of Strategy.

          omololu
          I'll have to scratch my head and remember how to do it. Thats a pretty cool would-be indicator, isn't it.

          Comment


            #6
            Here's the indicator type. The actual triggerlines never show up in the indicator after I move it from strategy to indicator. I'm not a coder just a wanabe.
            You can add them to your chart, the triggerlines, & set them to the same settings that u have for the triggbackground. To see what's happening.

            BltTriggerlines in the app share, u can find them there.
            Attached Files

            Comment


              #7
              Originally posted by trdninstyle View Post
              Here's the indicator type. The actual triggerlines never show up in the indicator after I move it from strategy to indicator. I'm not a coder just a wanabe.
              You can add them to your chart, the triggerlines, & set them to the same settings that u have for the triggbackground. To see what's happening.

              BltTriggerlines in the app share, u can find them there.
              Thanks.

              omololu

              Comment


                #8
                Originally posted by Skyfall View Post
                I've been trying to set the background color of the chart to match the TrendMagic indicator, but it is not a slope...
                It has areas where it is flat, so I dont know what to do.

                I've been attempting to do this in the strategy builder, as I do not know how to code.

                Here is the indicator:
                Trend Magic

                Click image for larger version Name:	TrendMagic.png Views:	82 Size:	17.4 KB ID:	1221447

                UPDATE
                Here is the Indicator with the ability to change the background

                Thanks to TradeSimple(Dre)
                [ATTACH]n1222368[/ATTACH]

                Click image for larger version

Name:	TrendMagic&amp;Background.png
Views:	920
Size:	91.1 KB
ID:	1222369
                So, are u keeping this to yourself now?

                Comment


                  #9
                  Originally posted by trdninstyle View Post

                  So, are u keeping this to yourself now?
                  I dont know why that happened, it was fine when I uploaded it.
                  Thanks for notifying me.

                  TrendMagicTSmod.zip
                  Last edited by Skyfall; 11-05-2022, 12:57 PM.

                  Comment


                    #10
                    Thanks for sharing, Skyfall. It's tough to learn but I've working on making a trading bot where after price goes 5 ticks in your direction the stop moves to breakeven +1 and the setups get u in without u even being there. Stress is out the window. Now I need to start learning the trailing stop to lock in profit as price moves on. Lots of tiny 1 tick profits replacing losses. I can live with THAT! lol

                    Hey, sky is falling.

                    Comment


                      #11
                      I added in two plots, just working the Direction is not built perfect but it will enter a trade using Builder based on a long condition or short.
                      Attached Files

                      Comment


                        #12
                        Skyfall
                        LoganJKTrader

                        please could you or anyone else add an option so that for this indicator TrendzMagticv1001 ​it becomes possible to paint only the section of the panel that is either above price or above the trendMagic indicator.

                        I would like to avoid the overlapping of two background paints where one of them is painted by another indicator.

                        Thank you.​

                        Click image for larger version  Name:	MES 12-22 (Delta 400) 2022_11_07 (22_48_17).png Views:	0 Size:	81.1 KB ID:	1222669

                        Comment


                          #13
                          I assume you can choose the color One of those indies will plot & change it to transparent then you will have no overlap.

                          Comment


                            #14
                            @LoganJKTrader

                            Thanks. Maybe I did not explain correctly with my poor English what I was looking for.

                            I would like to have both paints together on the chart panel, the paint of one indicator only below the price bars (as it is already the case for my indicator), the paint of the other indicator (TrendzMagticv1001.zip in this case) only above the bars.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by wzgy0920, 04-20-2024, 06:09 PM
                            2 responses
                            27 views
                            0 likes
                            Last Post wzgy0920  
                            Started by wzgy0920, 02-22-2024, 01:11 AM
                            5 responses
                            32 views
                            0 likes
                            Last Post wzgy0920  
                            Started by wzgy0920, 04-23-2024, 09:53 PM
                            2 responses
                            49 views
                            0 likes
                            Last Post wzgy0920  
                            Started by Kensonprib, 04-28-2021, 10:11 AM
                            5 responses
                            193 views
                            0 likes
                            Last Post Hasadafa  
                            Started by GussJ, 03-04-2020, 03:11 PM
                            11 responses
                            3,235 views
                            0 likes
                            Last Post xiinteractive  
                            Working...
                            X