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

Previos High and Previous low

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

    Previos High and Previous low

    Hi,

    I am new to programming, I am trying to make an indicator which i want to use in Market Analyzer, condition is LTP is greater then or equal to Previos Day High OR LTP is lower then or equal to Previous day low. if it changes cell colour in Market analyzer then its easy to recognize..any one please help with code.

    Thanks

    #2
    Hello trader9,

    Thank you for writing in.

    The logic for coloring the cell will be done through the Market Analyzer itself.

    However, we'll need to program some logic into your indicator in order to tell the Market Analyzer to change the cell color.

    As an example:
    Code:
    protected override void OnBarUpdate()
    {
         if (Close[0] >= PriorDayOHLC().PriorHigh[0]) // if the last price is more than or equal to prior day high
              Value.Set(1); // set plot value to 1
         else if (Close[0] <= PriorDayOHLC().PriorLow[0]) // else if the last price is less than or equal to prior day low
              Value.Set(-1); // set plot value to 0
    }
    Once you have added the indicator to the Market Analyzer, you'll want to set up cell conditions for your plot.

    You'll need two conditions for the example above.

    One condition checks if the value equals 1. The other checks if the value equals -1.

    I would highly suggest taking a look at the help guide at this link for some helpful educational resources on programming with NinjaScript: https://ninjatrader.com/support/help..._resources.htm

    Additionally, information about creating cell conditions within the Market Analyzer can be found here: https://ninjatrader.com/support/help..._and_filte.htm

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      market analyzer shows only 1 as value

      Hi,
      I have created indicator based on your instructions, it plots perfectly in chart as 1 and -1 (screenshot attached), but when I load that in market analyzer with 1 min as data series it only displays 1 as value in cell(although it's -1 in chart) , I have tried to load number of symbol in market analyzer and its plots 1 in each cell, I have not reached to cell filter yet, but it should plot same as in chart as value. Am I missing something ?
      Attached Files

      Comment


        #4
        Hello trader9,

        Thank you for your post.

        In the Market Analyzer you have the '# of bars to look back' property which allows you to set the number of bars to calculate over. You access this when right clicking in the Market Analyzer and selecting Properties.
        In addition, the indicator column itself has an option called '# of bars to look back' that would need to be set as well. Accessed by right clicking in the Market Analyzer > select Columns > and select your indicator column.

        The chart has the option 'Load data based on' which is usually set to 'Days to Load'. You would need to give the Market Analyzer as many bars as the chart to see the same value. You can change the chart to 'Bars to Load' by right clicking in the chart > selecting Data Series > set 'Load data based on' to 'Bars to Load' and then set the number of bars that you wish to use and that match the Market Analyzer.

        Please let me know if you have any questions.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CortexZenUSA, Today, 12:53 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by CortexZenUSA, Today, 12:46 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by usazencortex, Today, 12:43 AM
        0 responses
        5 views
        0 likes
        Last Post usazencortex  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        168 responses
        2,265 views
        0 likes
        Last Post sidlercom80  
        Started by Barry Milan, Yesterday, 10:35 PM
        3 responses
        11 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X