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 yertle, Today, 08:38 AM
          5 responses
          13 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by frankthearm, Today, 09:08 AM
          2 responses
          4 views
          0 likes
          Last Post frankthearm  
          Started by adeelshahzad, Today, 03:54 AM
          3 responses
          16 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by bill2023, Yesterday, 08:51 AM
          6 responses
          27 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by NinjaTrader_ChelseaB, 01-08-2017, 06:59 PM
          80 responses
          19,667 views
          5 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X