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

Procedural dilemma : DrawingObject in a strategy

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

    Procedural dilemma : DrawingObject in a strategy

    Hey Support and Users,

    let's start with a real simple detailed example from the MACD :
    - In the figure 1 we have 2 horizontal lines placed, locked and tagged at a +1 distance from the ZeroLine. These 2 lines actually are a "NON VARIABLE OFFSET" of the ZeroLine.
    But we cannot set an alert(or strategy) when this distance is reached by Price from the indicator, because the ZeroLine and its eventual offset are not available by default as conditions, only MACD, AVG and Diff.
    - In the figure 2 we can see how the Horizontal Line DrawObjects are used with an alert.

    What is the best way to proceed to create/make appear a non variable permanent value that can be used as a condition in the Strategy Builder ?
    We could just use the alerts like suggested here https://ninjatrader.com/support/foru...03#post1099703, but it seems that the Strategy Builder can offer a set of conditions and logics far superior than alerts. Also the examples in this link are for VARIABLE and moving horizontals, it is not the case with our horizontals.
    I hear it is also possible to maybe add a bool or serie to a modified MACD indicator? Maybe just set something in the Strategy Builder Inputs section or alike ?
    What are the less Calculations heavy solutions ?

    Thank you

    #2
    *But we cannot set an alert(or strategy) - when this distance from the ZL is reached by MACD - from the indicator, because the ZL ...
    Last edited by Amedeus; 05-02-2021, 09:51 AM.

    Comment


      #3
      Hello Amedeus,

      I'm not certain that I am understanding.

      You are saying you cannot select a drawing object after it has been drawn by a script?

      Are you asking how to use AddLine() or AddPlot()?
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Hi Chelsea, thank you for you reply,

        I think i might know why you do not understand and it is because the solution was too simple and the objective unnecessary.

        I want to know when the Macd reaches a specific distance from the ZL,
        Until this thread, to do that i placed a tagged Horizontal Line that could be found from the alert conditions to be crossed. But this cannot be done with a strategy because drawing objects in the conditions are not available. This lack is probably due to the fact that there is no already existing chart with tagged drawings on it at the very time of building a strategy... unlike with an alert.
        So, the question was about finding the best way to have something similar to the tagged Lines wich could be found from the conditions section in the strategy builder, and assume the role of trigger.

        Could you confirm that to have the exact same result as the lines from my example, we can just type our distance number under the /numeric value option from the alerts, and under /misc/numeric value from strategy builder.
        If yes i think we solved a non existing problem in the first place.

        Comment


          #5
          Actually, in the alerts, the macd can not cross below/above a numeric value, it can instead be lower some bars ago and greater now, if we want a horizontal level upward crossing behavior trigger like in the example.
          Yet this gives us less flexibility than a CrossAbove due to the BarsAgo estimation : if there is a double cross of +1 horizontal within the last 3 bars, then a "Greater4Ago" condition will not see it, while a "Cross4LookBack" condition will.

          assuming that like in the alerts, the cross condition in the strategy builder does not apply to a numeric value (from the /misc folder), the initial question remains :
          how to be able to apply a cross condition to a permanent horizontal value in the builder ?

          Comment


            #6
            Hello Amedeus,

            This is correct, the Strategy Builder cannot use manually drawn lines. This would require unlocking the script and coding by hand.
            https://ninjatrader.com/support/help...rawobjects.htm

            A double User input would allow for a price to be manually typed. Or an int User input could allow the user to input a number of ticks for use as a offset.

            Below is a link to a forum post with helpful information about getting started with NinjaScript. Please watch the Strategy Builder 301 training video.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              The int or double in the User input (depending on decimals) works with crosses. Thank you Chelsea.
              I did see the 301 tuto but did not really have a clue about what to make of the input and variables window.
              thanks also for the documentation, will dig.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by cre8able, Today, 03:20 PM
              0 responses
              5 views
              0 likes
              Last Post cre8able  
              Started by Fran888, 02-16-2024, 10:48 AM
              3 responses
              47 views
              0 likes
              Last Post Sam2515
              by Sam2515
               
              Started by martin70, 03-24-2023, 04:58 AM
              15 responses
              114 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by The_Sec, Today, 02:29 PM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by jeronymite, 04-12-2024, 04:26 PM
              2 responses
              31 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Working...
              X