Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Another counting problem

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

    Another counting problem

    Hi, Need some guidance here.

    Initially I, with some help, coded a count which would count 9 consecutive counts, each close being lower than the close 4 bars earlier.

    Having got that done, I need to initiate a second count, which is dependent on the first count being completed. This second count, upon commencement counts everytime the current close is less than or equal to the low two bars earlier and need not be consecutive.

    Hence, to initiate the second count, I tried this:-

    If (buysetupcount ==9)
    {
    if (Close[0] <= Low[2])
    {
    BuyCountdown++;
    DrawText(...)
    }
    }

    In this case, BuyCountdown only counts when both "if" conditions are true. How can I get it to independently run the second "if " condition but only after the first condition is complete? Having some trouble with that. Please help.

    #2
    Kay, you would then need to set a bool flag upon your first set of conditions true, then you can add a check for the flag and your second if in another statement to continue.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Bertrand, I'm sorry I do not understand what you are trying to say. I'm not sure what you mean by "add a check for the flag and your second if in another statement to continue."

      For example, how do I add a check for the flag? What is a flag?

      I've attached the code. The relevant methods are:-
      1) ProcessBuySetup
      2) TDBuySetupDrawText
      3) RemoveBuySetup
      4) ProcessBuySequential
      5) TDBuySeqDrawText

      Would you mind taking a look? The methods are usually no more than 6 lines of code.
      Attached Files
      Last edited by kaywai; 03-02-2010, 07:11 AM.

      Comment


        #4
        Kay, unfortunately we don't have the bandwidth here to get into custom coding, it might be best to approach a consultant for you -

        http://www.ninjatrader.com/webnew/pa...injaScript.htm

        A flag would be simply a true / false switch -

        if (Condition1)
        myflag = true;

        Then you can check this off in another condition of yours -

        if (myFlag && Condition2)
        myDateSeries.Set(myValue);

        Of course you needed to reset the flag, too -

        if (Condition3)
        myFlag = false;
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thanks Bertrand! That is all I need to know. Just wasn't sure what you meant.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by pilotfo, Today, 12:50 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by DTSSTS, Today, 11:35 AM
          2 responses
          10 views
          0 likes
          Last Post DTSSTS
          by DTSSTS
           
          Started by sinpeople, Today, 07:20 AM
          2 responses
          6 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by Frank1000, Today, 03:05 AM
          5 responses
          16 views
          0 likes
          Last Post Frank1000  
          Started by fscabrera03, Yesterday, 01:18 PM
          2 responses
          25 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X