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

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.
    JesseNinjaTrader Customer Service

    Comment


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

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by andrewtrades, Today, 04:57 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by chbruno, Today, 04:10 PM
      0 responses
      3 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by josh18955, 03-25-2023, 11:16 AM
      6 responses
      436 views
      0 likes
      Last Post Delerium  
      Started by FAQtrader, Today, 03:35 PM
      0 responses
      7 views
      0 likes
      Last Post FAQtrader  
      Started by rocketman7, Today, 09:41 AM
      5 responses
      19 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X