Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Logic Question bars with same low

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

    Logic Question bars with same low

    I am trying to write some code that will help me identify certain patterns on a chart. I am hoping someone can help me.

    I would like to identify a series of bars that have the same lows, but obviously they all cant be equal. So I am trying to find a series of bars (all in a row) where lets say 8 out of 10 all have the same low.

    I am thinking there is a way to create an object that i can iterate thru to check values and set flags. Can someone point me in the correct direction?

    Thanks in advance

    #2
    You could create a HashTable or any other .NET collectiont hat can store a key and value pair, then you can iterate through the last 10 bars, store the key (price) and the value, the number of times you have seen this price. Then you can iterate through the HashTable to see if any of the objects contain values greater than X?
    RayNinjaTrader Customer Service

    Comment


      #3
      Thanks Ray, this is what i actually wound up doing:
      Code:
      [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] x = 0; 
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] trueOccur = 0;
      
      [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// Condition set 1
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]do[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] 
      { 
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (Low[x+1] == Low[0])
      {
      trueOccur = trueOccur + 1;
      }
      [/SIZE][SIZE=2]
      x = x + 1; 
      } 
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]while[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (x < barsTested);
      
      
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (trueOccur >= barsLowEqual)
      {
      Do something here[/SIZE][SIZE=2]
      }
      [/SIZE]

      Comment


        #4
        Got it. My approach is if the last lows did NOT have to equal the current low, which is what it looks like you are doing.
        RayNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        160 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        308 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        245 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        349 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        179 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X