Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

contruction of his own shooting star

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

    contruction of his own shooting star

    Hi, i'm pretty new on ninja and i already developp my strategy in .net on an other programming platform and i have to re start everything on ninja trader (because the other software doesn't offer a link with broker to trade)

    anyway,

    i would like the script to find the shooting star (my point of view)... but nothing is reconize on ninja...

    bool MyShooting = (open[bar]-close[bar])<0.31*(high[bar]-low[bar]) && (close[bar]-open[bar])<0.31*(high[bar]-low[bar])
    && (high[bar]-close[bar]>4*tick)&&(high[bar]-open[bar]>4*tick)
    &&close[bar]==low[bar] or close[bar]==low[bar]+1 tick) or open[bar]==low[bar] or open[bar]==low[bar]+1 tick

    and if there is a shooting star... i want to see it on a colors, like purple or with a arrow or anything else...

    the thing is that i don't know the script in the beginning... variable, protected override void, properties, define the tick in ninja script etc...

    please help me, on the previous software it was a little bit symply...
    thx

    #2
    Thomas79,

    Not sure I follow what your question is exactly. You need to use NinjaScript methods and properties to create your code.

    The price information are accessed from these DataSeries: Open[] High[] Low[] Close[]. Please pay attention to capitals. "or"s are done by using ||

    I suggest you familiarize yourself with the syntax first by going through some of these tutorials: http://www.ninjatrader-support.com/H...tml?Overview34
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Wasn't there an indicator CandleStickPattern that does this?
      Or also CandelStickPatterAll

      Comment


        #4
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by Thomas79 View Post
          Hi, i'm pretty new on ninja and i already developp my strategy in .net on an other programming platform and i have to re start everything on ninja trader (because the other software doesn't offer a link with broker to trade)

          anyway,

          i would like the script to find the shooting star (my point of view)... but nothing is reconize on ninja...

          bool MyShooting = (open[bar]-close[bar])<0.31*(high[bar]-low[bar]) && (close[bar]-open[bar])<0.31*(high[bar]-low[bar])
          && (high[bar]-close[bar]>4*tick)&&(high[bar]-open[bar]>4*tick)
          &&close[bar]==low[bar] or close[bar]==low[bar]+1 tick) or open[bar]==low[bar] or open[bar]==low[bar]+1 tick

          and if there is a shooting star... i want to see it on a colors, like purple or with a arrow or anything else...

          the thing is that i don't know the script in the beginning... variable, protected override void, properties, define the tick in ninja script etc...

          please help me, on the previous software it was a little bit symply...
          thx
          Code:
           
          protected override void OnBarUpdate()
          {
          if(Math.Abs(Open[0]-Close[0]) < 0.31*(High[0] - Low[0]) &&
          Math.Max(Open[0],Close[0]) < High[0] - 4*TickSize &&
          Math.Min(Open[0], Close[0]) <= Low[0] + TickSize)
          BarColor = Color.Purple;
          }

          Comment


            #6
            thx a lot... and if i want the purple color but just on the back of the shooting star ? what's the code to replace BarColor = Color.Purple;
            thx

            Comment


              #7
              BackColor = Color.Purple;
              or whatever color you want.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                thx... right now i would like to take the shooting star only after a rise... i mean the high of my shooting star is higher than the top of the bar-1 and the bar-2 etc...
                right here the code but it doesn't work :

                &&(High[0]>High[-1])&(High[0]>High[-2]) || (High[0]>High[-1])&(High[0]>High[-3]) || (High[0]>High[-2])&(High[0]>High[-3]));

                i think that High[-1] for example is not the high of the preivous bar ?

                Comment


                  #9
                  Correct Thomas, please use High[1] to reference the previous bars high.

                  Comment


                    #10
                    ok thx, i'll try, and to say high next bar... what is it ?

                    Comment


                      #11
                      For example, High[2], Low[3], Close[6]....we have some great tutorials under this link for an easy start - http://www.ninjatrader-support.com/H...verview18.html

                      Comment


                        #12
                        can you tell me what's wrong on the script, sometime it give me the good think and sometime not...

                        here the script :
                        protectedoverridevoid OnBarUpdate()
                        {
                        bool MyShooting =
                        (((Open[
                        0]-Close[0])<0.31*(High[0]-Low[0]))&&((Close[0]-Open[0]<0.31*(High[0]-Low[0])))
                        &&
                        (High[
                        0]-Close[0]>=4*TickSize)
                        &&
                        (High[
                        0]-Open[0]>=4*TickSize)
                        &&
                        ((Close[
                        0]==Low[0]) || (Close[0]==Low[0]+ TickSize) || (Open[0]==Low[0]) || (Open[0]==(Low[0] + TickSize)))
                        &&
                        ((High[
                        0]>High[1])&(High[0]>High[2]) || (High[0]>High[1])&(High[0]>High[3]) || (High[0]>High[2])&(High[0]>High[3])));

                        if (MyShooting)
                        {
                        BackColor = Color.Pink;
                        }
                        }

                        and here the result


                        Comment


                          #13
                          Thomas79,

                          Unfortunately we cannot debug your script for you. You need to step through your code and evaluate each one of your conditions by hand to see how it should have evaluated.

                          Please use Print() to determine the exact values your strategy is using for calculations. See this tip: http://www.ninjatrader-support2.com/...ead.php?t=3418

                          Instead of nesting so many &&s together I suggest you break them apart into separate if-statements so you know exactly which one is causing the painting of your bars. Then you can better pinpoint where in your code it is evaluating incorrectly.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #14
                            Make sure you are using double "&&" everywhere.
                            I see single "&" which perform different operation.

                            Comment


                              #15
                              i want to sell short limit at the opening of the next bar... i found on the Guide the enter limit short but it doesn't work... :

                              EnterShortLimit(1, Open[1], "");

                              what is the script to enter short limit at the opening of the next bar ?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              571 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              330 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              101 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              548 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              548 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X