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

Price Bar Color contolled by Momentum Ind

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

    Price Bar Color contolled by Momentum Ind

    Hello,

    I am totally new to custom indicator script development - never done it before.

    I have 3 charts in my workspace: 144 tick (ST chart); 432 tick (MT chart); 1296 tick (LT chart).

    My idea is control the price bar color in the ST chart based on the slope of the MACD line from the MT chart and likewise, the price bar color of the MT chart based on the slope of the MACD line from the LT chart.

    Is this feasible to do and if so, is this too complex for a beginner to do, or how do I begin my learning process to do this?

    Please let me know. Thanks,

    Steve

    #2
    Steve, welcome to our forums - you can do this from a MultiSeries strategy in NT 6.5 or a indicator or strategy in NT7, the base concept is explained here - http://www.ninjatrader-support.com/H...struments.html

    Before starting off into MultiSeries territory, I would suggest to work through the basic indicator tutorials first to get a feel for the syntax and usage of NinjaScript -

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Bertrand, I have successfully completed my first custom indicator, a MACD that colors the histogram bars based on the slope of the MACD line. My next task is to control the color of the price bars in the primary bars object based on the slope of the MACD line in a secondary bars object. You mentioned that this could be done using a MultiSeries strategy. But, I noticed that strategies cannot be enable when Chart Trader is enabled. I use Chart Trader to manage my entry orders and ATM for my exit orders. So, is it possible to return a value from the custom indicator in the secondary bars object and then get this value in the MACD custom indicator for the primary object. This value would contain the status of the slope of the MACD line in the secondary bars object. I could then use this value to control the color of the price bars and/or the background color in the primary bars object. .

      Or, any suggestions on how I should proceed with this idea.

      Thanks, Steve

      Comment


        #4
        Hi Steve, you could always use 2 charts then - one for running the strategy and the other to trade with ChartTrader. The best option would be working with a MultiSeries indicator in NT7 beta which would give you access to multple bars objects / timeframes directly from the indicator code.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Hi Bertrand, Thanks for the guidance.
          How big of a change will it be for me to switch to NT7 Beta, other than the MultiSeries indicator capability? Will my workspaces, 3rd party indicators and templates still work the same in NT7? I assume that the users guide for NT7 will be embedded in the software.

          Please let me know. Thanks.
          Steve

          Comment


            #6
            Steve, some workspaces will transfer without any issues, and some won't. The same goes for templates, but 3rd party indicators usually run fine on NT7 unless they use unsupported methods. Most vendors already have NT7 versions as well.
            AustinNinjaTrader Customer Service

            Comment


              #7
              Hi Bertrand,

              For my own learning process, I have completed a custom indicator and strategy to control the background color in a MultiSeries environment. Wow, the strategy turned out to be quite simple. The background color of the current bar in progress on the primary bars object updates in sync with the slope changes (color) on the next higher time frame. But, I have noticed that a historical bar on the primary bars object does not match the current bar on the next higher time frame when the bar on the next higher time frame changes slope (color). However, I can re-apply the strategy and the color coding of the background color for the historical bars on the primary bars object are now in sync or agree with the historical slope (color) on the next higher time frame. .

              Is there something I need to add to the strategy to keep the background color for the historical bars on the primary bars object in sync when slope of the next higher time frame changes intrabar? The time frame ratio between my charts (bars objects) is a factor of 3.

              Any ideas, or is this a consequence of a MultiSeries environment?

              Steve

              Comment


                #8
                Steve,

                Likely you are running into issue that simply one of the bars needs to update before the others. When in the context of historical, this also means that something like a 1minute series would update three times for every one time a 3minute series updated. Meaning when you are on minute #2, your 3minute bars is still showing info from back before minute #1 and there is unfortunately no way to work around this. It simply has no data points.

                Hopefully that makes sense. What I suggest for the learning process is adding this to your strategy to see exactly which bar context you are in and what is processing.

                Print("BarsInProgress: " + BarsInProgres + " Time: " + Time[0]);

                With this line at the top of OnBarUpdate() you can see the pattern in which events are processed and how doing different things in different events will result in different results if the other bars have not updated yet.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Hi Josh,

                  Thanks for your prompt reply and suggestion. However, on second thought, I have come to the realization that this disagreement of historical bars on the primary bars object and the slope of the indicator on the next higher time frame is useful information. It records an oscillating condition with the slope.

                  My next task is to do this process using NT7 indicators in a MultiSeries environment. I cannot use the strategy implementation because I use Chart Trader for my live trading.

                  Thanks for your assistance.
                  Steve

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by frslvr, 04-11-2024, 07:26 AM
                  9 responses
                  123 views
                  1 like
                  Last Post caryc123  
                  Started by rocketman7, Today, 09:41 AM
                  4 responses
                  15 views
                  0 likes
                  Last Post rocketman7  
                  Started by selu72, Today, 02:01 PM
                  1 response
                  9 views
                  0 likes
                  Last Post NinjaTrader_Zachary  
                  Started by WHICKED, Today, 02:02 PM
                  2 responses
                  16 views
                  0 likes
                  Last Post WHICKED
                  by WHICKED
                   
                  Started by f.saeidi, Today, 12:14 PM
                  8 responses
                  21 views
                  0 likes
                  Last Post f.saeidi  
                  Working...
                  X