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

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 jclose, Today, 09:37 PM
          0 responses
          4 views
          0 likes
          Last Post jclose
          by jclose
           
          Started by WeyldFalcon, 08-07-2020, 06:13 AM
          10 responses
          1,413 views
          0 likes
          Last Post Traderontheroad  
          Started by firefoxforum12, Today, 08:53 PM
          0 responses
          10 views
          0 likes
          Last Post firefoxforum12  
          Started by stafe, Today, 08:34 PM
          0 responses
          10 views
          0 likes
          Last Post stafe
          by stafe
           
          Started by sastrades, 01-31-2024, 10:19 PM
          11 responses
          169 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X