Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Dots are not getting respected as they should be.

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

    Dots are not getting respected as they should be.

    okay so i attached a .zip file to this post if anyone wants to try and debug this code for me and fix this issue:
    [ATTACH]n1306796[/ATTACH]

    im using a stochastics fast on ninjatrader and basically have implementing the swing indicator to plot the swings on the D plot. whenever the criteria is matched in order to draw a line, it will draw a line in between the two dots. the rule for lines to be drawn is that the last recent dot [i] has to be connected to the dot before the last recent dot [i-1].

    when its playing out in real time, the dots will form a line, but the last dot (arrow pointing to it) will disappear from the line, and move over to the right forming another dot. that then causes a line to form from the first initial dot (far left) to the newly plotted dot (far right). the newly plotted dot should ONLY be looking at the dot that was removed before it (which is the [i-1] logic) to potentially connect a line since it was the one before it.

    it has something to do with the logic in "CollectSwingPoints()" There is immediate logic, and original swing logic. The dot that was removed was is the immediate logic, and the dot on the far right is the original swing logic removing the previous immediate logic dot.

    i need the logic to not only make the dot stay, but also REGISTER the dot being there so that the [i] and [i-1] logic is being followed correctly.

    its been about a week now trying to figure this out and ive had no luck at all. im hoping for someone more intelligent than me to be able to find a fix.

    code snippet:
    Code:
    private void CollectSwingPoints()
            {
                for (int i = Strength; i <= CurrentBar; i++)
                {
                    // Use immediate logic for swing highs above 80
                    if (i >= Strength && i < CurrentBar)
                    {
                        if (D[i] > 80 && D[i] > D[i - Strength] && D[i] > D[i + Strength])
                        {
                            swingHighBars.Add(i);
                            swingHighPrices.Add(D[i]);
                        }
                    }
    
                    // Use immediate logic for swing lows below 20
                    if (i >= Strength && i < CurrentBar)
                    {
                        if (D[i] < 20 && D[i] < D[i - Strength] && D[i] < D[i + Strength])
                        {
                            swingLowBars.Add(i);
                            swingLowPrices.Add(D[i]);
                        }
                    }
    
                    // Use original logic for swing highs above 80
                    int swingHighBar = swing.SwingHighBar(i, 1, int.MaxValue);
                    if (swingHighBar != -1 && D[swingHighBar] > 80)
                    {
                        double swingHighPrice = D[swingHighBar];
                        swingHighBars.Add(swingHighBar);
                        swingHighPrices.Add(swingHighPrice);
                    }
    
                    // Use original logic for swing lows below 20
                    int swingLowBar = swing.SwingLowBar(i, 1, int.MaxValue);
                    if (swingLowBar != -1 && D[swingLowBar] < 20)
                    {
                        double swingLowPrice = D[swingLowBar];
                        swingLowBars.Add(swingLowBar);
                        swingLowPrices.Add(swingLowPrice);
                    }
                }
            }​

    Click image for larger version

Name:	ghost dot.jpg
Views:	127
Size:	8.4 KB
ID:	1306795

    #2
    Hello unpacify,

    This thread will remain open for any community members that would like to debug your script as a convenience to you.

    You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.


    If you decide you want to debug this yourself, below is a link to a support article on adding debugging prints to understand behavior.


    If a dot is being moved, the tagName may have been re-used.


    I would recommend you print the time of the bar, and then in the loop print the tag and the price value used for each drawn dot.
    Save the output to a text file and include this with your next post.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    576 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    334 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
    553 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    551 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X