Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

3 Bar Line

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

    3 Bar Line

    Hi NT,

    I built a simple script that search for '3 bar triangles'.
    The pattern is formed when a bar[0] is inside the 2-day high/low range.

    Code:
    if ((High[0] < High[1] || High[0] < High[2]) && (Low[0] > Low[1] || Low[0] > Low[2]))
    At the moment, I add a dot under the bar[0] to see it on the chart..

    Code:
    Draw.Dot(this, "LOW" + CurrentBar, true, 0, Low[0] - ((ATR(14))[0]/2), Brushes.Yellow);
    Instead of having this dot, i'd like to have 2 small horizontal lines.... that have the length of the 3 bars, one at the price of the highest high of the 3 bars and one at the lowest low of the 3 bars - i've attached a simple picture to illustrate the desired outcome (red lines)

    What could I replace the Draw.Dot with ?

    Thanks in advance
    AK
    Attached Files

    #2
    Hello,

    Thank you for the post.

    The easiest solution would be to use Lines instead of Dots. The only part that you would need to consider would be when this condition becomes true, at that point where the end and beginning of the line should go.

    You will have access to the high and low of the bars, so the Price is not necessarily a concern. The price for the start bar would be the High or Low with the number of BarsAgo you have determined is the start of the line.

    When the dot is drawn currently, you would likely need to utilize the BarsAgo overload to set a Line a few bars back up till the current bar.


    The Line takes two BarsAgo, 0 can be used to achieve the Current bar. You would just need to determine how many BarsAgo the start of the line should be placed when the condition becomes true.

    I look forward to being of further assistance.

    Comment


      #3
      Hi Jesse,

      Draw.Line worked a treat, but only for the latest pattern on the chart for some reason.

      Code:
      Draw.Line(this, "tag1", false, 2, Math.Max(High[1],High[2]), 0, Math.Max(High[1],High[2]), Brushes.Yellow, DashStyleHelper.Solid, 2);
      Draw.Line(this, "tag2", false, 2, Math.Min(Low[1],Low[2]), 0, Math.Min(Low[1],Low[2]), Brushes.Yellow, DashStyleHelper.Solid, 2);
      I suspect the issues lies with the '2' (startBarsAgo) and '0' and (endBarsAgo).
      Any idea what I should replace these values with to allow my script to draw the lines for historical patterns ? I dont have the same issue with Draw.Dot.

      See the screeshot attached, which shows the yellow single dots working fine historically, but my new 3 bar line only worksfor the latest pattern.. if though they are right one after the other in the IF statement..

      Code:
      if ((High[0] < High[1] || High[0] < High[2]) && (Low[0] > Low[1] || Low[0] > Low[2]))
      {
      Draw.Dot(this, "LOW" + CurrentBar, true, 0, Low[0] - ((ATR(14))[0]/2), Brushes.Yellow);	
      						
      Draw.Line(this, "tag1", false, 2, Math.Max(High[1],High[2]), 0, Math.Max(High[1],High[2]), Brushes.Yellow, DashStyleHelper.Solid, 2);
      
      Draw.Line(this, "tag2", false, 2, Math.Min(Low[1],Low[2]), 0, Math.Min(Low[1],Low[2]), Brushes.Yellow, DashStyleHelper.Solid, 2);
      Attached Files

      Comment


        #4
        Hello,

        Thank you for the reply.

        It looks like you are using a single tag name instead of something unique which would only allow one line at a time per tag name.

        Try using:

        Code:
        "tag1" + CurrentBar
        Code:
        Draw.Line(this, [B]"tag1" + CurrentBar[/B], false, 2, Math.Max(High[1],High[2]), 0, Math.Max(High[1],High[2]), Brushes.Yellow, DashStyleHelper.Solid, 2);
        This should allow the script to leave existing lines and draw a new one.

        I look forward to being of further assistance.

        Comment

        Latest Posts

        Collapse

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