Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

VSA Indicator - Beta

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

    #16
    Originally posted by Mindset View Post
    Do you mean TickSize?
    Perhaps you could show an example?
    Yes, that's what I ment. In case your final calculation can be used as integer values then it is an easy desicion. If you have to covert double-> int first and at the end int -> double then it depends (conversion takes time, integer calculation saves time).

    At the example below I calculated rectangles based on prices to be plotted with the indicator's Plot()-method. Therefore the coversion made sense.

    Regards
    Ralph

    Code:
    [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]public[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] TimePeriod(DateTime StartDate, [/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] PriceHigh, [/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] PriceLow)[/SIZE][/FONT]
    [SIZE=2][FONT=Courier New]{[/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] int[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] dim;[/SIZE][/FONT]
    [SIZE=2][FONT=Courier New] startDate = StartDate;[/FONT][/SIZE]
    [SIZE=2][FONT=Courier New] baseInst = dataInst.BaseInstance;[/FONT][/SIZE]
    [SIZE=2][FONT=Courier New] boxSize = baseInst.BoxSize;[/FONT][/SIZE]
    [SIZE=2][FONT=Courier New] priceHigh = [B][COLOR=red]([/COLOR][/B][/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][COLOR=red][B]int[/B][/COLOR][/SIZE][/FONT][/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][B][COLOR=red])(PriceHigh / TickSize)[/COLOR][/B] / boxSize * boxSize;[/SIZE][/FONT]
    [SIZE=2][FONT=Courier New] priceLow = [B][COLOR=red]([/COLOR][/B][/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][COLOR=red][B]int[/B][/COLOR][/SIZE][/FONT][/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][B][COLOR=red])(PriceLow / TickSize)[/COLOR][/B] / boxSize * boxSize;[/SIZE][/FONT]
    [SIZE=2][FONT=Courier New] dim = (priceHigh - priceLow) / boxSize + [/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]1[/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][FONT=Courier New][SIZE=2] priceRects = [/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]new[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] Rectangle[dim];[/SIZE][/FONT]
    [SIZE=2][FONT=Courier New] borderPen = [/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]new[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] Pen(Color.Black);[/SIZE][/FONT]
    [SIZE=2][FONT=Courier New] fillBrush = [/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]new[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] SolidBrush(Color.Empty);[/SIZE][/FONT]
    [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
    [/SIZE][/FONT]

    Comment


      #17
      Cast

      V Interesting thank you.
      Is this a form of casting then - taking a double and making it an int as such?
      I wonder which is quicker?

      Code:
      Compare( Low[0],Close[0])
      or

      Code:
      iclose = Close[0] / TickSize;
      iLow = Low[0] / tickSize;
      if (iclose = ilow).....

      Comment


        #18
        Yes, dividing with TickSize eliminates the fraction of the value, but it is still a double, the C#-compiler is very strict so you need to cast it explicitely.

        I don't know which one is quicker. It is 3 operations against a single compare ...
        But you could try to find it out. You could measure cpu-time in ticks (100 nano seconds) and calculate the difference.

        int time1 = DateTime.Now.Ticks;
        compare()...
        int diff = DateTime.Now.Ticks - time1;

        Regards
        Ralph

        Comment


          #19
          May be it will be worth attention.
          Be careful with "casting"
          double doublevalue = 1.99999999;
          int castValue = (int)doublevalue;

          castValue gonna be 1 (not 2)
          Last edited by roonius; 01-08-2009, 08:33 PM.

          Comment


            #20
            Thanks roonius good point. I never had a problem with that but was wondering whether it could or should. Maybe it works because I convert before I apply the first operation to the price value. Just my personal experience.

            For NT there is a function Round2TickSize() available, perhaps that's the save way.

            Regards
            Ralph

            Comment


              #21
              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.
              Hi scjohn

              I am interested in this indicator ...do you have any information as to exactly what the different symbols signify. I had a look at the blogsite but it is not specific. And if I wanted to change the color code how would I? Do I need to go directly into the script?

              thanks for your work!

              Comment


                #22
                There is really no documentation of what the various symbols mean. One would have to study the code and make an educated guess.

                If you want to change colors then you have to into the code and make the change.

                Comment


                  #23
                  The first thing I did was change the candles since I hate solid candles and prefer to see the trend style. Also the light colors were hard to see unless the chart background was VERY dark. Even these colors work best on a darker gray background.

                  Code:
                  #region Candle Definition                    
                          
                              if ( TLS > 0.00 && TLM > 0.00 && TLL > 0.00)
                                  {  
                      CandleOutlineColor = Color.LimeGreen; 
                      if(Open[0]<Close[0] && ChartControl.ChartStyleType == ChartStyleType.CandleStick ) {
                                          BarColor  = Color.Transparent;
                                      } else{
                                          BarColor  = Color.Lime;
                                      }                                
                                  } 
                              
                              else if ( TLS > 0.00 && TLM > 0.00 && TLL < 0.00)
                                  {  
                      CandleOutlineColor = Color.DarkGreen; 
                      if(Open[0]<Close[0] && ChartControl.ChartStyleType == ChartStyleType.CandleStick ) {
                                          BarColor  = Color.Transparent;
                                      } else{
                                          BarColor  = Color.Green;
                                      }                                
                                  } 
                              else if ( TLS > 0.00 && TLM < 0.00 && TLL < 0.00)
                                  {  
                      CandleOutlineColor = Color.LightGreen; 
                      if(Open[0]<Close[0] && ChartControl.ChartStyleType == ChartStyleType.CandleStick ) {
                                          BarColor  = Color.Transparent;
                                      } else{
                                          BarColor  = Color.PaleGreen;
                                      }                                
                                  } 
                              else if ( TLS< 0.00 && TLM < 0.00 && TLL < 0.00)
                                  {  
                      CandleOutlineColor = Color.Red; 
                      if(Open[0]<Close[0] && ChartControl.ChartStyleType == ChartStyleType.CandleStick ) {
                                          BarColor  = Color.Transparent;
                                      } else{
                                          BarColor  = Color.OrangeRed;
                                      }                                
                                  } 
                              else if ( TLS< 0.00 && TLM > 0.00 && TLL > 0.00)
                                  {  
                      CandleOutlineColor = Color.LightGreen; 
                      if(Open[0]<Close[0] && ChartControl.ChartStyleType == ChartStyleType.CandleStick ) {
                                          BarColor  = Color.Transparent;
                                      } else{
                                          BarColor  = Color.PaleGreen;
                                      }                                
                                  } 
                              else if ( TLS< 0.00 && TLM < 0.00 && TLL > 0.00)
                                  {  
                      CandleOutlineColor = Color.HotPink; 
                      if(Open[0]<Close[0] && ChartControl.ChartStyleType == ChartStyleType.CandleStick ) {
                                          BarColor  = Color.Transparent;
                                      } else{
                                          BarColor  = Color.Pink;
                                      }                                
                                  } 
                              else {  
                      CandleOutlineColor = Color.Gold; 
                      if(Open[0]<Close[0] && ChartControl.ChartStyleType == ChartStyleType.CandleStick ) {
                                          BarColor  = Color.Transparent;
                                      } else{
                                          BarColor  = Color.Yellow;
                                      }
                              }
                  eDanny
                  NinjaTrader Ecosystem Vendor - Integrity Traders

                  Comment


                    #24
                    how to import formula

                    could you put it in zip format for direct importing in NT. I dont know how to import formula you rightet

                    Thanks in advance

                    Comment


                      #25
                      My version of the indicator has been edited for my own use. You will have to just copy and paste the code to your indicator. Then re-compile.
                      eDanny
                      NinjaTrader Ecosystem Vendor - Integrity Traders

                      Comment


                        #26
                        nice work, thx for sharing

                        can you give me a discription of how to read/use the indicator?

                        thx

                        Comment


                          #27
                          Turn some features off

                          Hi,

                          Is there an easy way to turn some features off. Like bar coloring?

                          Also is there a key to what the shapes indicate

                          regards,

                          Blair

                          Comment


                            #28
                            Originally posted by blaircampbell View Post
                            Hi,

                            Is there an easy way to turn some features off. Like bar coloring?

                            Also is there a key to what the shapes indicate

                            regards,

                            Blair
                            Blair,


                            The original author has a blog in the following http - www.vpanalysis.blogspot.com/, in order to turn off any feature just comment the associated part with " // " prior to any statement and your ready to rock.

                            Best Regards,

                            Comment


                              #29
                              Thanks

                              Thanks PrTester for your great work!!
                              Thanks to the others for their contribuition!

                              I have a question/suggestion, PrTester it's possible to change the banner and put them as background, so it does not cover the candle chart, and maybe even the possibility to change their position between the different chart corner?


                              Thanks.

                              Lubo.

                              Comment


                                #30
                                Originally posted by LuboLabo View Post
                                Thanks PrTester for your great work!!
                                Thanks to the others for their contribuition!

                                I have a question/suggestion, PrTester it's possible to change the banner and put them as background, so it does not cover the candle chart, and maybe even the possibility to change their position between the different chart corner?


                                Thanks.

                                Lubo.
                                Hey LuboLabo, only need to change the DrawtextFixed colors for Transparent and your done, also you can change the position in the same line.

                                Regards

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by rtwave, 04-12-2024, 09:30 AM
                                2 responses
                                20 views
                                0 likes
                                Last Post rtwave
                                by rtwave
                                 
                                Started by tsantospinto, 04-12-2024, 07:04 PM
                                5 responses
                                67 views
                                0 likes
                                Last Post tsantospinto  
                                Started by cre8able, Today, 03:20 PM
                                0 responses
                                6 views
                                0 likes
                                Last Post cre8able  
                                Started by Fran888, 02-16-2024, 10:48 AM
                                3 responses
                                49 views
                                0 likes
                                Last Post Sam2515
                                by Sam2515
                                 
                                Started by martin70, 03-24-2023, 04:58 AM
                                15 responses
                                115 views
                                0 likes
                                Last Post NinjaTrader_Jesse  
                                Working...
                                X