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

Cursor change

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

    Cursor change

    Hi, I'd like to change cursor in a chart to let's say Cursors.Hand, is it possible somehow? When changing ChartControl.Cursor and ChartControl.ChartPanel.Cursor, the hand just flashes but the original cursor is immediately restored. Thank you.

    #2
    There would be unfortunaely nothing suppored in this area via NinjaScript. Where did you try changing it, in OnStartUp() to .Order?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      In fact it is in mouse click handler, I suppose it's also an unsupported area :-). On the other hand, this is just a standard Windows Forms framework, no rocket science. It just looks Ninjatrader forces the cursor internally to a specific type. Even confirming that it's not possible because of some internal cursor handling would help, I wouldn't have to spend time looking for a solution in that case. Unfortunately, with Ninjatrader there is almost always some solution if one looks and tries long enough, giving up too soon is not the best approach. Thank you.

      Comment


        #4
        Hi mantak007, could unfortunately not really provide much more background infos, however playing with that more generic C# in the ChartControls, this simple indicator seems to work well in my testing -

        public class ChangeCursor : Indicator
        {
        protected override void Initialize()
        {
        Overlay = true;
        }

        protected override void OnStartUp()
        {
        this.ChartControl.ChartPanel.MouseDown += new MouseEventHandler(this.OnMouseDownEvent);
        }

        protected override void OnBarUpdate()
        {

        }

        private void OnMouseDownEvent(object sender, MouseEventArgs e)
        {
        if (e.Button == MouseButtons.Middle && e.Clicks == 2)
        {
        ChartControl.ChartCursor = ChartCursor.Order;
        ChartControl.Invalidate();
        }
        }
        }

        A double middle click and you change your cursor .Order.

        Hope it helps
        BertrandNinjaTrader Customer Service

        Comment


          #5
          It works, thank you

          Comment


            #6
            Ninjatrader Cursor

            Where do I input this code? I have been looking for a cursor solution for some time now.

            Thank you,
            Mark

            Comment


              #7
              MSedlak,

              Attached is a sample script

              Download and import the indicator into NinjaTrader -
              To Import

              * Download the indicator to your desktop, keep them in the compressed .zip file.
              * From the Control Center window select the menu File> Utilities> Import NinjaScript
              * Select the downloaded .zip file
              * NinjaTrader will then confirm if the import has been successful.


              Critical - Specifically for some indicators, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'
              Attached Files
              Cal H.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by AdamDJ8, 05-07-2024, 09:18 PM
              2 responses
              15 views
              0 likes
              Last Post -=Edge=-  
              Started by StockTrader88, 03-06-2021, 08:58 AM
              46 responses
              4,099 views
              3 likes
              Last Post tradgrad  
              Started by usasugardefender, Today, 01:42 AM
              0 responses
              1 view
              0 likes
              Last Post usasugardefender  
              Started by haas88, 03-21-2024, 02:22 AM
              15 responses
              182 views
              0 likes
              Last Post haas88
              by haas88
               
              Started by brianfnoel, Today, 01:24 AM
              0 responses
              6 views
              0 likes
              Last Post brianfnoel  
              Working...
              X