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

Ichimoku Cloud

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

    Ichimoku Cloud

    Hi,

    I'm trying to code with the ichomoky cloud. However, I can't seem to find the right command to call the condition that price is above the positive cloud. Since you can only change the parameters for the Kijunsen en the TenkanSen, I don't know how to code it.

    I'm trying to code a positive barclose breaking throught the positive cloud.

    Please help me.

    #2
    Hello Robert87,

    Which specific script are you working with?

    For example:
    Print(IchimokuCloud(9, 26, 52).ChikouSpan[0]);
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      I'm using the indicator from this site(only 1 moku).
      I'm trying to code a price breakout above the cloud.
      I found out that the cloud is formed by the A span and the B span.
      I also found out that since it plots 26 bars into the future, I somehow have to code that in.

      I tried the following code to see where it plots(it might not be the exact code since I'm at work):

      if(IchimokuCloud(9,26,52)._SenkouSpanA[1] > IchimokuCloud(9,26,52)._SenkouSpanB[0] && IchimokuCloud(9,26,52)._SenkouSpanA[0] < IchimokuCloud(9,26,52)._SenkouSpanB[0])
      {
      EnterLong();
      }

      But this that does plot at the time I want(when the price actually crosses the cloud).

      So I've tried:

      if(Close[1] < (IchimokuCloud(9,26,52)._SenkouSpanA[27] && Close[0] > (IchimokuCloud(9,26,52)._SenkouSpanA[26]) But this does not work.

      So I tried:

      if(Close[1] < (IchimokuCloud(9,26,52)._SenkouSpanA[1] && Close[0] > (IchimokuCloud(9,26,52)._SenkouSpanA[0]) But this plots at the wrong time again.

      I hope you understand my dilemma.

      Comment


        #4
        Hello Robert87,

        Using Displacement on a chart to move a plot forward would be the same as using a bars ago value for the plot in code.

        Use prints to find why the conditions are not evaluating as true.

        For example:
        Print(string.Format("{0} | Close[1]: {1} < (IchimokuCloud(9,26,52)._SenkouSpanA[1]: {2} && Close[0]: {3} > (IchimokuCloud(9,26,52)._SenkouSpanA[0]: {4})", Time[0], Close[1], IchimokuCloud(9,26,52)._SenkouSpanA[1], Close[0], IchimokuCloud(9,26,52)._SenkouSpanA[0]));

        As a heads up, with the parenthesis you have suggested, I would not expect that code to compile. I was not able to make a print for that exact code.

        For a CrossAbove/CrossBelow there are methods for these.

        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          This one doens't work:

          if(CrossAbove(IchimokuCloud(9,26,52).TenkanSen, IchimokuCloud(9,26,52).KijunSen))

          Comment


            #6
            Hello Robert87,

            Make a print for any condition that you would like to understand the behavior of.

            Below is a link to a forum post that demonstrates using prints to understand behavior.


            As a heads up, the code you have suggested will not compile. There is no look back period which is required for CrossAbove().

            Further, this would not trigger when the price is crossing a plot, if this had been coded properly it would trigger when the TenkanSen and KijunSen plots cross each other.

            Try making a print for this. Print the Time[0], print IchimokuCloud(9,26,52).TenkanSen[1], print IchimokuCloud(9,26,52).KijunSen[1], print IchimokuCloud(9,26,52).TenkanSen[0] and print IchimokuCloud(9,26,52).KijunSen[0].

            Then include the output and the time where you are expecting the cross to have occurred. We will be able to tell from the print if the condition would evaluate as true or false.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by Robert87 View Post
              This one doens't work:

              if(CrossAbove(IchimokuCloud(9,26,52).TenkanSen, IchimokuCloud(9,26,52).KijunSen))
              What is the error returned by the statement?

              The syntax looks incorrect.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by itrader46, Today, 09:04 AM
              0 responses
              2 views
              0 likes
              Last Post itrader46  
              Started by timmbbo, Today, 08:59 AM
              0 responses
              1 view
              0 likes
              Last Post timmbbo
              by timmbbo
               
              Started by bmartz, 03-12-2024, 06:12 AM
              5 responses
              33 views
              0 likes
              Last Post NinjaTrader_Zachary  
              Started by Aviram Y, Today, 05:29 AM
              4 responses
              14 views
              0 likes
              Last Post Aviram Y  
              Started by algospoke, 04-17-2024, 06:40 PM
              3 responses
              28 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Working...
              X