Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Force plots to redraw on mouse click?

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

    Force plots to redraw on mouse click?

    I'm wanting my plot to redraw originating from a point I click on the chart.

    I already have the mouse click working and even the time of where I click registers. The indicator does actually update with the new time of origin but only if I do "Reload NinjaScript" manually.

    What will force the indicator to replot everything after clicking?

    Update(), ForceRefresh(), or resetting the Values arrays will not do it. What will it take?



    protected void MouseClicked(object sender, MouseButtonEventArgs e)
    {
    // If not "Anchored" duration type, skip this function
    if(Duration!=DurationType.Anchored) { return; }

    // Is either Shift key pressed down? If so, proceed
    if((!Keyboard.IsKeyDown(Key.LeftShift)) && (!Keyboard.IsKeyDown(Key.RightShift))) { return; }
    else { Print("Hello"); }

    // Get XY click point
    clickPoint.X = ChartingExtensions.ConvertToHorizontalPixels(e.Get Position(ChartControl as IInputElement).X,ChartControl.PresentationSource);
    clickPoint.Y = ChartingExtensions.ConvertToVerticalPixels(e.GetPo sition(ChartControl as IInputElement).Y,ChartControl.PresentationSource);
    convertedPrice = Instrument.MasterInstrument.RoundToTickSize(chartS cale.GetValueByY((float)clickPoint.Y));
    convertedTime = ChartControl.GetTimeBySlotIndex((int)ChartControl. GetSlotIndexByX((int)clickPoint.X));

    AnchoredDate = convertedTime; // AnchoredDate right now is a user input and a datetime
    Print(AnchoredDate);
    Update(); // Does not work
    ForceRefresh(); // Does not work
    }​

    #2
    Hello renner1984,

    Thanks for your notes.

    Unfortunately, there is no supported technique for calling Reload NinjaScript programmatically to force an indicator on the chart to reload and re-draw/re-plot everything.

    We are tracking interest for this in an existing internal feature request ticket and I have added your vote. This request is being tracked under the number SFT-1579.

    As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted on the Release Notes page of the Help Guide.

    Release Notes — https://ninjatrader.com/support/help...ease_notes.htm
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

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