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

divided

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

    divided

    Hello,

    can someone help me how can i write divided e.g.:

    Plot0.Set(Open[0] > Close[0] ? (Close[0])/ATR(1) : (Open[0])/ATR(1));

    but this symbol "/" cant be used. What i have to use instead of this?

    thank u

    kamil

    #2
    Hello kamil,

    You likely need to use brackets for your ATR to get a double value.

    Plot0.Set(Open[0] > Close[0] ? (Close[0])/ATR(1)[0] : (Open[0])/ATR(1)[0]);
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      the problem is this symbol - e.g.:

      Plot0.Set(Open[0] > Close[0] ? (Open[0] - Close[0]) / (High[0] > Close [1]) * 100 : (Close[0] - Open[0]) / (High[0] > Close [1]) * 100);

      it writes error message: Operator / cant be used for double and bool. operands. (translated from czech)

      Comment


        #4
        "/" this symbol is wrong :-( i used it as divided

        Comment


          #5
          NT tells me, the problem is code: CS0019, but i dont understand to it :-( Can u help?

          Comment


            #6
            The first snippet you posted can be corrected by using the code from my first reply.

            The next snippet you posted doesn't fit logically. The values you're specifying are bool statements but they should be doubles for plots.


            Plot0.Set(Open[0] > Close[0] ? (Open[0] - Close[0]) / (High[0] > Close [1]) * 100 : (Close[0] - Open[0]) / (High[0] > Close [1]) * 100);
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              My stupid. 1st works and 2nd was changed and works too.

              Thank you for your time.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Balage0922, Today, 07:38 AM
              0 responses
              1 view
              0 likes
              Last Post Balage0922  
              Started by JoMoon2024, Today, 06:56 AM
              0 responses
              6 views
              0 likes
              Last Post JoMoon2024  
              Started by Haiasi, 04-25-2024, 06:53 PM
              2 responses
              19 views
              0 likes
              Last Post Massinisa  
              Started by Creamers, Today, 05:32 AM
              0 responses
              6 views
              0 likes
              Last Post Creamers  
              Started by Segwin, 05-07-2018, 02:15 PM
              12 responses
              1,786 views
              0 likes
              Last Post Leafcutter  
              Working...
              X