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

Paint bars

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

    Paint bars

    Hi, how do i colorize price bars and colorize the area between my indicator and the price bars, usually called cloud. The indicator im using is WeeklyVWAP with a single standard deviation band above and below. .How do i do this using the NT8 ninjascript editor create new indicator. Thanks for any guidance in advance. P.S I have zero coding experience.

    I have successfully created this indicator example provided by NT https://drive.google.com/file/d/1Jli...day9w23-a/view
    however this is for an SMA cross another SMA.

    What code do i use for when price crosses/ closes above or below VWAP / VWAP upper or lower Band. (The indicator)

    Last edited by tradertom2012; 01-28-2023, 09:42 AM.

    #2
    Hello tradertom2012,

    Thanks for your post.

    BarBrush could be used to change the color of a bar in a custom NinjaScript. The help guide page below could be viewed for more information on the use of BarBrush and sample code.

    BarBrush: https://ninjatrader.com/support/help...8/barbrush.htm

    The Draw.Region() drawing tool method could be used to color the background between the price of a bar and an indicator.

    See this help guide page about using Draw.Region(): https://ninjatrader.com/support/help...raw_region.htm

    You could access price values of a bar from the PriceSeries collection.

    View this help guide page for how to access prices from a bar: PriceSeries: https://ninjatrader.com/support/help...riceseries.htm

    To access Order Flow VWAP values in a custom NinjaScript, see this help guide page which contains documentation and sample code: https://ninjatrader.com/support/help...flow_vwap2.htm

    The C# programming language is used for developing NinjaScript indicators and strategies.

    To create a NinjaScript indicator, open a New > NinjaScript Editor window, select the '+' tab at the bottom of the Editor window, select 'New Indicator'. Then, you could set up as much of the indicator as possible in the Indicator Builder. This will create the framework of the indicator or strategy

    Once you finish setting up as much as possible in the Indicator Builder, you must manually program the rest of the indicator.

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

    Here is a link to our publicly available training video, 'NinjaScript Editor 401', for you to view at your own convenience.

    NinjaScript Editor 401 - https://youtu.be/H7aDpWoWUQs?list=PL...We0Nf&index=14

    I am also linking you to the Educational Resources section of the Help Guide to help you get started with NinjaScript:
    https://ninjatrader.com/support/help..._resources.htm

    If you are new to C#, to get a basic foundation for the concepts and syntax used in NinjaScript I would recommend this section of articles in our help guide first:
    https://ninjatrader.com/support/help...g_concepts.htm

    And the MSDN (Microsft Developers Network) C# Language Reference.
    https://ninjatrader.com/support/help...erence_wip.htm

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

    Comment


      #3
      Thanks Brandon. As someone with no coding experience ive written some code as follows: if (Close[0] > OrderFlowVWAP (1)[0])
      BarBrush = Brushes.Lime; i get a compile error No Overload method 'OrderFlowVWAP' takes 1 arguments.
      Ive tried to find a solution but no joy. Where have i gone wrong?​

      Comment


        #4
        Hello tradertom2012,

        Thanks for your note.

        This error means that you are only using 1 argument when accessing OrderFlowVWAP and this method takes more than one argument. This method takes a minimum of 6 arguments as seen in the Order Flow VWAP help guide page linked in post # 2 and linked below. The syntax for accessing Order Flow VWAP values could be seen below.

        OrderFlowVWAP(VWAPResolution resolution, TradingHours tradingHoursInstance, VWAPStandardDeviations numStandardDeviations, double sD1Multiplier, double sD2Multiplier, double sD3Multiplier).VWAP[int barsAgo]

        An example of what the method you shared might look like can be seen below.

        if (Close[0] > OrderFlowVWAP(VWAPResolution.Standard, TradingHours.String2TradingHours("CME US Index Futures RTH"), VWAPStandardDeviations.Three, 1, 2, 3).VWAP[0])
        {
        }


        You could view the sample code in the Order Flow VWAP help guide page for an example of how this indicator would be used. Note that an added secondary 1-Tick series must be added to the script and you have to update the secondary tick series of the cached indicator using Tick Resolution to make sure the values we get in BarsInProgress == 0 are in sync. This is seen in the help guide sample code as well.

        Order Flow VWAP: https://ninjatrader.com/support/help...flow_vwap2.htm

        I suggest working through the Tutorials section of the Educational Resources help guide to gain a better understanding of how to code custom NinjaScripts before trying to work with more advanced topics, such as using Order Flow VWAP.

        Educational Resources to help you get started with NinjaScript:
        https://ninjatrader.com/support/help..._resources.htm

        Please let me know if I may assist further.​
        Last edited by NinjaTrader_BrandonH; 01-30-2023, 09:16 AM.
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          Thank you Brandon you have been very helpful. Much appreciated.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by maybeimnotrader, Yesterday, 05:46 PM
          2 responses
          20 views
          0 likes
          Last Post maybeimnotrader  
          Started by adeelshahzad, Today, 03:54 AM
          5 responses
          32 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by stafe, 04-15-2024, 08:34 PM
          7 responses
          32 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by merzo, 06-25-2023, 02:19 AM
          10 responses
          823 views
          1 like
          Last Post NinjaTrader_ChristopherJ  
          Started by frankthearm, Today, 09:08 AM
          5 responses
          22 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Working...
          X