Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Risk-Reward Drawing Tool Bug

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

    Risk-Reward Drawing Tool Bug

    When editing a Risk-Reward Drawing Tool, moving the Reward anchor (or Risk anchor) updates the other anchors as the anchor is moved. This is the behavior I would expect, but this is not true for the Entry anchor.

    When moving the Entry anchor, the Reward and Risk anchors are not updated as the anchor is moved. The tool is only updated after editing is complete (clicking off the tool) or by subsequently moving the Risk or Reward anchor.

    This can be fixed by replacing the following code snippet in the OnMouseMove override:
    Code:
                
                else if (DrawingState == DrawingState.Editing && editingAnchor != null)
                {
                    dataPoint.CopyDataValues(editingAnchor);
                    if (editingAnchor != EntryAnchor)
                    {
                        if (editingAnchor != RewardAnchor && Ratio.ApproxCompare(0) != 0)
                            SetReward();
                        else if (Ratio.ApproxCompare(0) != 0)
                            SetRisk();
                    }
                }
    ​
    with the following code:
    Code:
                else if (DrawingState == DrawingState.Editing && editingAnchor != null)
                {
                    dataPoint.CopyDataValues(editingAnchor);
                    if (editingAnchor == EntryAnchor)
                    {
                        if (Ratio.ApproxCompare(0) != 0)
                        {
                            SetReward();
                            SetRisk();
                        }
                    }
                    else
                    {
                        if (editingAnchor != RewardAnchor && Ratio.ApproxCompare(0) != 0) SetReward();
                        else if (Ratio.ApproxCompare(0) != 0) SetRisk();
                    }
                }
    ​
    Last edited by TheTradingMantis; 06-01-2024, 06:15 AM. Reason: Clarified the issue when editing the Risk-Reward tool.
    The Trading Mantis
    NinjaTrader Ecosystem Vendor - The Trading Mantis

    #2
    Hello TheTradingMantis,

    Thank you for the suggestion, with how the tool is currently designed it does need to wait for a chart update to recalculate the values after moving the anchor. I will make a note about this for development to review further.


    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    29 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    46 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    38 views
    0 likes
    Last Post CarlTrading  
    Working...
    X