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

Trigger action when equal to indicator

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

    Trigger action when equal to indicator

    Hi, I have an alert which submits an action when 2 conditions are met, one condition with cross below or above (which works fine) and has a look back period of 5… the problem is with the second condition where I want for the ticker symbol to equal an indicator so that then the alert/action could be submitted.

    In the second condition, the properties of the indicator side has for bars ago and offset = 0, and in the data series (ticker symbol) also bars ago 0… now here the real issue I don’t manage to get over is the price type, I already tried with High, Low and Typical but still the condition is never met/triggered even placed a 9 ticks offset but still never manages to trigger where I want to do so…

    All I’m looking for is that when the first condition happens (which has a 5 look back period), then during that time period when the ticker symbol equals/touches an indicator value for the alert/actions to be submitted.

    Why is this not working or what am I missing here? This should be a simple task.

    #2
    Hello Prizax,

    Thanks for your post.

    It seems that you are wanting to check if the current price of an instrument is equal to an indicator value.

    This could be accomplished by creating a condition that compares the current Close price (Close[0]) to an indicator value.

    See the attached screenshot that demonstrates what this might look like by comparing if the Close[0] price is equal to the SMA indicator in the Strategy Builder. You could set up conditions in the Strategy Builder and click the 'View code' button to see the generated syntax.

    Note that for the script should be run with Calculate mode On Price Change so that logic can process intrabar.

    Calculate: https://ninjatrader.com/support/help.../calculate.htm

    Ultimately, if a script is not behaving as expected then you would need to debug the script by adding prints to understand how the script is behaving and evaluating logic.

    ​Below is a link to a forum post that demonstrates how to use prints to understand behavior.

    https://ninjatrader.com/support/foru...121#post791121

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

    Comment


      #3
      Ok ty for the info! also how can I make it for a condition with some indiccators to be my stop strategy ??

      Comment


        #4
        Hello Prizax,

        Thanks for your note.

        To clarify, are you wanting to create conditions for placing a stop loss in your strategy?

        If so, you must use Exit methods, such as ExitLongStopMarket, in the Conditions and Actions screen of the Strategy Builder. Conditions cannot be used for Set methods seen in the Stops and Targets screen of the Strategy Builder.

        See the attached example script demonstrating how Exit methods could be used to place stop loss and profit target orders in a Strategy Builder strategy.

        And, 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

        Let me know if I may assist further.
        Attached Files
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by gentlebenthebear, Today, 01:30 AM
        2 responses
        13 views
        0 likes
        Last Post gentlebenthebear  
        Started by Kaledus, Today, 01:29 PM
        2 responses
        8 views
        0 likes
        Last Post Kaledus
        by Kaledus
         
        Started by frankthearm, Yesterday, 09:08 AM
        13 responses
        46 views
        0 likes
        Last Post frankthearm  
        Started by PaulMohn, Today, 12:36 PM
        2 responses
        16 views
        0 likes
        Last Post PaulMohn  
        Started by Conceptzx, 10-11-2022, 06:38 AM
        2 responses
        56 views
        0 likes
        Last Post PhillT
        by PhillT
         
        Working...
        X