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.

    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().
            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 NullPointStrategies, Today, 05:17 AM
                    0 responses
                    44 views
                    0 likes
                    Last Post NullPointStrategies  
                    Started by argusthome, 03-08-2026, 10:06 AM
                    0 responses
                    124 views
                    0 likes
                    Last Post argusthome  
                    Started by NabilKhattabi, 03-06-2026, 11:18 AM
                    0 responses
                    65 views
                    0 likes
                    Last Post NabilKhattabi  
                    Started by Deep42, 03-06-2026, 12:28 AM
                    0 responses
                    42 views
                    0 likes
                    Last Post Deep42
                    by Deep42
                     
                    Started by TheRealMorford, 03-05-2026, 06:15 PM
                    0 responses
                    46 views
                    0 likes
                    Last Post TheRealMorford  
                    Working...
                    X