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

IsFalling problem.

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

    IsFalling problem.

    Sorry this should have been posted in the NT8 section.

    Hi, I have been trying to use "IsFalling" in an indicator code, and it just isn't working for me.
    I must be doing something wrong, but I just can't figure it out. I have tried it a couple of ways as follows:
    if (IsFalling(SMA(Typical,3))) && Close[0]>BP[0]);
    BarBrush = TransitionUp;

    if (IsFalling(BP)) && Close[0]>BP[0]);
    BarBrush = TransitionUp;

    if (BP[0]<BP[1] && Close[0]>BP[0]);
    BarBrush = TransitionUp;

    You should know, BP[0] = SMA(Typical, 3)[0];

    All 3 of these examples don't work.
    I have had trouble when trying to use IsRising / IsFalling in the past.
    Can you see what I have done wrong and how to correct it?

    Thanks,
    Ken.
    Last edited by KennyK; 09-07-2017, 11:54 PM. Reason: Forgot something

    #2
    Hello KennyK,

    Thanks for your post.

    The conditional statements look like they have a semi-colon ";" at the end which would prevent them from working as intended.

    I would advise coding in this manner to help clarify:

    if (Conditional statements)
    {
    action statements;
    }

    The "curley braces" { } would contain all of the actions to perform be they 1 or more action statements. If you only have 1 action statement the {} are not technically needed but they may help you develop a coding consistency. For example:

    if (IsFalling(SMA(Typical,3))) && Close[0]>BP[0])
    {
    BarBrush = TransitionUp;
    }
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Many Thanks

      Thanks Paul you bloody legend!
      That's got it sorted.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by jaybedreamin, Today, 05:56 PM
      0 responses
      3 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      18 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      1 view
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      9 views
      0 likes
      Last Post Javierw.ok  
      Started by timmbbo, Today, 08:59 AM
      2 responses
      10 views
      0 likes
      Last Post bltdavid  
      Working...
      X