Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Scalper

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

    #46
    What is the most current ver, the on in post #1 or post #34 ?

    Thanks,
    Al

    Comment


      #47
      I believe they are just different versions of each other. Pick and choose which one you want. Or take both?
      Josh P.NinjaTrader Customer Service

      Comment


        #48
        Hello Gumphrie,

        I'm wondering if you can help me on these 2 questions, because I saw your code and find a partial answer to it.

        1) Could you indicate a method to calculate the number of bars in the current Chart View Area ?.


        The reason is that I would like to Draw some Text or Plot some arrows on the charts, but depending on the scale of the chart, I need to know what is the Maximum / Low value of price in the current view area.



        To plot one arrow in a 3 min chart, where the Max-Min value of current view are is 20 pts I can use this line of code:
        DrawArrowDown("down", 0, High[0]+TickSize, Color.Blue);



        However in one scale of 30 min, I have to ajust the Vertical position so that the arrow would be well above the candle:
        DrawArrowDown("down", 0, High[0]+TickSize*5, Color.Blue);



        How can I know the Max and Min value of the Current View Area of one Chart?


        I think If I got the number of bars of current view area (not Bars.BarsSinceSession), but only the number of Bars that are currently displayed, in order to obtain the Max and Min.


        Attached is one image that shows what I mean.



        2) I've seen in your script a method to calculate the Size of current Chart View Area.
        Height = (bounds.Y + bounds.Height) // like in your code
        or Height = bounds.Size.Height; // would give the Height in pixels

        The problem is that to access those bounds.... it seams to be necessary to include it in a function like this:
        public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)



        That is declared outside the OnBarUpdate() procedure, and when the code goes to that procedure,
        doesn't come back to OnBarUpdate() procedure.



        The question is, how do we get these values without having to put them inside that procedure?


        If we don't do that, we receive a error code saying:
        the name 'bounds' doesn't exist in the current context



        -------------


        Help would be more then welcome.


        Kind regards,

        Candido
        Originally posted by Gumphrie View Post
        Hi Whitegun,

        Yes, there are two thing things that make it hard to use in any strategy.

        1. It overrides the Plot class and doesn't actually write out any plots a strategy could pick up. You could get around this by creating another indicator using the same code that does write out a plot, but...
        2. It colours in the bars retrospectively so anything you plot will not match up with the actual bars plotted.


        That said, please find attached an indicator that has two plots, "ScalpUpSeries" and "ScalpDownSeries" in different colours. If you add it to your chart it will plot a positive value ("1") when a Scalp Up bar is detected and a negative value ("-1") when a Scalp Down Bar is plotted. So something like :

        Code:
        [FONT=Courier New]if (ScalpPlot.ScalpUpSeries[0]==1)[/FONT]
         [FONT=Courier New][SIZE=2]{[/SIZE][/FONT]
        [FONT=Courier New][SIZE=2]EnterShort(DefaultQuantity, [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000]""[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]);[/SIZE][/FONT]
         [FONT=Courier New][SIZE=2]}[/SIZE][/FONT]
        Attached Files

        Comment


          #49
          Originally posted by cmrodrig View Post
          The question is, how do we get these values without having to put them inside that procedure?

          If we don't do that, we receive a error code saying:
          the name 'bounds' doesn't exist in the current context
          Hi Candido,

          All that stuff is confined to the Plot class as you say.
          The bounds stuff is related to pixels I think, take a look at ChartControl.LastBarPainted and ChartControl.BarsPainted, they may give you something closer to what you're looking for.

          Comment


            #50
            Regarding your first question, yes that's the kind of fiddly problem that can be annoying. You just have to find a "happy median". If its at least a ticksize away you know you cannot collide with the candle even if it doesn't look great in all cases. I'm sure there must be better way, but one doesn't spring to mind...

            Comment


              #51
              Try creating some global scope public variables for the values you want, and assign them within the plot method, so then the values you want will now be available outside of the plot method.

              Originally posted by Gumphrie View Post
              Regarding your first question, yes that's the kind of fiddly problem that can be annoying. You just have to find a "happy median". If its at least a ticksize away you know you cannot collide with the candle even if it doesn't look great in all cases. I'm sure there must be better way, but one doesn't spring to mind...

              Comment


                #52
                Gumprie,

                Thanks for the suggestions.
                I came up with this code, to calculate an average distance to plot something away from a candle, based on a conversion of Points to Pixels.

                double Height = ChartControl.Bounds.Height;
                int xBars = ChartControl.BarsPainted-1;
                double xHigh = MAX(High, xBars)[0];
                double xLow = MIN(Low, xBars)[0];
                xPixels = 50*(xHigh-xLow)/Height; // 50 Pixels translated to Points

                ChartControl.Bounds.Height as the number I wanted with Plots.Bound

                Thanks for all

                Comment


                  #53
                  Cool,

                  Now, has anyone found a way to convert the Y value of a pixel on a chart, to its equivalent price on the price scale? NT Support, is mum about this. The best I can come up with is to get the high and low of all the bars painted on the screen, and use that along with the height of the screen in pixels to get an approximation.



                  Originally posted by cmrodrig View Post
                  Gumprie,

                  Thanks for the suggestions.
                  I came up with this code, to calculate an average distance to plot something away from a candle, based on a conversion of Points to Pixels.

                  double Height = ChartControl.Bounds.Height;
                  int xBars = ChartControl.BarsPainted-1;
                  double xHigh = MAX(High, xBars)[0];
                  double xLow = MIN(Low, xBars)[0];
                  xPixels = 50*(xHigh-xLow)/Height; // 50 Pixels translated to Points

                  ChartControl.Bounds.Height as the number I wanted with Plots.Bound

                  Thanks for all

                  Comment


                    #54
                    Probably could work it out from the inverse which is :

                    int y = (bounds.Y + bounds.Height) - ((int) (((PRICE - min) / ChartControl.MaxMinusMin(max, min)) * bounds.Height));

                    Where y is the pixel value and PRICE is the price and the max and min are inputs to the Plot method.

                    Originally posted by monpere View Post
                    Cool,

                    Now, has anyone found a way to convert the Y value of a pixel on a chart, to its equivalent price on the price scale? NT Support, is mum about this. The best I can come up with is to get the high and low of all the bars painted on the screen, and use that along with the height of the screen in pixels to get an approximation.

                    Comment


                      #55
                      Not sure if that gets me what I want. Basically, if you choose the crosshair cursor, and move the cursor to any point on the chart, I want to get the price at the right edge right axis of the chart that the horizontal cursor line is displaying (also shows in minidatabox). Right now, I can get the pixel where the horizontal cursor is at, but can't find the info that relates the horizontal line to the price.

                      Originally posted by Gumphrie View Post
                      Probably could work it out from the inverse which is :

                      int y = (bounds.Y + bounds.Height) - ((int) (((PRICE - min) / ChartControl.MaxMinusMin(max, min)) * bounds.Height));

                      Where y is the pixel value and PRICE is the price and the max and min are inputs to the Plot method.

                      Comment


                        #56
                        Originally posted by Gumphrie View Post
                        Probably could work it out from the inverse which is :

                        int y = (bounds.Y + bounds.Height) - ((int) (((PRICE - min) / ChartControl.MaxMinusMin(max, min)) * bounds.Height));

                        Where y is the pixel value and PRICE is the price and the max and min are inputs to the Plot method.
                        Problem here is that bounds.Y is not recognized, and an error saying The name 'bounds' does not exist in the current context is generated.

                        Because of that, I suggested the alternative ChartControl.Bounds.Height, that does not produce an error when compiling.

                        Where can we find documentation about this type of data, in MSDN site ?

                        Regards,

                        Comment


                          #57
                          Aha! min, max where the missing pieces. I never previously looked at the plot parameters at all. I also used CanvasTop,CanvasBottom instead of Height.

                          Thanx Gumphrie

                          Originally posted by Gumphrie View Post
                          Probably could work it out from the inverse which is :

                          int y = (bounds.Y + bounds.Height) - ((int) (((PRICE - min) / ChartControl.MaxMinusMin(max, min)) * bounds.Height));

                          Where y is the pixel value and PRICE is the price and the max and min are inputs to the Plot method.

                          Comment


                            #58
                            Only problem I found with this indicator is it doesnt update.
                            If you put it on 5 min bars and leave it for an hour or so.
                            Then come back and right click on the chart and click indicators and then just click apply straight away you will see 3-4 signals pop up that didnt come.
                            Anyway to fix this and or have it auto refresh?

                            Comment


                              #59
                              Hi Mike,

                              I did as you suggested, applied it to a 5 min chart and left it. It still updates for me once the trigger bars are broken. Try using the highlight trigger bars option and see if there is still a problem.

                              Comment


                                #60
                                Gumphrie what ive found is if I have it on the same chart as autotrendline this is when it does it.
                                If I have it on a chart by itself there is no issue.Also when its on the same chart as autotrendline, when I click the indicators then apply there is always a lag delay.This must be something to do with the calculations of the trendline indicator.Which doesnt come and go as quick so it lags a bit.
                                So basically have them on seperate charts and no problem.
                                So its not the scalper indicator its just how it works and using on same chart as autotrendline which does more calculations it lags the scalper indicator.
                                Also is this indicator based on anything to do with ZigZag because if you put a ZZ on the same chart it seems to come and go at similar points.
                                Thanks.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Haiasi, 04-25-2024, 06:53 PM
                                2 responses
                                16 views
                                0 likes
                                Last Post Massinisa  
                                Started by Creamers, Today, 05:32 AM
                                0 responses
                                4 views
                                0 likes
                                Last Post Creamers  
                                Started by Segwin, 05-07-2018, 02:15 PM
                                12 responses
                                1,785 views
                                0 likes
                                Last Post Leafcutter  
                                Started by poplagelu, Today, 05:00 AM
                                0 responses
                                3 views
                                0 likes
                                Last Post poplagelu  
                                Started by fx.practic, 10-15-2013, 12:53 AM
                                5 responses
                                5,407 views
                                0 likes
                                Last Post Bidder
                                by Bidder
                                 
                                Working...
                                X