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

mouse click on screen

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

    mouse click on screen

    I am almost done my indicator for my chart and i am wondering in NT7 vs NT8 chartscale

    What I want to do is mouse click back on NT7 location and get the time and price

    I know how to do it in NT8 but I can not find the parameters


    private ChartScale chartScale;
    private Point clickPoint = new Point();
    private double convertedPrice;
    private DateTime convertedTime;



    if (State == State.Historical)
    {
    if (ChartControl != null)
    {
    foreach (ChartScale scale in ChartPanel.Scales)
    if (scale.ScaleJustification == ScaleJustification)
    chartScale = scale;

    ChartControl.MouseLeftButtonDown += MouseClicked;
    }
    }
    else if (State == State.Terminated)
    {
    if (ChartControl != null)
    ChartControl.MouseLeftButtonDown -= MouseClicked;
    }
    }




    protected void MouseClicked(object sender, MouseButtonEventArgs e)
    {
    // convert e.GetPosition for different dpi settings
    clickPoint.X = ChartingExtensions.ConvertToHorizontalPixels(e.Get Position(ChartPanel as IInputElement).X, ChartControl.PresentationSource);
    clickPoint.Y = ChartingExtensions.ConvertToVerticalPixels(e.GetPo sition(ChartPanel as IInputElement).Y, ChartControl.PresentationSource);

    convertedPrice = Instrument.MasterInstrument.RoundToTickSize(chartS cale.GetValueByY((float)clickPoint.Y));

    convertedTime = ChartControl.GetTimeBySlotIndex((int)ChartControl. GetSlotIndexByX((int)clickPoint.X));

    bool found = false;
    int nPatternIndex = 0;

    for(int y = 0; y < this.PatternTextTimeLocation.Count -1; y++)
    {
    if(convertedTime == this.PatternTextTimeLocation[y].STARTTIME)
    {
    found = true;
    nPatternIndex =this.PatternTextTimeLocation[y].MESSAGENUMBER;
    y = this.PatternTextTimeLocation.Count;

    }
    }

    if(found == true)
    {
    writeDrawFixedTextPattern(nPatternIndex);
    found = false;
    }

    #2
    Hello ballboy11,

    Attached is an example I have created to demonstrate in NinjaTrader 7.

    Your post is in the NinjaTrader 7 section of the forums. You are asking for NinjaTrader 7, is this correct?

    If not, see the NT8 version here:
    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      thank you that is exactly what I was looking for

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by xiinteractive, 04-09-2024, 08:08 AM
      2 responses
      11 views
      0 likes
      Last Post xiinteractive  
      Started by Irukandji, Today, 09:34 AM
      1 response
      3 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by RubenCazorla, Today, 09:07 AM
      1 response
      5 views
      0 likes
      Last Post RubenCazorla  
      Started by TraderBCL, Today, 04:38 AM
      3 responses
      25 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by WeyldFalcon, 08-07-2020, 06:13 AM
      11 responses
      1,423 views
      0 likes
      Last Post jculp
      by jculp
       
      Working...
      X