Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to create macro to turn on/off autoscaling?

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

    How to create macro to turn on/off autoscaling?

    Hi all - new to NT macro writing, could use some help starting out, with a simple chart macro:

    * Chart has autoscale turned on for price bars, so they're always in view...
    * I have a moving average on the chart.
    * Normally, I run with autoscale turned on, so the moving average is always visible.
    * However, when price action moves a long distance away, the moving average autoscaling scrunches up the price bars a lot, so it's hard to read the price action.

    I can manually adjust the price axis to un-scrunch the price bars, but thought I'd take a stab at writing some sort of macro that would allow me to toggle the moving average autoscaling on/off. Maybe setup a hotkey combo that would invoke the macro, too.

    If there's a way to check the $.01 distance of the moving average from the current price bar and use that as a basis for toggling the autoscaling, that might work, too.

    I have a lot of programming/computer experience, but zero NT macro experience...

    So, can anyone point me somewhere to start on this or perhaps lay a chunk of code on me to get me started?

    Thanks...

    #2
    Hello,

    Thank you for the question.

    There are actually no Macros in NinjaTrader, you can assign key commands to certain functions but what you are wanting to do would be something of a third party application that does macros.

    The only process to Disable or Enable autoscale would be to use the indicators property menu, or to set this in script from the indicator its self.



    The only supported usage of AutoScale from script would be from within Initialize, but you could certainly try using it in OnBarUpdate in your conditions to change the autoscale. This would be if you created an Indicator that checks the Price and the MA to see how far apart they are.

    I look forward to being of further assistance.

    Comment


      #3
      Thanks for the quick response. I'll investigate your suggestions.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      576 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      553 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X