Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

strange execution

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

    strange execution

    hi NinjaTrader

    I created a basic strategy using the wizard, then unlocked the code to make some tweaks. Now, when I run bactest all the trades get linked with each other (one trade begins where another ends) so visually they look like a curve in the strategy analizer/chart.

    Can you please advise where is this coming from/why that happens?




    Variables:
    Code:
    // Wizard generated variables
            private int lookBack = 20; // Default setting for LookBack
            private double profit_Target = 0.1; // Default setting for Profit_Target
            private double stop_Loss = 0.06; // Default setting for Stop_Loss
            // User defined variables (add any user defined variables below)
    Initialize:
    Code:
            protected override void Initialize()
            {
                SetProfitTarget("", CalculationMode.Percent, Profit_Target);
                SetStopLoss("", CalculationMode.Percent, Stop_Loss, false);
    
                CalculateOnBarClose = true;
            }
    Properties:
    Code:
            #region Properties
            [Description("")]
            [GridCategory("Parameters")]
            public int LookBack
            {
                get { return lookBack; }
                set { lookBack = Math.Max(20, value); }
            }
    
            [Description("")]
            [GridCategory("Parameters")]
            public double Profit_Target
            {
                get { return profit_Target; }
                set { profit_Target = Math.Max(0.00, value); }
            }
    
            [Description("")]
            [GridCategory("Parameters")]
            public double Stop_Loss
            {
                get { return stop_Loss; }
                set { stop_Loss = Math.Max(0.00, value); }
            }
            #endregion

    #2
    What does your OnBarUpdate look like? Do you reset the SetStopLoss when you're flat?

    Please see our reference on Monitoring stop and profit target orders for more information:

    MatthewNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Segwin, 05-07-2018, 02:15 PM
    14 responses
    1,789 views
    0 likes
    Last Post aligator  
    Started by Jimmyk, 01-26-2018, 05:19 AM
    6 responses
    837 views
    0 likes
    Last Post emuns
    by emuns
     
    Started by jxs_xrj, 01-12-2020, 09:49 AM
    6 responses
    3,293 views
    1 like
    Last Post jgualdronc  
    Started by Touch-Ups, Today, 10:36 AM
    0 responses
    13 views
    0 likes
    Last Post Touch-Ups  
    Started by geddyisodin, 04-25-2024, 05:20 AM
    11 responses
    63 views
    0 likes
    Last Post halgo_boulder  
    Working...
    X