Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 -



        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 DJ888, Today, 10:57 PM
          0 responses
          1 view
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by MacDad, 02-25-2024, 11:48 PM
          7 responses
          158 views
          0 likes
          Last Post loganjarosz123  
          Started by Belfortbucks, Today, 09:29 PM
          0 responses
          7 views
          0 likes
          Last Post Belfortbucks  
          Started by zstheorist, Today, 07:52 PM
          0 responses
          7 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          151 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Working...
          X