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

using alerts in Strategy Builder

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

    using alerts in Strategy Builder

    Hello,

    Is it possible to call alerts that you have made into Strategy Builder?

    Or, is it possible in Strategy Builder to have a prebuilt strategy execute off a drawn line on chart?

    --------------------------------
    -the point is to be able to draw a ray on chart
    -if price touches ray, strategy builder script executes
    -strategy builder confirms if other parameters are correct like...
    -It should reset as soon as round trip on order is completed
    -it should not open a position if if there is open posiiton

    because of the needs I have, I can't simply execute a trade off the alert only

    #2
    Hello George21,

    Thanks for your post.

    Yes, it is possible to call an Alert action in the Actions section of the Strategy Builder. This will be a new alert you need to create in the Strategy Builder and you cannot select an alert made outside of the Strategy Builder. Also, note that Alerts in the Strategy Builder are only able to be used in the Actions section. You would not be able to use this alert for Conditions in your strategy.

    Yes, it is also possible to draw a line on the chart using the Strategy Builder. Note that you cannot detect manually drawn lines on the chart using the Strategy Builder. This would require you to unlock the strategy from the Strategy Builder window and manually code this yourself. See the attached sample that demonstrates detecting manually drawn objects on a chart.

    You could use a boolean in the logic of your strategy to control when trades are placed. You could create a bool named something like OkToTrade (initially set to false). You would create your order entry condition and set the bool to true. Then you would check if the bool is true and call your entry order method and set the bool to false.

    By doing this, the order entry method will only be called to place an order when the bool is true. When the bool is false, the order entry condition will not be called so the strategy will stop placing trades until the bool becomes true. See the attached example script demonstrating using a bool to control trades made by a strategy.

    If you would like the strategy to only place an order when you are in a flat position, you could include a Position.MarketPosition check in the order entry conditions of your strategy. For example, if you would like to place a long order when in a flat position, you could create a condition that checks if Position.MarketPosition == MarketPosition.Flat and call an action of EnterLong().

    See the help guide documentation below for more information.
    Conditions: https://ninjatrader.com/support/help...on_builder.htm
    Actions: https://ninjatrader.com/support/help...t8/actions.htm
    Alert: https://ninjatrader.com/support/help.../nt8/alert.htm
    DrawObjects Collection: https://ninjatrader.com/support/help...rawobjects.htm
    Position.MarketPosition: https://ninjatrader.com/support/help...etposition.htm


    Let us know if we may assist further.
    Attached Files
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the informative reply.

      I have a question about this part that you said...
      "Yes, it is also possible to draw a line on the chart using the Strategy Builder. Note that you cannot detect manually drawn lines on the chart using the Strategy Builder. This would require you to unlock the strategy from the Strategy Builder window and manually code this yourself. See the attached sample that demonstrates detecting manually drawn objects on a chart.".

      When you say unlock Strategy Builder, do you mean manually coding the strategy to look for input variables from the drawn ray because Strategy Builder can't do that?

      Comment


        #4
        Hello George21,

        Thanks for your note.

        That is correct. The Strategy Builder would be able to draw objects on a chart. However, a limitation of the Strategy Builder is that it cannot detect manually drawn objects on a chart, and drawing objects cannot be used for Conditions in the Strategy Builder.

        You would need to unlock the strategy from the Builder and manually program the strategy in a NinjaScript Editor window.

        Let us know if we may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by fx.practic, 10-15-2013, 12:53 AM
        5 responses
        5,406 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by Shai Samuel, 07-02-2022, 02:46 PM
        4 responses
        98 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by DJ888, Yesterday, 10:57 PM
        0 responses
        8 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by MacDad, 02-25-2024, 11:48 PM
        7 responses
        160 views
        0 likes
        Last Post loganjarosz123  
        Started by Belfortbucks, Yesterday, 09:29 PM
        0 responses
        9 views
        0 likes
        Last Post Belfortbucks  
        Working...
        X