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

Get the current dsiplayed price in the DOM

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

    Get the current dsiplayed price in the DOM

    I'm having a hard time understanding how to use what would be considered the DOM ladder price as part of my strategy. I just want to know where the current price is. If that price goes lower than say 1500 price level on the chart I would execute a trade.

    When I include and print Close[0] I get the actual close of each bar though many references here say to do this to receive current price. I included "Calculate = Calculate.OnEachTick;" in the state defaults:

    Code:
    if (State == State.SetDefaults)
    {
    Description = @"Sample ";
    Name = "Rus";
    Calculate = Calculate.OnEachTick;

    p
    Code:
    rotected override void OnBarUpdate()
    {
    Print("__" + Close[0]);
    This print statement returns the close of a 5 minute bar rather than the current price.

    How do I print the current price as it creates the bar to include in my strategy?

    This is part of a strategy that uses an indicator on a 5 minute chart within the strategy.

    Thanks!
    Chris
    Last edited by hireforwebsite; 10-22-2019, 01:24 PM.

    #2
    Hello, thanks for your note.

    Calculate = Calculate.OnEachTick would be the way to get the fastest price updates. Did you ensure to remove and re-add the strategy to your chart? This is required if you change anything in the OnStateChanged method.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Yes I did try that. I still receive the closing price of the 5 minute bar rather than a print out of the ticks as they create the 5 minute bar.

      Comment


        #4
        Hello, thanks for your reply.

        I attached a strategy that works on my side while connected to live data. Please add the attached file to Documents\NinjaTrader 8\bin\Custom\Strategies then compile.

        Please let me know if that does not work on your end.
        Attached Files
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by jxs_xrj, 01-12-2020, 09:49 AM
        6 responses
        3,290 views
        1 like
        Last Post jgualdronc  
        Started by Touch-Ups, Today, 10:36 AM
        0 responses
        9 views
        0 likes
        Last Post Touch-Ups  
        Started by geddyisodin, 04-25-2024, 05:20 AM
        11 responses
        62 views
        0 likes
        Last Post halgo_boulder  
        Started by Option Whisperer, Today, 09:55 AM
        0 responses
        8 views
        0 likes
        Last Post Option Whisperer  
        Started by halgo_boulder, 04-20-2024, 08:44 AM
        2 responses
        25 views
        0 likes
        Last Post halgo_boulder  
        Working...
        X