• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can I access "Offset" and "Rollover date" from NinjaScript code?

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

    Can I access "Offset" and "Rollover date" from NinjaScript code?

    I made XML file that contain historical supp \ res levels, like this:

    HTML Code:
    <levels instrument ="CL" tf="H1">
       <l beg="19.08.2014 19:00:00" pr="110.20" end="25.08.2014 20:00:00" tag="sup" />
       <l beg="19.09.2014 05:00:00" pr="110.30" end="30.08.2014 19:00:00" tag="res" />
       <l beg="23.09.2014 17:00:00" pr="105.01" end="03.09.2014 03:00:00" tag="sup" />
       <l beg="03.10.2014 18:00:00" pr="106.17" end="19.09.2014 05:00:00" tag="res" />
    </levels>
    And now I need to write indicatror that can parce XML and show levels on chart.

    I use Merge policy "MergeBackAdjusted" only.

    As for as I understand, after every expiration date chart jump up or down on (offset / TicksSize) ticks, but levels will plotted on fixed price (specified in XML file).


    The question: is there any way to access from indicator code "Offset" and "Rollover date" values to adjust levels prices after each expiration?
    Last edited by fx.practic; 11-02-2014, 12:43 PM.

    #2
    Hello fx.practic,

    Thank you for your post.

    You can find an example at the following link: http://www.ninjatrader.com/support/f...d=4&linkid=558
    Patrick H.NinjaTrader Customer Service

    Comment


      #3
      That's great, exactly what I need. Very comfortable realisation. Thank You!

      This work for me:


      if (Instrument.MasterInstrument.MergePolicy == MergePolicy.MergeBackAdjusted)
      level.price_to_plot = level.price_from_xml + Instrument.GetOffsetSum( level.begin_time );
      else
      level.price_to_plot = level.price_from_xml;
      Last edited by fx.practic; 11-04-2014, 03:12 PM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NT-Roland, Today, 04:36 PM
      0 responses
      2 views
      0 likes
      Last Post NT-Roland  
      Started by Newtrader101, Today, 03:40 PM
      2 responses
      10 views
      0 likes
      Last Post Newtrader101  
      Started by Branpo, Today, 02:58 PM
      2 responses
      7 views
      0 likes
      Last Post Branpo
      by Branpo
       
      Started by sdauteuil, Today, 02:09 PM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by AMATX, Today, 02:19 PM
      2 responses
      11 views
      0 likes
      Last Post AMATX
      by AMATX
       
      Working...
      X