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 Belfortbucks, Today, 09:29 PM
      0 responses
      3 views
      0 likes
      Last Post Belfortbucks  
      Started by zstheorist, Today, 07:52 PM
      0 responses
      7 views
      0 likes
      Last Post zstheorist  
      Started by pmachiraju, 11-01-2023, 04:46 AM
      8 responses
      150 views
      0 likes
      Last Post rehmans
      by rehmans
       
      Started by mattbsea, Today, 05:44 PM
      0 responses
      6 views
      0 likes
      Last Post mattbsea  
      Started by RideMe, 04-07-2024, 04:54 PM
      6 responses
      33 views
      0 likes
      Last Post RideMe
      by RideMe
       
      Working...
      X