Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

VSA Indicator - Beta

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

    VSA Indicator - Beta

    I try to port an existing VSA Indicator from an Amibroker code. Anyone can check the AFL File to see if the port is good?, first time working with Ami codes. Also comments from VSA Fans are welcome to see if we can have a useful indicator

    Here you can find the Original code: http://www.vpanalysis.blogspot.com/

    PD
    Thanks Roonius for the fix in the shading routine.

    Regards
    Attached Files
    Last edited by PrTester; 01-04-2009, 04:35 PM. Reason: update File

    #2
    Here is my take on the same AmiBroker code.

    Notes: I coded a Wilder MA indicator that is included in the attached file. I also used LinRegSlopSFX to find the slope. Also, I used a slightly different color scheme to paint the bars with.
    Attached Files

    Comment


      #3
      Originally posted by scjohn View Post
      Here is my take on the same AmiBroker code.

      Notes: I coded a Wilder MA indicator that is included in the attached file. I also used LinRegSlopSFX to find the slope. Also, I used a slightly different color scheme to paint the bars with.
      scjohn, thanks for the share, i will check my interpretation with your code to see where its different, also my color scheme it's horrible I will check it and revise, he, he.

      Best Regards, and Happy Holidays.

      Comment


        #4
        With the help of scjohn code I made some updates and fix to my port, uploaded in the first post.

        Comment


          #5
          Thanks PrTester and scjohn, great work!
          BertrandNinjaTrader Customer Service

          Comment


            #6
            div by zero error?

            great code and thanks for sharing.

            Code:
            //			Price information
            			upbar.Set(Close[0] > Close[1] ? true : false); 	
            			dnbar.Set(Close[0] < Close[1] ? true : false); 
            			Cloc=Close[0]-Low[0];
            			[COLOR="Red"]x=spread[0]/Cloc;[/COLOR]
            			x1 =( Close[0] - Low[0] == 0.00 ? arg[0] : x );
            could someone help explain why this doesn't return a div by zero error when the close[0] = low[0]? To my tiny knowledge Cloc therefore = 0?

            Comment


              #7
              Potentially double.Epsilon issues: http://www.ninjatrader-support2.com/...ead.php?t=3929
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                that is an issue

                Interesting. How does the close/low ever equal something that was not traded? I assume that NT just takes the transmitted data price ( in my case IB)?
                eg close = 2157. It can't equal for example 2157.000000001 or can it?

                Would the correct code therefore be
                nb I have now removed the cloc variable altogether
                Code:
                if (Instrument.MasterInstrument.Compare (Close[0], Low[0]) == 0
                {x = 0;}
                else
                {x = range[0] / (Close[0] - Low[0]);}
                I should add no div by zero error or crash of any kind has happened with the original code but I am learning C# 101.
                Dollars are in the detail.
                Last edited by Mindset; 01-05-2009, 12:21 PM.

                Comment


                  #9
                  When you do any subtraction, multiplication, etc with double values they can end up not equaling zero exactly. Long story short, you have to be mindful of the double.Epsilon. This is a more technical C# topic. For more information try combing through google.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    data and doubles and epsilon

                    Ok but just to confirm if Low[0] = 1234 then it always equals 1234 unless you start to manipulate it. NT doesn't do any "data processing" of it's own?

                    In which case, Close[0] = low[0] could return zero - and I am right back to the original query - how is the div by zero error avoided?

                    I am not being difficult but I need to understand.

                    Comment


                      #11
                      NT does not change the data it receives. Your check for 0 is already manipulating it. Close[0] - Low[0] is stored into your temp variable. That temp variable is no guaranteed to be 0.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        learn something

                        Well I spent some time last night testing out this data concept and it appears you are right - 3.56 - 3.55 does not equal .01 difference.
                        It often has rogue digits 4,5 or even 10 decimal places away!

                        One thing however - where close and low were equal my print statement always returned zero. But now I don't know whether that really is a true zero or has some weird digit 17 decimal places away that I can't see ( I understand that double values go approx 15- 16 decimal places?)
                        Last edited by Mindset; 01-06-2009, 10:09 AM. Reason: sp

                        Comment


                          #13
                          Mindset,

                          This is C# and the concept revolves around double.Epsilon. It may be best for you to research this matter on MSDN. Unfortunately I cannot provide any more assistance on this.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #14
                            Hello Mindset,

                            when I have to use price bar numbers heavily for calculations then I convert them into the tick representation before usage. That also avoids these special double-issues.

                            Regards
                            Ralph

                            Comment


                              #15
                              tick representation

                              Do you mean TickSize?
                              Perhaps you could show an example?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Christopher_R, Today, 12:29 AM
                              0 responses
                              9 views
                              0 likes
                              Last Post Christopher_R  
                              Started by sidlercom80, 10-28-2023, 08:49 AM
                              166 responses
                              2,235 views
                              0 likes
                              Last Post sidlercom80  
                              Started by thread, Yesterday, 11:58 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post thread
                              by thread
                               
                              Started by jclose, Yesterday, 09:37 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post jclose
                              by jclose
                               
                              Started by WeyldFalcon, 08-07-2020, 06:13 AM
                              10 responses
                              1,415 views
                              0 likes
                              Last Post Traderontheroad  
                              Working...
                              X