Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trades Not Exiting

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

    Trades Not Exiting

    I have a strategy setup in SA, working properly. But I want to tweak the entry/exit criteria a little depending on if the stock is trending up or down. When my trend criteria is met, a bool variable (upTrend) is set to true.

    The code is working and my Entries are correctly triggered when my (upTrend) criteria is met.

    But, if I go long the trend and that trend ends while still in my trade, my strategy won't exit until the next upTrend starts and the exit criteria is met during the new trend.

    Conversely, if a trend starts while I'm in a position triggered by my normal trading criteria, the (upTrend) exit rule kicks in. How can I keep these two rule from overlapping?

    I know it's something simple but I can't think through it. Here is my trend code:

    //****Trading During Uptrend****
    if (upTrend)
    {

    if (DoubleStochastics(DD).K[0] > DoubleStochastics(DD).K[1])
    {
    EnterLong(DefaultQuantity, "Trend Up");
    }

    if (Momentum(Sell)[0] < Momentum(Sell)[1])
    {
    ExitLong("DownDay","Trend Up");
    }

    }

    #2
    Hello reticent67,
    To assist you further can you please send a toy NinjaScript code* replicating the behavior to support[AT]ninjatrader[DOT]com

    Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.

    I look forward to assisting you further.

    *The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.
    JoydeepNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Perr0Grande, Today, 08:16 PM
    0 responses
    2 views
    0 likes
    Last Post Perr0Grande  
    Started by elderan, Today, 08:03 PM
    0 responses
    5 views
    0 likes
    Last Post elderan
    by elderan
     
    Started by algospoke, Today, 06:40 PM
    0 responses
    10 views
    0 likes
    Last Post algospoke  
    Started by maybeimnotrader, Today, 05:46 PM
    0 responses
    11 views
    0 likes
    Last Post maybeimnotrader  
    Started by quantismo, Today, 05:13 PM
    0 responses
    7 views
    0 likes
    Last Post quantismo  
    Working...
    X