Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

lower granularity

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

    lower granularity

    hi,

    i want to generate signal in primary bar and execute trade logic in secondary bar, example:

    if(Close[0]>Close[1] && BarsInProgress==0) // trade signal (daily price)
    {
    tradeSignal=true;
    }

    if(tradeSignal==true && BarsInProgress==1) // conditional order-entry next day based on intraday data
    {
    double stopOrder=High[0]+.01; // i'm trying to use the prvious days high
    EnterLongStop(1,true,1,stopOrder,"Get long");
    }

    so, i'm trying to generate my signals on daily data and submit the order the following day using intraday data. what am i doing wrong here? when i run this in strategy analyzer nothing happens.
    Last edited by d.allen101; 07-01-2009, 08:31 AM.

    #2
    Hi d.allen, thank you for your question.

    To get a better idea of what is happening to your orders, you can use TraceOrders = true; in the initialize section of your strategy.

    In addition, an easy way to get the prior day's high would be to use the PriorDayOHLC indicator. In your instance, calling High[0] while BarsInProgress == 1 would give you the high for the current 5 minute bar, not the previous day's high.

    You've probably already seen this, but here is our sample for backtesting with an intrabar granularity.
    AustinNinjaTrader Customer Service

    Comment


      #3
      thanks austin,

      here the exact test code i'm running:

      if(Close[0]>High[1] && Close[0]>EMA(20)[0]&& BarsInProgress==0)
      {
      tradeSignal=true;
      }

      if(tradeSignal==true && BarsInProgress==1)
      {
      double stopOrder=PriorDayOHLC().PriorHigh[0]+.10;
      EnterLongStop(1,true,1,stopOrder,"long");
      }

      if(Close[0]<Low[1] && BarsInProgress==0)
      {
      ExitLong();
      tradeSignal=false;
      }

      i gave tradeSignal global scope so it would maintain it's value. ok...all i'm trying to do is use the daily data to generate a signal and the very next day submit my order to be executed if the intraday price trades above the signal days high...

      Comment


        #4
        d.allen, if we can figure out what your strategy is doing, we can advise you on how to adjust it. What exactly is happening with your EnterLongStop orders?

        If you have TraceOrders = true, you can view what is happening to your orders in the output window (Tools -> Output Window).
        AustinNinjaTrader Customer Service

        Comment


          #5
          hey austin i apologize...my logic was ALL screwed up! and i'm not just talking about the coding logic! i'm new to trading (3 wks) and a lot of the order entry concepts i still don't understand. but anyway, i figured out how to do what i need.

          thanks for your time and effort!

          Comment


            #6
            No worries, d.allen. Glad to hear you're on your way!
            AustinNinjaTrader Customer Service

            Comment


              #7
              Hi,

              Once again, I'm having trouble comprehending granularity and Ninja's trade logic. Here's what I'm trying to do:

              1) If today's daily close is greater than yesterday's daily high a signal is generated.
              2) Submit a market order if intraday price trades above the signal bar's daily high.
              3) If filled maintain position until the market closes (daily) lower than the previous daily bars low.
              4) If condition #3 is violated submit market order.

              Here the logic I've written which obviously doesn't work:

              if(Close[0]>High[1] && BarsInProgress==0)
              {
              tradeSignal=true;
              }

              if(tradeSignal==true && BarsInProgress==1)
              {
              if(Closes[1][0]>Highs[0][0]) // trying to compare intraday price to previous day's high
              EnterLong();
              }

              if(Close[0]<Low[1] && BarsInProgress==0 && Position.MarketPosition==MarketPosition.Long)
              {
              ExitLong();
              }
              Last edited by d.allen101; 07-02-2009, 06:34 AM.

              Comment


                #8
                d.allen, in your BarsInProgress==1 section, can you try changing Highs[0][0] to Highs[0][1]?
                AustinNinjaTrader Customer Service

                Comment


                  #9
                  I just tried changing Highs[0][0] to Highs[0][1] with no success. I also changed EnterLong() to EnterLong(1,100,"long") with no success. Do you understand what I'm trying to do? I want to enter the market the next day but only under certain conditions i.e. (tomorrow's intraday price > than yesterday's high):

                  if(tradeSignal==true && BarsInProgress==1)
                  {
                  if(Closes[1][0]>Highs[0][0]) // trying to compare intraday price to previous day's high (try Highs[0][1])
                  EnterLong(1,100,"long");
                  }

                  But this logic is wrong. I've read the Multi-Time Frame & Instruments section in the NT doc and I'm still not getting it. Can you give me a little assistance without actually doing it for me? I would like to figure it out myself I just need for you to point me in the right direction and point out what I'm doing wrong here...

                  Comment


                    #10
                    I will take a look into this and let you know.
                    AustinNinjaTrader Customer Service

                    Comment


                      #11
                      Hey Austin, I have a couple of questions 1) If my primary bar is daily prices and my secondary bar is 10 min prices when the OnBarUpdate() fires is the sequence: daily(1), 1st 10mins, second 10mins, third 10mins...etc, daily(2), 1st 10mins, second 10mins...2) Does EnterLong(1,100,"long") execute a market order at the BarsArray[1] next bar's (10 min) opening price once the OnBarUpdate fires for the bar (BarsInProgress=1)?
                      Last edited by d.allen101; 07-02-2009, 11:41 AM.

                      Comment


                        #12
                        d.allen, please take a look at the comments inside this reference sample. The comments (in the code) explain how the call order works.
                        AustinNinjaTrader Customer Service

                        Comment


                          #13
                          I've already seen it. I was just making sure I was clear on it.

                          Comment


                            #14
                            Then yes, your understanding is correct.
                            AustinNinjaTrader Customer Service

                            Comment


                              #15
                              to ninja traders josh and austin - thanks for not "holding my hand" and just simply giving me the solution to the issue i was having w/ granularity...i now have a complete understanding of Advance Order Handling, the IOrder interface, etc...so, once again thanks for forcing me not to be a lazy bum but to actually earn what i want like everyone else in the real world!

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              649 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              370 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              109 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              573 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              576 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X