Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy: trade with manually drawn trendlines

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

    Strategy: trade with manually drawn trendlines

    Hello,

    I manually draw a trend line on a chart and tag it with "LineUptrend".

    Now I would like to set up a strategy that only takes long trades, as long as the graph is above "LineUptrend". Once the graph crosses "LineUptrend", the strategy should not take trades anymore. There will be more criterias to specify the trade entries, but this is the part I'm struggling with. Is it possible to set this up with strategy builder?

    Further: Would it be possible to adjust this line manually, while the strategy is running?

    Please also see the attached image.

    Thanks a lot in advance for help!

    #2
    Hello mo_fi,

    Yes, you can loop through the DrawObjects collection, and project intercepts along the y-axis.
    https://ninjatrader.com/support/help...rawobjects.htm
    https://ninjatrader.com/support/foru...663#post828663
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Dear Chelsea, thank you for your reply. This looks quite complex.
      I have another idea: I noticed that I can create an alert for the LineUptrend line. So the alert would be: "if graph crosses below LineUptrend then show a pop-up message." This works.
      Is it possible to use this alert as a condition in the strategy builder? Or is there a way in ninjascript to use the alert as a condition / trigger?

      Comment


        #4
        Hello mo_fi,

        A drawing object would not be selectable in the Strategy Builder. An alert cannot be selected in the Strategy Builder. This would require unlocking the script and coding by hand.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thank you Chelsea,
          How would I call this specific alert ("Line 50 Alert") in Ninjascript, so I can use it as a condition?

          Comment


            #6
            Hello mo_fi,

            if (/* condition here */)
            {
            Alert("Line 50 Alert");
            }

            Below is a link to the help guide on Alert().
            https://ninjatrader.com/support/help.../nt8/alert.htm
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hello Chelsea,
              Thank you, but I would like to have it the other way round. The Alert should be the condition, not the resulting action.
              So the logic should look something like this:

              if (Alert("Line 50 Alert"))
              {
              do the following: --> action
              }

              Is this possible?

              Comment


                #8
                Hello mo_fi,

                An alert is an action. This is a message appearing in the Alerts window. This cannot be used in a condition. Just like an order cannot be used in a condition as submitting an order is also an action.

                The condition should be the criteria that triggers the alert. Like the price crossing a plot line or something.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Hello Chelsea,
                  thank you for clarification and for your help. I must have misunderstood you at post #4, now it's clear.
                  Would it be possible to only call the "condition" part of the alert in ninjascript?

                  What I mean is:

                  Line Alert 50 has a condition and an action as follows:
                  condition = MES crosses below LineUptrend
                  action = Show Pop up

                  Can I reference this condition (MES cross below LineUptrend) in ninjascript and use it for some other action?

                  Please also see the screenshot.

                  Comment


                    #10
                    Hello mo_fi,

                    No, Alerts in the Alerts window cannot be used in a strategy, as mentioned in post #4.

                    The Strategy Builder cannot use drawn objects, but you can unlock the script and code logic for crossing a manually drawn line.

                    An example of this post posted in post #2.
                    Chelsea B.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by rayko, Today, 03:12 AM
                    0 responses
                    2 views
                    0 likes
                    Last Post rayko
                    by rayko
                     
                    Started by [email protected], Yesterday, 06:03 PM
                    1 response
                    5 views
                    0 likes
                    Last Post NinjaTrader_Marco  
                    Started by thanajo, Today, 03:00 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post thanajo
                    by thanajo
                     
                    Started by Emma1, Yesterday, 07:15 PM
                    1 response
                    7 views
                    0 likes
                    Last Post MicroTrends  
                    Started by elliot5, Today, 12:45 AM
                    3 responses
                    9 views
                    0 likes
                    Last Post elliot5
                    by elliot5
                     
                    Working...
                    X