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 MarianApalaghiei, Today, 10:49 PM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by love2code2trade, Yesterday, 01:45 PM
      4 responses
      28 views
      0 likes
      Last Post love2code2trade  
      Started by funk10101, Today, 09:43 PM
      0 responses
      8 views
      0 likes
      Last Post funk10101  
      Started by pkefal, 04-11-2024, 07:39 AM
      11 responses
      37 views
      0 likes
      Last Post jeronymite  
      Started by bill2023, Yesterday, 08:51 AM
      8 responses
      46 views
      0 likes
      Last Post bill2023  
      Working...
      X