Announcement

Collapse
No announcement yet.

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 sjsj2732, 03-23-2026, 04:31 AM
      0 responses
      76 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      313 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      312 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      149 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      113 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X