Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Breakout Breakdown

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

    Breakout Breakdown

    I'm trying to create a SIMPLE breakout strategy. I've told it to buy at crossabove, but it buys at equals.

    I have numerous examples. One is attached. Is there something I'm missing about this?

    I have set calculate on bar close to false

    Here's the code:

    protected override void OnBarUpdate()
    {

    {
    // Condition set 1
    if (CrossAbove(Close, Swing(SwingPower).SwingHigh, 1))
    {
    EnterLongLimit(GetCurrentAsk());
    }

    // Condition set 2
    if (CrossBelow(Close, Swing(SwingPower).SwingLow, 1))
    {
    EnterShortLimit(GetCurrentBid());
    }
    }

    }
    Attached Files
    Last edited by goldfly; 07-26-2012, 02:46 PM.

    #2
    Hello goldfly,

    The Swing indicator can have their plot points recalculated as incoming data is updated, thus making it challenging to use in a strategy via programmatic calls. They are first and foremost mean to be used as visual trading tools

    With that said you can still use the indicators for your calculations but would need to understand what price points can be accessed at which time programmatically, since those can be different from the historically plotted ones.

    Also using CrossAbove, and CrossBelow will return false if both values are equal. It will true only once the values go above/below one another respectively.

    How are you checking the values to see that it is only true when they are equal?

    A helpful feature to be able to check and see how your code is being processed is the Print() statement. See the following forum post for more information.
    http://www.ninjatrader.com/support/f...ead.php?t=3418

    TraceOrders is another helpful feature that will be able to see the behavior of your orders.
    http://www.ninjatrader.com/support/f...ead.php?t=3627

    Please let me know if I can be of further assistance.
    JCNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    630 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    364 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    566 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X