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

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.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #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

    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.
      fx.practic
      NinjaTrader Ecosystem Vendor - fx.practic

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Barry Milan, Today, 10:35 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by WeyldFalcon, 12-10-2020, 06:48 PM
      14 responses
      1,428 views
      0 likes
      Last Post Handclap0241  
      Started by DJ888, Yesterday, 06:09 PM
      2 responses
      9 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      40 views
      0 likes
      Last Post jeronymite  
      Started by bill2023, Today, 08:51 AM
      2 responses
      16 views
      0 likes
      Last Post bill2023  
      Working...
      X