• 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

Programming Ques on multi timeframes

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

    #16
    Originally posted by dukeb View Post
    I guess I do not understand. The highlighted data in my previous post compared with the stoch on the graph that was attached do not match. A diamond on the 20min chart was also place at this time. The stoch was > 25 which would mean it should not have been allowed through the if stmt.
    What am I not understanding? How can the code be correct?
    Regards,
    Duke
    The code is NOT correct.

    When BIP=1, both statements return 16.xxxx and therefore this true.

    Code:
    if ((Stochastics(3, 5, 2).K[0] < 25) && (Stochastics(BarsArray[1],3, 5,2).K[0] < 25 ))
    1 of 2 things will fix it:

    Code:
    if ((Stochastics(BarsArray[0],3, 5, 2).K[0] < 25) && (Stochastics(BarsArray[1],3, 5,2).K[0] < 25 ))



    OR

    Code:
    protectedoverridevoid OnBarUpdate()
    {
    if (CurrentBars[0] <= BarsRequired || CurrentBars[1] <= BarsRequired)
    return;
    if (BarsInProgress==1)
    return;
    

    Comment


      #17
      Hi Sledge,
      The reason we want index=0 in this case is because every third bar = an hour bar. At that time we evaluate. Is this correct? If so, then there is no current hour bar to evaluate before the 3 previous 20 min bars. Correct? An hour bar is only passed on the close. If there is no close, nothing is passed to the if statement for evaluation. Correct?
      Duke

      Comment


        #18
        Originally posted by dukeb View Post
        Hi Sledge,
        The reason we want index=0 in this case is because every third bar = an hour bar. At that time we evaluate. Is this correct? If so, then there is no current hour bar to evaluate before the 3 previous 20 min bars. Correct? An hour bar is only passed on the close. If there is no close, nothing is passed to the if statement for evaluation. Correct?
        Duke
        You do get both calls because your every 3rd bar is the 60 min. (BIP==0 and BIP==1).

        In this case, you really don't need any action on the 60 minute bar, which is causing all your confusion.

        I'm not sure in what case there would be no close on a 60 minute bar.

        Comment


          #19
          I guess what I am trying to say is that since I am checking on the close of a bar an hourly bar closes on the close of a 3rd 20 min bar. That being said, there would be no hourly bar that would be closing for the 1st 2 20 min bars. By checking bip==0 we would always be sure to catch the 20 min bar on index=0 and the 60min bar on index=1.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by gemini42, Yesterday, 09:44 PM
          1 response
          18 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by BobyGill, Today, 03:48 PM
          0 responses
          1 view
          0 likes
          Last Post BobyGill  
          Started by martyn73, Today, 02:29 PM
          0 responses
          9 views
          0 likes
          Last Post martyn73  
          Started by cls71, Today, 12:28 PM
          0 responses
          8 views
          0 likes
          Last Post cls71
          by cls71
           
          Started by NeverDownMoney, Today, 12:19 PM
          0 responses
          4 views
          0 likes
          Last Post NeverDownMoney  
          Working...
          X