Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Enter and Exit a strategy on a timely manner

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

    Enter and Exit a strategy on a timely manner

    Hi There,

    I have a strategy that it's based on UniRenko (default) + 15-min bar chart (as secondary series). How do I include the following conditions in my strategy?

    1- Wait till the first 5-min passes. If my conditions are not met, don't take any positions till the next new 15-min bar comes in
    2- If a position is taken, then don't take another one till the next new 15-min bar comes in

    Thank you..

    #2
    Hello Abdullah_KSA,

    Thanks for your post.

    In Item 1, did you mean the first 5 minutes or first 15-minute bar?

    Can you clarify if you are working in the Strategy Builder or the Ninjascript editor to create the strategy?

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_PaulH View Post
      Hello Abdullah_KSA,

      Thanks for your post.

      In Item 1, did you mean the first 5 minutes or first 15-minute bar?

      Can you clarify if you are working in the Strategy Builder or the Ninjascript editor to create the strategy?
      Thank you .. Paul for your kind and prompt reply

      Item#1 is related to the first 5 minutes (of the 15 minutes bar). So, don't take any positions, if the first 5 minutes passes, and my conditions are not met (wait till the next 15 minutes bar shows up).

      I use the script editor manually (not the Strategy Builder). However, my coding knowledge is very modest. I'd really appreciate highlighting the major commands to be used. I can look'em up, and try to educate myself about them. I'd be very thankful if you can generously code it and share it here

      Comment


        #4
        Hello Abdullah_KSA,

        Thanks for your reply.

        While we cannot provide script writing service, what I can suggest is to also add a 5-minute bar series to provide a way to note when the 5 minute period is up.

        You would need to use bool variables (that are either true or false) when the 15-minute bar has called the OnBarUpdate(). This would be when BarsInProgress ==1, at that moment you could set a bool to be true indicating a new 15 minute period and you would use that bool being true as part of your entry conditions.

        You would set the bool to false under the condition of placing an order, to prevent further orders until the next 15-minute bar or if the 5-minute bar (BarsInProgress == 2 (assuming you added it second)) calls OnBarUpDate().

        You'll likely have to play with the logic a bit as the sequence of which data series call OnBarUpdate() is not always in the order that you might think so definitely be prepared to debug with print statements that show the BarsInProgress.

        If you are not familiar with multi-series/Time-frames coding, I highly recommend reviewing the help guide here: https://ninjatrader.com/support/help...nstruments.htm



        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Thank you, Paul
          This is really helpful. I shall give it a shot, and revert back with the outcomes
          Appreciate your insights

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by suroot, 04-10-2017, 02:18 AM
          4 responses
          3,019 views
          0 likes
          Last Post truepenny  
          Started by Stanfillirenfro, Today, 07:23 AM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by cmtjoancolmenero, Yesterday, 03:58 PM
          2 responses
          22 views
          0 likes
          Last Post cmtjoancolmenero  
          Started by olisav57, Yesterday, 07:39 PM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by cocoescala, 10-12-2018, 11:02 PM
          7 responses
          944 views
          0 likes
          Last Post Jquiroz1975  
          Working...
          X