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

Stratgey limiter

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

    Stratgey limiter

    Hello all,

    Within a strategy is there a way to limit the instances of an action such as (just an example) a MACD cross over from continually causing an object from being drawn on the chart. This happens when the price action stalls within a tight range and the indicator vacillates around a narrow range during reversals. I have tried setting an offset using percent in variable amounts but am not having any luck. I should also disclose that at this time I have no market actions associated with the strategy. I'm just trying to get my visual alerts etc.. working and tested.

    I'm certain it could be hard coded but I'm trying to do this with the strategy wizard. I'm guessing that something like having a time limit or even bar/tick limit that would preclude any additional actions once one has been triggered for "N" period after. Additionally, can someone point me to where I might find a detailed tutorial on setting user variables and how I might use these.

    Any suggestions would be greatly appreciated.

    GuppyDRV

    #2
    Hello GuppyDRV,

    Thank you for writing in.

    What you could do is set a user defined variable to 1, for example.

    In your condition to draw, you'll want to check for a condition (in my example, if the close of the current bar is greater than the previous close) and that the user defined variable is NOT 1. If these are both true, then have your strategy draw and set the user defined variable to 1.

    What this will do is prevent your strategy from drawing again until that user defined variable is not 1. You could set the user defined variable back to 0 in another condition to draw again.

    I've provided a screenshot as an example attached to this post.

    We do have a reference sample on our support forum on the use of user defined variables. It can be found here: http://ninjatrader.com/support/forum...ad.php?t=15417

    Please, let us know if we may be of further assistance.
    Attached Files
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Zachary,

      Thanks for the help......you guys are rock stars! I'll have a look and let you know!

      GuppyDRV

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by WHICKED, Today, 12:45 PM
      2 responses
      18 views
      0 likes
      Last Post WHICKED
      by WHICKED
       
      Started by GussJ, 03-04-2020, 03:11 PM
      15 responses
      3,276 views
      0 likes
      Last Post xiinteractive  
      Started by Tim-c, Today, 02:10 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Taddypole, Today, 02:47 PM
      0 responses
      5 views
      0 likes
      Last Post Taddypole  
      Started by chbruno, 04-24-2024, 04:10 PM
      4 responses
      51 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Working...
      X