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 tsantospinto, 04-12-2024, 07:04 PM
    7 responses
    126 views
    0 likes
    Last Post aligator  
    Started by futtrader, 04-21-2024, 01:50 AM
    5 responses
    56 views
    0 likes
    Last Post NinjaTrader_Eduardo  
    Started by PeakTry, Today, 10:49 AM
    0 responses
    2 views
    0 likes
    Last Post PeakTry
    by PeakTry
     
    Started by llanqui, Today, 10:32 AM
    0 responses
    5 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by StockTrader88, 03-06-2021, 08:58 AM
    45 responses
    3,994 views
    3 likes
    Last Post johntraderuser2  
    Working...
    X