Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Found a CMA but does it work?

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

    Found a CMA but does it work?

    I have found on the net a cumulative moving average script.
    I wonder if it works and i wonder if i can install somehow that script on NT?
    The thing is, its a .ts file! Whats that?

    Here's the site:

    An anonymous donor requested a cumulative moving average indicator for Think or Swim that could start at a given date (on a daily chart) or start at a chosen time on a specific day for intraday cha…


    and here's where the file is: (second on top)

    These files are studies, which is Think or Swim's name for indicators plotted on a chart.


    Can i safely install that script on NT?

    If not the formula in the script on first page seem right.

    Anyone has an idea how i can modify an SMA to look like the CMA, modifying what and where in those lines?

    CMA = totalSum(price)/barNumber()

    thanks

    #2
    frankduc, after looking at the links you provided, it appears this indicator is for the Think Or Swim platform. Regardless, I can give you a rough translation for the important line:
    Code:
    CMA = totalSum(price)/barNumber()
    In NinjaScript:
    Code:
    CMA = SUM(Close, CurrentBar)/CurrentBar;
    AustinNinjaTrader Customer Service

    Comment


      #3
      Can we just replace the code in the VWMA by the one you provided?

      I'm not sure what line should i change in the VWMA to get what i want?

      CMA = SUM(Close, CurrentBar)/CurrentBar;

      Its about the same code, the difference is instead of calculating the 14 periods, it cumulate each periods.

      Calculating period 1, 2(the 2 last periods), 3 (the last 3 periods) etc, till 14.

      I really need a course in C# programming.

      thanks anyway



      Add(
      new Plot(Color.Blue, "VWMA"));
      Overlay =
      true;
      PriceTypeSupported =
      true;

      int numBars = Math.Min(CurrentBar, period);
      double volPriceSum = 0;
      double volSum = 0;
      for (int i = 0; i < numBars; i++)

      volPriceSum += Input[i] * Volume[i];
      volSum += Volume[i];
      }

      if (volSum <= double.Epsilon)
      Value.Set(volPriceSum);
      else
      Value.Set(volPriceSum / volSum);
      }

      Comment


        #4
        I have a feeling it would be easier to create a brand new indicator do to this, but if you want to paste it into another indicator this should do the trick:
        Code:
        [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] numBars = Math.Min(CurrentBar, period);[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2]
        [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] ([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] i = [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]; i < numBars; i++)[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2]
        {
           [SIZE=2][FONT=Courier New]priceSum += Input[i];[/FONT][/SIZE]
        [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
        [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000] 
        [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] (numBars <= [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2].Epsilon)[/SIZE][/FONT]
           [SIZE=2][FONT=Courier New]Value.Set(priceSum);[/FONT][/SIZE]
        [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE][/FONT]
           [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]Value.Set(priceSum / numBars);[/SIZE][/FONT][/SIZE][/FONT]
        AustinNinjaTrader Customer Service

        Comment


          #5
          cant say what i did wrong

          I just copy/paste the WVMA and then erased calculation lines to replace by the line you provided but it didnt work.

          As i said before but this time without the F... word, cause they seem fusy about it, i have to find a programmer to do the job.

          Comment


            #6
            frankduc,

            It may be worthwhile to consider one of these 3rd party NinjaScript Consultants: http://www.ninjatrader.com/webnew/pa...injaScript.htm
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              a lot of bull.....

              No offense but some of those people or cies are selling indicators that already exist for free on the net: Heiken-Ashi smoothed $75 USD

              Most of them are scams with indicators with no value.

              I can have a programmer for 75$ per/hour here in Montreal. What i need takes no more than 3 hours to program for a good analyst.

              I'm looking for any good programmer under that price.

              Why people are using indicators that do sometimes the same thing. They are most of them base on stochastic anyway.

              Its so hard to find people to rely on who will do the job right without bugs.

              Thanks to Austin anyway for is efforts.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by judysamnt7, 03-13-2023, 09:11 AM
              4 responses
              59 views
              0 likes
              Last Post DynamicTest  
              Started by ScottWalsh, Today, 06:52 PM
              4 responses
              36 views
              0 likes
              Last Post ScottWalsh  
              Started by olisav57, Today, 07:39 PM
              0 responses
              7 views
              0 likes
              Last Post olisav57  
              Started by trilliantrader, Today, 03:01 PM
              2 responses
              21 views
              0 likes
              Last Post helpwanted  
              Started by cre8able, Today, 07:24 PM
              0 responses
              10 views
              0 likes
              Last Post cre8able  
              Working...
              X