• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

i am trying to identify a green Heikin ashi

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

    i am trying to identify a green Heikin ashi

    hi im new to coding on C#
    i am trying to identify a green Heikin ashi candle stick in my strategy but a error keeps showing up whenever i try to compile, here is the code , how do i fix it ? i dont know what is wrong

    basically if close > open then draw dot

    protected override void OnBarUpdate()
    {
    // Condition set 1
    if ((Open[0] + High[0] + Low[0] + Close[0]) / 4) > ((Open[1] + Close[1]) / 2 );

    {
    DrawDot("My dot" + CurrentBar, false, 0, Low[0] + -10 * TickSize, Color.Blue);
    }
    }

    #2
    Originally posted by maaz1598 View Post
    hi im new to coding on C#
    i am trying to identify a green Heikin ashi candle stick in my strategy but a error keeps showing up whenever i try to compile, here is the code , how do i fix it ? i dont know what is wrong

    basically if close > open then draw dot

    protected override void OnBarUpdate()
    {
    // Condition set 1
    if ((Open[0] + High[0] + Low[0] + Close[0]) / 4) > ((Open[1] + Close[1]) / 2 );

    {
    DrawDot("My dot" + CurrentBar, false, 0, Low[0] + -10 * TickSize, Color.Blue);
    }
    }
    What is the text of the error?

    Comment


      #3
      Hello maaz1598,


      I notice that your code needed an open parenthesis a the beginning of your condition and a closing parenthesis at the end of your condition. I have included the corrected code below.


      Code:
      if (((Open[0 ] + High[0] + Low[ 0] + Close[ 0]) / 4) > ((Open[ 1] + Close[1]) / 2 ));
      {
      DrawDot( "My dot" + CurrentBar, false , 0 , Low[0] + -10 * TickSize, Color.Blue);
      }
      Shawn B.NinjaTrader Customer Service

      Comment


        #4
        it writes (invalid expression "]") x2 and (syntax error "] expected")

        even after i adjusted code (shawnB)

        if (((Open[0] + High[0] + Low[0] + Close[0]) / 4) > ((Open[1] + Close[1]) / 2 ));

        Comment


          #5
          Originally posted by maaz1598 View Post
          it writes (invalid expression "]") x2 and (syntax error "] expected")

          even after i adjusted code (shawnB)

          if (((Open[0] + High[0] + Low[0] + Close[0]) / 4) > ((Open[1] + Close[1]) / 2 ));
          oww never mind, my bad, i used "[" instead of "}"

          Comment


            #6
            Originally posted by maaz1598 View Post
            oww never mind, my bad, i used "[" instead of "}"
            nope spoke to soon that wasn't the issue

            Comment


              #7
              Hello maaz1598,

              Could you please reply with your script attached, so that I may investigate this behavior further?

              You can attach your strategy to your response by going to File > Utilities > Export NinjaScript > Export selected source files > select your strategy > select the right arrow > Export. The file will be located under (My) Documents\NinjaTrader 7\bin\Custom\ExportNinjaScript.

              You could post the script to your forum reply, or send an email to platformsupport [at] ninjatrader [dot] com with the script as an attachment. In the email please include a link to this forum thread.
              Shawn B.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by maaz1598 View Post
                nope spoke to soon that wasn't the issue
                Same error? Or something else?

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by rouillard, Today, 03:34 PM
                2 responses
                22 views
                0 likes
                Last Post rouillard  
                Started by mquinteroj, Today, 02:41 PM
                1 response
                10 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by JPPoulin, Today, 01:32 PM
                4 responses
                15 views
                0 likes
                Last Post JPPoulin  
                Started by bltdavid, Today, 01:09 PM
                1 response
                11 views
                0 likes
                Last Post NinjaTrader_Kate  
                Started by pstrusi, Today, 12:50 PM
                2 responses
                8 views
                0 likes
                Last Post pstrusi
                by pstrusi
                 
                Working...
                X