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 proptrade13, Today, 11:06 AM
      0 responses
      2 views
      0 likes
      Last Post proptrade13  
      Started by kulwinder73, Today, 10:31 AM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by RookieTrader, Today, 09:37 AM
      3 responses
      15 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by terofs, Yesterday, 04:18 PM
      1 response
      24 views
      0 likes
      Last Post terofs
      by terofs
       
      Started by CommonWhale, Today, 09:55 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Erick  
      Working...
      X