• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

buttons AND clicking on screen

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

    buttons AND clicking on screen

    When I use my button function I noticed that I have to click the screen in order to complete the the subroutine. Is there a way when clicking the custom button it will activate the function immediately

    private void btnManual_Click(object sender, EventArgs e)
    {
    if (btnManual.Text == "Start Line")
    {
    btnManual.Text = "Complete";
    btnManual.Font = regularFont;
    btnManual.ForeColor = Color.Black;
    btnManual.BackColor = Color.Gray;
    tTime1 = tSelectedTime;
    DrawVerticalLine("StartLine", tTime1, Color.Tan, eShortLineStyle, nShortWidthSize); //this vertical line will draw ONLY when I click on the chart. I press the button Then I have to click the chart
    }
    else
    {
    btnManual.Text = "Start Line";
    btnManual.Font = boldFont;
    btnManual.ForeColor = Color.Black;
    btnManual.BackColor = Color.Lavender;
    //bShowMarkerLine = true;
    this.drawList.Clear();
    }
    btnManual.Enabled = true;
    }

    #2
    Hello,

    Thank you for the post.

    I wanted to clarify what you mean here. Are you saying that after clicking the button you have to make the chart refresh by clicking it?

    If so, that would be expected as your button click is not an event that will cause the chart to redraw. You would need to either use ForceRefresh, or have the button complete one of the actions listed on ForceRefresh which forces a redraw. The only one that you could really cause would be adding an object and immediately removing it. Otherwise, the chart would wait for an event that causes a redraw like a click, resize, market data etc..

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      My methods do work but what i have to do is click the button THEN click on the screen in order to see my results.

      Just clicking on the button won't show anything unless I click on the screen afterwards.


      Secondly using buttons I noticed saving my workspace desn't save the lines, do I have to write a text file and reload my information?

      Comment


        #4
        Hello,

        Thank you for the reply.

        Yes In the case of having to click the chart, it sounds like you are waiting for it to refresh. Adding an object will not refresh the chart as noted in the linked ForceRefresh page, only removing objects would or other platform events like a mouse click. You can use the items I had outlined in the last message to resolve the refresh by click. You would need to either add a dummy object and remove it, or call ForceRefresh.

        Regarding the lines, NinjaScript drawn objects are not saved so you would need to implement a saving system if they should be. Otherwise, the script would need to execute its logic the same way over historical data to reproduce them each time it is reloaded. If you are manually clicking a button to add them, you would very likely need to create some saving mechanism in your logic.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Thank you for your quick response;

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by afoschini, Today, 02:57 AM
          0 responses
          1 view
          0 likes
          Last Post afoschini  
          Started by jecoyeko, Today, 12:45 AM
          0 responses
          5 views
          0 likes
          Last Post jecoyeko  
          Started by Newtrader101, Yesterday, 06:31 PM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_EricB  
          Started by Tyler7498, Yesterday, 07:34 PM
          0 responses
          4 views
          0 likes
          Last Post Tyler7498  
          Started by Woomera, Yesterday, 07:24 PM
          2 responses
          10 views
          0 likes
          Last Post Woomera
          by Woomera
           
          Working...
          X