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 geddyisodin, Yesterday, 05:20 AM
    8 responses
    49 views
    0 likes
    Last Post geddyisodin  
    Started by DayTradingDEMON, Today, 09:28 AM
    3 responses
    19 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by Stanfillirenfro, Today, 07:23 AM
    9 responses
    23 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by George21, Today, 10:07 AM
    0 responses
    8 views
    0 likes
    Last Post George21  
    Started by navyguy06, Today, 09:28 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X