Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problems with two time frames

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

    Problems with two time frames

    Hello, I'm working with two different time frames (5 and 1 minute). I need to put my orders in 5 minutes but it must run in 1 minute. I do it with this code:

    if (BarsInProgress == 0)
    {

    EnterShortStop(
    1,true,1,MyEntryPrice,"");
    }

    ...

    where 5 minutes is BarsInProgress=0 and 1 minute is BarsInProgress=1.

    If I use "false" like the second parameter my order is Accepted and Cancelled inmediately.

    If I use "true" like the second parameter I can't cancel my order when the 5 minutes have finished.

    Thanks in advance.

    Jesus.

    #2
    soyjesus, if the order is not set to liveUntilCancelled the next OnBarUpdate() call would cancel it - what TraceOrders output do you get when attempting to cancel the order then in your code?

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Ok Bertrand, this is the result of the output:

      Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Ticks Value=30 Currency=0 Simulated=False
      Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Price Value=610,8 Currency=0 Simulated=False


      So the problem is that my order of new entry don't exist (only the Target and Stop orders).

      Before I have used "CancelOrder" when has finished the bar in the main time frame. I can see that whe I call to CancelOrder, I can send a new entry order in the future.

      Why?

      Jesus.

      Comment


        #4
        Is this the complete TraceOrders output you get? Please recheck and if possible post the full one so we can review, thanks
        BertrandNinjaTrader Customer Service

        Comment


          #5
          When my entry order is Accepted (but not filled) there isn't any problem. But when the main time frame is finished this is the complete TraceOrders output I get. Not more information is showed with the next bars.

          Comment


            #6
            Ok, so how do you attemp the placed order, if it's accepted and working? Do you work with IOrder objects, as this would be needed in the CancelOrder method...because with liveUntilCancelled it would remain working until you 'cancel ordered' it from within your code. It would help if you could post some pseudo code of how you have things laid out.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Ok I will send you the code but now I can't continue for today. I will contact with you the next Monday.

              Thanks and have a nice week end!

              Comment


                #8
                Thanks, sounds good - have a great weekend yourself soyjesus
                BertrandNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by quantismo, 04-17-2024, 05:13 PM
                3 responses
                25 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by ScottWalsh, 04-16-2024, 04:29 PM
                7 responses
                34 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by cls71, Today, 04:45 AM
                0 responses
                5 views
                0 likes
                Last Post cls71
                by cls71
                 
                Started by mjairg, 07-20-2023, 11:57 PM
                3 responses
                215 views
                1 like
                Last Post PaulMohn  
                Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                4 responses
                549 views
                0 likes
                Last Post PaulMohn  
                Working...
                X