Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi Time Frame Problems

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

    Multi Time Frame Problems

    I am using two time frames (daily and weekly). I'm trying to test out multi time frames and want to be able to place an order when the ADX(14) of the daily bar crosses above 17 AND the ADX(14) of the weekly bar is greater than 17.

    My primary bar data is daily and I've added
    Add(PeriodType.Week, 1); into the initialize() function area. I've also got an exit strategy set up just to get some readings.

    My script is this:

    protectedoverridevoid OnBarUpdate()
    {
    if (BarsInProgress == 0)
    {
    if (CrossAbove(ADX(BarsArray[0], 14), 17, 1)&& ADX(BarsArray[1], 14)[0] > 17)
    {
    EnterLong(
    1000, "Enter Order1");
    }
    }

    if (BarsInProgress == 0)
    {
    if (CrossBelow(ADX(BarsArray[0], 14), 17, 1))
    {
    ExitLong(
    "Exit Order1","");
    }
    }
    }

    But I still get orders made even when the ADX(14) of the weekly bar (BarsArray[1]) is less than 17.

    Can someone tell me where I'm going wrong.
    Last edited by pmn100; 08-27-2008, 04:21 PM.

    #2
    Have you checked your condition to make sure that it truly is less than 17? My bet is the code below would print values higher than 17.

    if (BarsInProgress == 0)
    {
    if (CrossAbove(ADX(BarsArray[
    0], 14), 17, 1)&& ADX(BarsArray[1], 14)[0] > 17)
    {
    Print(ADX(BarsArray[1], 14)[0]);

    EnterLong(
    1000, "Enter Order1");
    }
    }

    RayNinjaTrader Customer Service

    Comment


      #3
      Yes, you're right, all entries show ADX(14) for BarsArray[1] (the weeklies) to be over 17. But the weekly graph doesn't correspond.

      As an example, the first order is made on the 30/03/2005. At this point in time, the dailies show a cross above the 17 line on ADX (as expected). I then take a look at the weekly chart and the ADX for this period shows 13. The output window says the ADX for the weeklies is over 41, but the ADX doesn't even get above 25 for 6 months either side of 30/03/2005.

      So where is it reading 41 from? The only time the the ADX on the weeklies is above 40 is at the beginning of 2004 (and my backtest runs from 2005 onwards)?

      Comment


        #4
        I've just re-run the back test but this time selected the entire historic data I have (from 01/01/1988 for this instrument) instead of from 01/01/2005.

        This time round the order placed on 30/03/2005 doesn't exist, and there is no order in progress around this time. I've been through some of the results and they seem to correspond this time. Would not using the entire historic data cause the problems I was seeing? Its almost like it was reading daily data from one period in time and weekly data from another.

        Comment


          #5
          You need to print values not base things on how your orders are behaving. Debug with TraceOrders = true too. Print values of both your bar series and check your conditions for true. Run through the cases manually.
          Josh P.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by MatthewLesko, Today, 07:59 PM
          0 responses
          3 views
          0 likes
          Last Post MatthewLesko  
          Started by VolatyTrading, Today, 07:57 PM
          0 responses
          2 views
          0 likes
          Last Post VolatyTrading  
          Started by RookieKiwi, Today, 06:53 PM
          0 responses
          3 views
          0 likes
          Last Post RookieKiwi  
          Started by kazisl, Today, 05:52 PM
          0 responses
          5 views
          0 likes
          Last Post kazisl
          by kazisl
           
          Started by andrewjoseph939, Today, 02:39 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Jim  
          Working...
          X