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

number of periods on an indicator

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

    number of periods on an indicator

    Hello,

    I created an indicator a cumulative moving average.

    Does this syntax can work?

    Code:
    double value = CWMA(ChartBars.GetBarIdxByX(chartControl, cursorPointX))[0];
    Just want my cwma to appear and modify in the chart when i click on the chart anywhere.

    Error say CWMA dont exist in that context. I try to call my CWMA in another indicator.

    TY

    #2
    Hello frankduc,

    That does not look like valid code. From the description I am not certain what you are asking to do. If you can provide a more accurate description of what you are trying to do that may help.

    JesseNinjaTrader Customer Service

    Comment


      #3
      Ok i have an indicator that creates a moving average, its name in the list is CMA01

      I am using another indicator i created and want my moving average the CMA01 to appear everytime i click on the chart at a different position.

      So what i did is:

      Code:
      private CMA01 value;
      than:

      Code:
      value = CMA01(ChartBars.GetBarIdxByX(chartControl, cursorPointX));

      but the line of the CMA01 wont show up. No error message.
      Print it return:

      CWMA(ES 03-23 (400 Volume),650)
      Last edited by frankduc; 12-15-2022, 01:19 PM.

      Comment


        #4
        Hello frankduc,

        If you are not sure what the syntax would be for your custom indicator you can use the strategy builder to generate the code to use it.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Code:
          value = CMA01(ChartBars.GetBarIdxByX(chartControl, cursorPointX));
          return:

          CWMA(ES 03-23 (400 Volume),650)

          i only want to pass the value of Bars ago we get from the DataBox.

          Comment


            #6
            Hello frankduc,

            GetBarIdxByX returns an index of a bar based on a X pixel location, that is not a BarsAgo. The error you were seeing from post 1 means that the indicators name is wrong. If you don't know what syntax your indicator needs you can use the builder to generate it.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by burtoninlondon, Today, 12:38 AM
            0 responses
            5 views
            0 likes
            Last Post burtoninlondon  
            Started by AaronKoRn, Yesterday, 09:49 PM
            0 responses
            14 views
            0 likes
            Last Post AaronKoRn  
            Started by carnitron, Yesterday, 08:42 PM
            0 responses
            11 views
            0 likes
            Last Post carnitron  
            Started by strategist007, Yesterday, 07:51 PM
            0 responses
            13 views
            0 likes
            Last Post strategist007  
            Started by StockTrader88, 03-06-2021, 08:58 AM
            44 responses
            3,982 views
            3 likes
            Last Post jhudas88  
            Working...
            X