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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        152 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        89 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        131 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        127 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        107 views
        0 likes
        Last Post CarlTrading  
        Working...
        X