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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      164 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      317 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      245 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      350 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      179 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X