Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

3 Points within 2 Bars

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

    #16
    Originally posted by mylanel View Post
    I created an indicator, and I wanted my indicator showed that for which 'was created only on a graph and linebreak does not work on other types of timeframe for example 5 minuts or 10 minuts
    1. Look up BarsPeriod in the NT Help to see how you can .
    2. Query BarsPeriod.BasePeriodType
    3. If it is not what you want, return out of the event handler, in this case, most likely OnBarUpdate().

    Comment


      #17
      Originally posted by FxInception View Post
      These is no error in a log, just nothing paints...

      Please find it attached if you would like to have a look.


      Thanks,
      Arthur
      That is because the computer is processing what you wrote. What you wrote is a set of conditions that can NEVER be satisfied.

      Look at it and refactor it, and what it translates to is:"if the Close of this bar is equal to the Close of the previous bar and the Close of the previous bar (because it is equal to this bar), is higher than the high of the previous bar ..."

      A bar cannot close higher than its high.

      Comment


        #18
        Ok, thank you, will try to rewrite it correctly

        But in order to have a unique line each time and keep other lines on chart, which Tag a have to use? (plot each line that matches a single condition historically)

        It says in guide:

        "A user defined unique id used to reference the draw object. For example, if you pass in a value of "myTag", each time this tag is used, the same draw object is modified. If unique tags are used each time, a new draw object will be created each time."

        Or it has to be applied another method to achieve this?


        Many thanks,
        Arthur

        Comment


          #19
          Originally posted by FxInception View Post
          Ok, thank you, will try to rewrite it correctly

          But in order to have a unique line each time and keep other lines on chart, which Tag a have to use? (plot each line that matches a single condition historically)

          It says in guide:

          "A user defined unique id used to reference the draw object. For example, if you pass in a value of "myTag", each time this tag is used, the same draw object is modified. If unique tags are used each time, a new draw object will be created each time."

          Or it has to be applied another method to achieve this?


          Many thanks,
          Arthur
          Create or find anything that is unique and use it, or concatenate it to another string and use the result. You can set up a counter, or you can use the natural counter called CurrentBar, as it has a unique one-to-one correspondence with the bars on the chart.

          Comment


            #20
            Ok, I've got what I want in terms of initial expression.

            But, as I told, the line which correspond to a particular condition disappear when the new same condition occur.


            Sorry Koganam, I can't really get what you mean in the last message, if that is solution to this... If so, could you explain it please a bit more precise.

            Just to clarify:

            Simple Higher High, Higher Low:

            if ((High[0] > High[1]) && (Low[0] > Low[1]))
            DrawLine("MyLine1", true, 1, Low[1], 0, Low[0], Color.Blue, DashStyle.Solid, 1);

            I would like to have this line on each HH HL from the very beginning of historical data.


            Many thanks,
            Arthur

            Comment


              #21
              Originally posted by FxInception View Post
              Ok, I've got what I want in terms of initial expression.

              But, as I told, the line which correspond to a particular condition disappear when the new same condition occur.


              Sorry Koganam, I can't really get what you mean in the last message, if that is solution to this... If so, could you explain it please a bit more precise.

              Just to clarify:

              Simple Higher High, Higher Low:

              if ((High[0] > High[1]) && (Low[0] > Low[1]))
              DrawLine("MyLine1", true, 1, Low[1], 0, Low[0], Color.Blue, DashStyle.Solid, 1);

              I would like to have this line on each HH HL from the very beginning of historical data.


              Many thanks,
              Arthur
              I said that the bar Number is unique to the bar, so just concatenate it to the stub.
              Code:
              DrawLine("MyLine1"+CurrentBar.ToString(), true, 1, Low[1], 0, Low[0], Color.Blue, DashStyle.Solid, 1);

              Comment


                #22
                Originally posted by koganam View Post
                I said that the bar Number is unique to the bar, so just concatenate it to the stub.
                Code:
                DrawLine("MyLine1"+CurrentBar.ToString(), true, 1, Low[1], 0, Low[0], Color.Blue, DashStyle.Solid, 1);
                Thanks a lot mate, now I got it!


                Another issue I came up with:

                double BarSize = (High[0] - Low[0]) / TickSize;

                if (BarSize < BarsPeriod.Value)
                DrawLine("Tag1" + CurrentBar.ToString(), true, 0, High[0], 0, Low[0], Color.Blue, DashStyle.Solid, 1);


                It draws this line on each bar, which is smaller than period value. But for some reason it draws it on some other ordinary bars as well.. I use range bars in case. Any idea why it happens?


                Many thanks,
                Arthur

                Comment


                  #23
                  Originally posted by FxInception View Post
                  Thanks a lot mate, now I got it!


                  Another issue I came up with:

                  double BarSize = (High[0] - Low[0]) / TickSize;

                  if (BarSize < BarsPeriod.Value)
                  DrawLine("Tag1" + CurrentBar.ToString(), true, 0, High[0], 0, Low[0], Color.Blue, DashStyle.Solid, 1);


                  It draws this line on each bar, which is smaller than period value. But for some reason it draws it on some other ordinary bars as well.. I use range bars in case. Any idea why it happens?


                  Many thanks,
                  Arthur
                  It looks like rounding errors may be flummoxing you. Print out the values to check.

                  You may want to try casting to int, or using Math.Ceiling() or Math.Floor(): after all, BarSize is attempting to find the size of the bar in ticks, which must be an integer.

                  Comment


                    #24
                    Originally posted by koganam View Post
                    It looks like rounding errors may be flummoxing you. Print out the values to check.

                    You may want to try casting to int, or using Math.Ceiling() or Math.Floor(): after all, BarSize is attempting to find the size of the bar in ticks, which must be an integer.

                    Yes, you were right, that's why it happens:

                    19.9999999999989 20
                    19.9999999999989 20
                    19.9999999999989 20
                    19.9999999999989 20
                    19.9999999999989 20
                    19.9999999999989 20
                    19.9999999999989 20

                    I am not familiar with Math operators yet... But I've checked that I have to use Ceiling. Does it has to be written exactly like this?

                    double value;
                    string nl = Environment.NewLine;

                    Console.WriteLine("{0}Ceiling:", nl);
                    for (value = 0.0; value <= 1.1; value += 0.1)
                    Console.WriteLine("Ceiling({0:f}) = {1}", value, Math.Ceiling(value));

                    Don't think so, but have no clue at all..


                    Many thanks,
                    Arthur

                    Comment


                      #25
                      Originally posted by FxInception View Post
                      Yes, you were right, that's why it happens:

                      19.9999999999989 20
                      19.9999999999989 20
                      19.9999999999989 20
                      19.9999999999989 20
                      19.9999999999989 20
                      19.9999999999989 20
                      19.9999999999989 20

                      I am not familiar with Math operators yet... But I've checked that I have to use Ceiling. Does it has to be written exactly like this?

                      double value;
                      string nl = Environment.NewLine;

                      Console.WriteLine("{0}Ceiling:", nl);
                      for (value = 0.0; value <= 1.1; value += 0.1)
                      Console.WriteLine("Ceiling({0:f}) = {1}", value, Math.Ceiling(value));

                      Don't think so, but have no clue at all..


                      Many thanks,
                      Arthur
                      Code:
                      double BarSize = Math.Ceiling((High[0] - Low[0]) / TickSize);

                      Comment


                        #26
                        Originally posted by koganam View Post
                        Code:
                        double BarSize = Math.Ceiling((High[0] - Low[0]) / TickSize);
                        A second ago sorted it out myself:

                        double BarSize = (High[0] - Low[0]) / TickSize;
                        double RoundBarSize = Math.Round(BarSize);

                        But will prefer a single line as you wrote.

                        Thanks a lot, much appreciate your help!

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        600 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        346 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        103 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        558 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        558 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X