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

replace period by price in VWMA

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

    replace period by price in VWMA

    Hello,

    In the indicator VWMA is it possible to replace parameters period by prices.

    Instead of searching blindly for the number of periods it takes to draw a VWMA at 2370 for exemple, we code the indicator to search the number of periods to get to 2370.

    Exemple the chart has 100 periods and the VWMA equal 2360. We code VWMA to test periods 100, 90, 80 till the price reach 2370. If price reach 2370 at 80 periods the indicator stop searching and draw the VWMA.

    Of course, i just want to input the price i'm looking for to replace period by price in the indicator parameter.

    There's a NT consultant who tells me its not possible.

    Frank
    Thank you

    #2
    Hello Frankduc,

    Thank you for your note.

    So I can better understand your question, you want to know if it’s possible to input a price and then draw a VWMA who’s period is set to the amount of periods of historical data required for the computation to equal your inputted price?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      replace periods by price

      Hello,

      Yes i think you understand exactly what i want.

      Look on the chart i attached. The blue line is the VWMA and the red line is the CVWMA (its the VWMA but that cumulate periods from a current time)
      Both end at 2368.42

      In both case i have to try different periods to get 2368.42.
      I want my indicator to find the periods required automatically to draw the VWMA or CVWMA for 2368.42 or any other price.

      I'm not good at explaining myself in English, its not my native language but i thought it was clear.

      Is it possible?

      Here's what the programmer replied to me:

      It seems like you are indicating you'd like to somehow understand a CVWMA that would achieve a specific price. You've supplied a brute force approach, which is to simply try periods until you get the specific results you desire. Unless there is something more mathematically tractable to offer, I'm reluctant to proceed with a design such as this one.

      Thank you
      Attached Files

      Comment


        #4
        Hello frankduc,

        This would be possible.

        What you could do is use a for loop, and loop through the periods you pass to the SMA and compare that value against your inputted price value until they match, at which point a period variable is set, that variable is then passed to a SMA which you assign to a plot, then the loop is broken.

        I provided a sample indicator which will pass periods 2 through 10 to a SMA and compare it to the user input, and if they are equal will print “found” to the output window and set a plot value to that SMA.

        This is just a sample and provided simply to demonstrate how this could work.
        Attached Files
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Thank you for the information, i will pass it to the programmer.

          But to be honnest my knowledge in C# is very low.

          Once the programmer understand this is what i want: "you want to know if it’s possible to input a price and then draw a VWMA who’s period is set to the amount of periods of historical data required for the computation to equal your inputted price?"

          He's the one who is suppose to come up with the solution to make it work.

          I dont see any calculation or math formula that can help him replace periods by prices in the indicator parameter.

          Comment


            #6
            This idea is more than strange. If I look at the answer of the consultant

            "It seems like you are indicating you'd like to somehow understand a CVWMA that would achieve a specific price. You've supplied a brute force approach, which is to simply try periods until you get the specific results you desire. Unless there is something more mathematically tractable to offer, I'm reluctant to proceed with a design such as this one."

            it makes perfectly sense to me.

            These are the problems:

            -> if you specify a price, there may be no solution at all to the problem as the specified price may not be attainable at all
            -> you would need to redraw the indicator with each new bar, as the calculated period would change
            -> the indicator value will always show the predefined price level

            What is this good for? Sounds like chasing a white elefant.

            Comment


              #7
              -> if you specify a price, there may be no solution at all to the problem as the specified price may not be attainable at all

              You maybe right but the price has to be as close as possible from the price asked.

              -> you would need to redraw the indicator with each new bar, as the calculated period would change

              Your right it will redraw the MA at each new bars to keep it at the requested price.

              -> the indicator value will always show the predefined price level

              Exactly, and i need it to keep it that way (it would be preferable)

              What is this good for? Well thats my business, no one ever changed things doing lile everyone.:-)

              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,266 views
              0 likes
              Last Post sidlercom80  
              Started by Barry Milan, Yesterday, 10:35 PM
              3 responses
              13 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Working...
              X