Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help me with a order

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

    #16
    Hello again

    I have this order

    #region Variables
    private int horas = 00;
    private int minutos = 00;
    private int segundos = 00;
    #endregion

    // Condition Entry.
    if (ToTime(Time[0]) == ToTime(horas,minutos,segundos))
    { EnterShort }

    And send the order sometimes yes and sometimes not.

    If you put an hour as 15,00,00 - or 17,30,00 in general it works well.
    But if you place 14, 29, 00, or 13, 05, 00, it does not do anything.

    Can you tell me why.

    Thanks.

    (timeframe 15 mint.)
    Last edited by firecan; 09-01-2010, 03:29 PM.

    Comment


      #17
      firecan,

      That would be expected because your code is looking for an exact match. You are using == which means the timestamp of the bar needs to match exactly the time you push in which is 14:29:00. On a 15 minute chart there would never be any bar timestamped as 14:29 and that is why nothing happens.

      Instead you should use numbers that would actually fit with the time frame of your chart or change your logic to use >= or <= and setup a range of acceptable values.
      Josh P.NinjaTrader Customer Service

      Comment


        #18
        help with a order

        Ok. thanks I try it. (>=)

        And now:

        I have this order:

        // Once the price is greater than entry price+10 ticks, set stop loss to breakeven

        if (Close[0] >= Position.AvgPrice +10 * TickSize)
        { SetStopLoss(CalculationMode.Price, Position.AvgPrice); }

        first I´d like to know why do not work.

        But that I need is how send the stop loss to breakeven when the price arrive to entry +15 ticks, without wait closes a bar.

        Please if is possible do not send to the tutorial again, I do not understand.

        Thank you.

        Comment


          #19
          Firecan, you would need to add print statements to debug your code, making sure the logic triggers to adjust the stop to a new price level - http://www.ninjatrader.com/support/f...ead.php?t=3418

          You can adjust intrabar when trading it live or in MarketReplay if you set the CalculateOnBarClose setting to false - http://www.ninjatrader-support.com/H...BarClose1.html
          BertrandNinjaTrader Customer Service

          Comment


            #20
            Help me with a order

            Hello, someone can help me with the following order.

            I try to throw two orders simultaneously to the market.

            One (Long) to the current price +10 pips

            and another (Short) to the current price-10 pips

            I can to do it but in two script different one for Long and other one for Short, I expect it could unify the order.

            -----------------------------------------------------------------------------------------------------

            // Condition Long.
            if (ToTime(Time[0]) == ToTime(horas,minutos,segundos))
            { EnterLongStop(contratos,Close[0]+10, ""); }

            ------------------------------------------------------------------------------------------------------

            // Condition Short.
            if (ToTime(Time[0]) == ToTime(horas,minutos,segundos))
            { EnterShortStop(contratos,Close[0]-10, ""); }

            --------------------------------------------

            If I put both orders in the same script only send the first one order, already is short or long.

            I wait there exists some order or way of putting these orders in the same script.

            Thanks.

            Comment


              #21
              firecan, unfortunately you would run into the 'internal order handling rules' with this approach - http://www.ninjatrader-support.com/H...verview36.html

              You would see this with TraceOrders as debug tool enabled in your script -



              A workaround is to monitor price and only place one order as needed and CancelOrder the other working one, so you would only have one working order all the time in this case.
              BertrandNinjaTrader Customer Service

              Comment


                #22
                Price to Breakeven without wait close (0)

                Hello again, I try with samples but don´t speak about prices only SMA. Please can you tell me, what I need change in this code:

                // When the pryce is more big than entry price +0.0010 ticks send Stop Loss to Breakeven.

                if ( Close (0) >= Position.AvgPrice + 0.0010 * TickSize)
                { SetStopLoss(CalculationMode.Price,Position.AvgPric e -0.0001); }

                this code need whait close bar (0)

                ----------------------------------------------------------------------------------

                if ( ?????? >= Position.AvgPrice + 0.0010 * TickSize)
                { SetStopLoss(CalculationMode.Price,Position.AvgPric e +0.0001); }

                Regards.

                Comment


                  #23
                  firecan, you could simply run this code with CalculateOnBarClose set to false in realtime trading, it would then update the Close[0] value intrabar as the bar develops. Should you want to trigger certain conditions still on bar close, please review this sample showing a dual approach to setting this property -

                  BertrandNinjaTrader Customer Service

                  Comment


                    #24
                    Hello again

                    I run this code with CalculateOnBarClose set to false in realtime trading. And not OK.

                    I need to know the code that I need change here. (Entry Price)

                    if ( ____________________ >= Position.AvgPrice + 0.0010 * TickSize)
                    { SetStopLoss(CalculationMode.Price,Position.AvgPric e +0.0001); }

                    Regards.

                    Comment


                      #25
                      Hello firecan,

                      Can you let us know what it is you're looking to express here?
                      Ryan M.NinjaTrader Customer Service

                      Comment


                        #26
                        Hello again.

                        I am looking for the order correct order that, after having a long entry, send the Stop Loos to Breakeven+1 when the price arrive +10 ticks from entry price.

                        Regards.

                        Comment


                          #27
                          if ( Close [0] >= Position.AvgPrice = + 0.0010 * TickSize)
                          {SetStopLoss (CalculationMode.Price,Position.AvgPrice+0,0001);}

                          Comment


                            #28
                            If you're using TickSize, then you want to use whole numbers rather than decimals to express "10 Ticks"

                            if (Position.MarketPosition == MarketPosition.Long)
                            {
                            if ( Close [0] >= Position.AvgPrice + 10 * TickSize)
                            {
                            SetStopLoss (CalculationMode.Price, Position.AvgPrice + TickSize);
                            }
                            }
                            Ryan M.NinjaTrader Customer Service

                            Comment


                              #29
                              Thanks for your reply.

                              I try it right now.

                              Regards.

                              Comment


                                #30
                                Hello again, thank you, now it run correctly.

                                I have some questions:

                                1) I have opened a real account, need to change some parameters into options. I have seen a video and it changes some of them, is necessary or I can operate since it comes from origin.

                                2) While I am connected the ninja connection loses after a time without realizing any action, ¿ comes predetermined for it, is necessary to change any parameter.

                                This problem makes me hollow without information when I want to do a replay conection.

                                Thank you.

                                (sorry, automatic translation)

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by bortz, 11-06-2023, 08:04 AM
                                47 responses
                                1,607 views
                                0 likes
                                Last Post aligator  
                                Started by jaybedreamin, Today, 05:56 PM
                                0 responses
                                9 views
                                0 likes
                                Last Post jaybedreamin  
                                Started by DJ888, 04-16-2024, 06:09 PM
                                6 responses
                                19 views
                                0 likes
                                Last Post DJ888
                                by DJ888
                                 
                                Started by Jon17, Today, 04:33 PM
                                0 responses
                                6 views
                                0 likes
                                Last Post Jon17
                                by Jon17
                                 
                                Started by Javierw.ok, Today, 04:12 PM
                                0 responses
                                16 views
                                0 likes
                                Last Post Javierw.ok  
                                Working...
                                X