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

contruction of his own shooting star

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

    #16
    Open[0] is the price of the current bar. You cannot set a price on the next bar because you do not know what the next bar will be. Only when that next bar has been started will you know the price and then you can submit at Open[0] for that bar.

    Be sure you are using CalculateOnBarClose = false when in real-time.
    Josh P.NinjaTrader Customer Service

    Comment


      #17
      oki a sell limit order for example close of the bar[0]

      but i put a stop order and it is ignored... i made it exactly like on the guide...
      wacth my script : what's wrong ?
      {
      EnterShortLimit(
      1, Close[0], "");
      stopPrice = (High[
      0]+3*TickSize);
      }
      //Exits position
      ExitShortStop(stopPrice);
      }

      Comment


        #18
        You can only place a stop order when you have an active short position. While you do EnterShortLimit(), you do not necessarily have an open stop position yet.
        Josh P.NinjaTrader Customer Service

        Comment


          #19
          to be honest the guide is not really clear... I try to devellop a really simply script :
          i defined my shooting star, if there is a shooting star you sell limit at close of the shooting star, you put a stop 3 tick above the shooting star and you take profit at a risk reward of 2 (entry level - (stop-entry level)*2)... really simply indeed... here my script develop with the guide... what's wrong on my script ?

          Comment


            #20
            followed by :

            if (MyShooting)
            {
            HS=High[
            0];
            {
            BackColor = Color.Pink;
            EnterShortLimit(
            1, Close[0], "");
            }
            }
            else
            {
            //the stop is 3 ticks above my shooting star
            stopPrice = (HS + 3*TickSize);
            if (ExitShortStop(stopPrice));
            {
            EntryLevel=EnterShortLimit;
            //exit position at a risk reward of 2
            ExitShortLimit(EntryLevel-(stopPrice-Entry)*2);
            }
            }
            }

            Comment


              #21
              Thomas79,

              if (ExitShortStop(stopPrice));
              {
              EntryLevel=EnterShortLimit;
              //exit position at a risk reward of 2
              ExitShortLimit(EntryLevel-(stopPrice-Entry)*2);
              }

              That part does not make sense. ExitShortStop() is not something you would run an if-statement on. It places orders.

              When you use limit/stop orders you need to keep them alive. Please read this article: http://www.ninjatrader-support.com/H...tml?Overview36
              Josh P.NinjaTrader Customer Service

              Comment


                #22
                oki i read the article... the best this for me is to set a stop loss and a set profit target... it is write that it is better to write the script in Initialize... this is what i did and it doesn't work :

                protectedoverridevoid Initialize()
                {
                CalculateOnBarClose =
                true;
                //Submits a stop loss 3 ticks above my shooting define bool MyShooting
                SetStopLoss(High[0] + 3* TickSize);
                }

                we are ok than the 'High[0] is the top of the bar where i have my signal... so my shooting star ?

                Comment


                  #23
                  You can't use High[0] in Initialize(). You cannot dynamically modify stop/target prices in Initialize(). You need to hard set a certain stop value whether that be a number of ticks or a percentage or a certain value if you want to do it in Initialize().
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #24
                    Do it in OnBarUpdate(). When you have determined your shooting star, call SetStopLoss() and then place your order. Remember that if you do not change your SetStopLoss() for before the next order, it will take on the same value you set prior.
                    Josh P.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by aussugardefender, Today, 01:07 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post aussugardefender  
                    Started by pvincent, 06-23-2022, 12:53 PM
                    14 responses
                    238 views
                    0 likes
                    Last Post Nyman
                    by Nyman
                     
                    Started by TraderG23, 12-08-2023, 07:56 AM
                    9 responses
                    384 views
                    1 like
                    Last Post Gavini
                    by Gavini
                     
                    Started by oviejo, Today, 12:28 AM
                    0 responses
                    4 views
                    0 likes
                    Last Post oviejo
                    by oviejo
                     
                    Started by pechtri, 06-22-2023, 02:31 AM
                    10 responses
                    125 views
                    0 likes
                    Last Post Leeroy_Jenkins  
                    Working...
                    X