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

check for divergence since a specific event as a condition to entering a trade

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

    check for divergence since a specific event as a condition to entering a trade

    Hi,

    I'm wondering if it is possible to essentially check for a divergence between the price and an indicator since a specific event (i.e., a change in price direction that started on the other side of a moving average and then cuts through that moving average and continues to run with no pullback) until the point that the strategy would have otherwise executed a trade but for identifying a divergence during that period.

    In effect, I'm trying to get the strategy to not execute a trade (a long for example) it would have otherwise executed if the bars (recently) changed direction (from short to long) on the other side of a moving average, then crossed up through the moving average with no pullbacks, and since that change in direction another indicator was essentially flat.

    I've tried using a variable (bool) that turns to true when the bars change direction on the other side of a moving average, and which stays true until any subsequent change in direction of the bars. My thought was that if a trade was otherwise going to be executed by the strategy, but the variable is true, and since turning true the other indicator has essentially remained flat, a condition will not be satisfied and the trade won't be executed. The problem I'm facing is I'm not sure how to have the other indicator's slope checked since the variable changed to true so that if the slope of that indicator is essentially flat since the variable changed a condition won't be satisfied and the trade won't be executed.

    Any help with this would be much appreciated.

    Thank you.


    #2
    Hello,

    Thanks for your post.

    You can use the Slope() method to check for the slope value. Please see the help guide here: https://ninjatrader.com/support/help...nt8/?slope.htm

    You can specify the number of bars to check the slope of and/or do multiple checks of various bars back to determine change in slope.

    In the Slope() you can specify a price series such as Close or use a moving average as the input to the slope.
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by judysamnt7, 03-13-2023, 09:11 AM
    4 responses
    53 views
    0 likes
    Last Post DynamicTest  
    Started by ScottWalsh, Today, 06:52 PM
    4 responses
    33 views
    0 likes
    Last Post ScottWalsh  
    Started by olisav57, Today, 07:39 PM
    0 responses
    5 views
    0 likes
    Last Post olisav57  
    Started by trilliantrader, Today, 03:01 PM
    2 responses
    19 views
    0 likes
    Last Post helpwanted  
    Started by cre8able, Today, 07:24 PM
    0 responses
    6 views
    0 likes
    Last Post cre8able  
    Working...
    X