Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by poplagelu, Today, 05:00 AM
    0 responses
    3 views
    0 likes
    Last Post poplagelu  
    Started by fx.practic, 10-15-2013, 12:53 AM
    5 responses
    5,407 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by Shai Samuel, 07-02-2022, 02:46 PM
    4 responses
    98 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by DJ888, Yesterday, 10:57 PM
    0 responses
    8 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by MacDad, 02-25-2024, 11:48 PM
    7 responses
    160 views
    0 likes
    Last Post loganjarosz123  
    Working...
    X