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 Tim-c, Today, 10:58 AM
      0 responses
      1 view
      0 likes
      Last Post Tim-c
      by Tim-c
       
      Started by traderqz, Yesterday, 09:06 AM
      3 responses
      21 views
      0 likes
      Last Post NinjaTrader_ThomasC  
      Started by f.saeidi, Today, 10:19 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by kujista, Today, 06:23 AM
      5 responses
      18 views
      0 likes
      Last Post kujista
      by kujista
       
      Started by traderqz, Today, 12:06 AM
      3 responses
      6 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X