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

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 knighty6508, 05-10-2024, 01:20 AM
    4 responses
    26 views
    0 likes
    Last Post knighty6508  
    Started by OllieFeraher, 05-09-2024, 11:14 AM
    6 responses
    19 views
    0 likes
    Last Post OllieFeraher  
    Started by PaulMohn, 05-02-2024, 06:59 PM
    2 responses
    44 views
    0 likes
    Last Post PaulMohn  
    Started by ETFVoyageur, Today, 02:10 AM
    0 responses
    17 views
    0 likes
    Last Post ETFVoyageur  
    Started by rayyyu12, Today, 12:47 AM
    0 responses
    12 views
    0 likes
    Last Post rayyyu12  
    Working...
    X