• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Does not enter the trade

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

    Does not enter the trade

    Hey all,

    got a problem I have never had so far. I programmed a simple multitimeframe indicator and its plot is absolutely correct => takes on the value 1 when it should be. (see: screenshot attached) But when I try to backtest the strategy (this indicator == an indicator which only holds the value one => then entry /*which has always worked fine with any other strategy so far*/) it does not enter and I don't know why.

    Has it got something to do with the multiple timeframe concept? Any suggestion what I'm doing wrong?

    Being really grateful for your help,

    Andrew
    Attached Files

    #2
    What entry condition would you use here Andrew for the indicator? The plot hitting the value of 1 for going long?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by andrew-aut1 View Post
      Hey all,

      got a problem I have never had so far. I programmed a simple multitimeframe indicator and its plot is absolutely correct => takes on the value 1 when it should be. (see: screenshot attached) But when I try to backtest the strategy (this indicator == an indicator which only holds the value one => then entry /*which has always worked fine with any other strategy so far*/) it does not enter and I don't know why.

      Has it got something to do with the multiple timeframe concept? Any suggestion what I'm doing wrong?

      Being really grateful for your help,

      Andrew
      What is the error in your log?

      Comment


        #4
        entry condition: plot hitting the value of 1 for going long. Idea is that after a fall in at the first day succeeded by two rises of the two following days will give me the opportunity to get in the market = value 1: My code is as follows : PS: don't get confused: the script has been modified was a script for Keltner Channels in the beginning; thus I couldn't get rid off the variables period and offset Multiplier and they are not of interest.

        Many thx!



        public class UpandDowns : Indicator
        {
        #region Variables
        private int period = 10;
        private double offsetMultiplier = 1.5;
        private DataSeries diff;

        private int timeframe = 390;
        private DataSeries myDataSeries; // Define a DataSeries variable
        #endregion

        /// <summary>
        /// This method is used to configure the indicator and is called once before any bar data is loaded.
        /// </summary>
        protected override void Initialize()
        {
        Add(PeriodType.Minute, timeframe);
        //myDataSeries = new DataSeries(this, MaximumBarsLookBack.Infinite);

        Add(new Plot(Color.Blue, "Marker"));
        //Add(new Plot(Color.Red,PlotStyle.Dot, "Marker2"));
        diff = new DataSeries(this);

        Overlay = false;
        }

        /// <summary>
        /// Called on each bar update event (incoming tick).
        /// </summary>
        protected override void OnBarUpdate()
        {
        /* Only need to sync DataSeries objects once. We couldn't do this sync in the Initialize() method because we
        cannot access the BarsArray property there. */
        if (diff == null && BarsInProgress == 1)
        {
        /* Syncs another DataSeries object to the secondary bar object.
        We use an arbitrary indicator overloaded with an IDataSeries input to achieve the sync.
        The indicator can be any indicator. The DataSeries will be synced to whatever the
        BarsArray[] is provided.*/
        diff = new DataSeries(SMA(BarsArray[1], 50));
        }
        //checks we have enough bars to calculate
        if(CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired)
        return;
        double marker = 0;
        //double marker2 = 0;
        if (BarsInProgress == 0)
        {





        if (CurrentBar < 2)
        return;
        double Open12 = Opens[1][2];
        double Close12 = Closes[1][2];
        double Open11 = Opens[1][1];
        double Close11 = Closes[1][1];
        double Open10 = Opens[1][0];
        double Close10 = Closes[1][0];
        double Open00 = Opens[0][0];
        double Close00 = Closes[0][0];

        if (Open12 > Close12 && Open11 < Close11 && Open10 < Close10)
        {
        marker = marker + 1;
        }

        Marker.Set(marker);

        }


        if (BarsInProgress == 1)
        {
        if (CurrentBar < 2)
        return;


        }




        }

        Comment


          #5
          Thanks, I don't see an issue per se - with a simple test entry rule for market order like

          // Condition set 1
          if (UpandDowns()[0] >= 1)
          {
          EnterLong(DefaultQuantity, "");
          }

          ...I see it entering trades as expected.
          BertrandNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by EF Hutton, Today, 01:19 PM
          1 response
          3 views
          0 likes
          Last Post NinjaTrader_PatrickG  
          Started by Mykro, Today, 01:10 PM
          1 response
          2 views
          0 likes
          Last Post NinjaTrader_PatrickG  
          Started by Velhinho, Today, 12:30 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by EF Hutton, Today, 12:36 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Melissa  
          Started by TraderIqbal, Today, 11:17 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_PatrickG  
          Working...
          X