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 mballagan, Today, 01:02 PM
          0 responses
          3 views
          0 likes
          Last Post mballagan  
          Started by larkmail, Today, 12:30 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Kate  
          Started by omermirza, Today, 12:39 PM
          0 responses
          9 views
          0 likes
          Last Post omermirza  
          Started by Danila, Today, 11:08 AM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by dbida001, Today, 10:31 AM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_ChristopherJ  
          Working...
          X