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 alifarahani, Today, 09:40 AM
        6 responses
        36 views
        0 likes
        Last Post alifarahani  
        Started by Waxavi, Today, 02:10 AM
        1 response
        17 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by Kaledus, Today, 01:29 PM
        5 responses
        14 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Waxavi, Today, 02:00 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by gentlebenthebear, Today, 01:30 AM
        3 responses
        17 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X