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 Shansen, 08-30-2019, 10:18 PM
      24 responses
      938 views
      0 likes
      Last Post spwizard  
      Started by Max238, Today, 01:28 AM
      0 responses
      3 views
      0 likes
      Last Post Max238
      by Max238
       
      Started by rocketman7, Today, 01:00 AM
      0 responses
      2 views
      0 likes
      Last Post rocketman7  
      Started by wzgy0920, 04-20-2024, 06:09 PM
      2 responses
      27 views
      0 likes
      Last Post wzgy0920  
      Started by wzgy0920, 02-22-2024, 01:11 AM
      5 responses
      32 views
      0 likes
      Last Post wzgy0920  
      Working...
      X