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

Openning range breakout

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

    Openning range breakout

    Hello!

    Please, could you give some advice on making a strategy. This is an opening range breakout.
    I want to do the following. I wait until high and low have been established in the 930-1000 time interval and wait until price violates the high or low of this range and it must close outside of it, if that has happened the limit order should immediately be set at the exactly the same level of the the range. There must not be any trades before 1000 or it price just penetrated out and not closed outside of the range.
    And also if I have got into position I don't want to send more orders if a price be on a previous entrance level..so just one entry until stopped out or reached my target. Thank you very much, this is the sample of my code that I cannot get running properly.

    protected override void OnBarUpdate()
    if (ToTime (Time[0]) == 100000)
    {
    { MAX(High,6)[0];
    MIN(Low,6)[0];
    }

    if (Close[0] == MAX [0])
    {
    EnterLong((int) (3), "");
    }
    if (Close[0] == MIN [0])
    {
    EnterShort((int) (3), "");
    }

    if (ToTime(Time[0]) > 155500 )
    {
    ExitLong();
    }
    if(ToTime(Time[0]) > 155500)
    {
    ExitShort();

    #2
    Evgeniy_T,

    I suggest you check out these reference samples: http://www.ninjatrader-support2.com/...ead.php?t=3223
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks for reference. Hope to use that sample in my code. And as for Lows, I think it would be written in a same way as High? Right?

      Comment


        #4
        Josh,

        Still have problems with entering with LongLimit orders. it's seems to me i did some mistakes in my code. My idea is to send a limit order as soon as I have a first close (not just a breakout) above the highest high of the range with the limit price of that previous HH. Thank you in advance for your assistance.

        My code follows:

        if (Bars.FirstBarOfSession)
        highestHigh = High[0];

        // Stores the highest high from the first 6 bars
        if (Bars.BarsSinceSession < 6 && High[0] > highestHigh)
        highestHigh = High[0];

        if (Bars.BarsSinceSession > 6 && Close[0] > highestHigh)
        EnterLongLimit(highestHigh);

        Comment


          #5
          I would suggest you print out your highestHigh value and check via the output window it correlates with what you would expect for it -



          Then you may want to set your limit orders to liveUntilCancelled, in case you find they expire too soon for you to get a fill - http://www.ninjatrader-support.com/H...verview36.html

          To debug the behavior of your placed orders, please work with the TraceOrders feature we have - http://www.ninjatrader-support2.com/...ead.php?t=3627
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Thanks for assistance. Try to figure out my bugs and fix them. And one more question,when i'm trying to test my code on a history data on a 5 min time frame it seems to me that data stream is not consistent starting approx. from middle of august and before that...when I look through the charts there are a lot of blanks during the session ours like the program did get an adequate data for that sessions and as the result missed trades or wrong enters into market...how can I solve that problem? and what time range from the present day to the past data provider typically provide (in my case it's a Mirus Futures broker). Thank you for you answer.
            Evgeniy.

            Comment


              #7
              Evgeniy_T, normally the current contract history should be accessible - try a reload of data with a right click on the chart.
              BertrandNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Tin34, Today, 03:30 AM
              2 responses
              16 views
              0 likes
              Last Post Tin34
              by Tin34
               
              Started by sastrades, Yesterday, 09:59 AM
              2 responses
              31 views
              0 likes
              Last Post brucerobinson  
              Started by ETFVoyageur, Today, 12:52 AM
              1 response
              16 views
              0 likes
              Last Post Leeroy_Jenkins  
              Started by lollers, Today, 03:26 AM
              0 responses
              12 views
              0 likes
              Last Post lollers
              by lollers
               
              Started by aliyahany, Today, 03:16 AM
              0 responses
              4 views
              0 likes
              Last Post aliyahany  
              Working...
              X