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

Rounding Prices To Instrument Price

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

    Rounding Prices To Instrument Price

    Hello,

    I plan to build some strategies with /ES market.

    What happens if I try to set a stop loss or limit order at price not equal to current bid such as XXXX.00, XXXX.25, XXXX.50, and XXXX.75.

    For example, say I want use ATR to set a stop loss price:

    ATR(10) = 1.73 (see example)
    Entry Price = 2665.50
    Stop_Loss_Price = 2665.50 - 1.73

    Stop_Loss_Price = 2663.77

    SetStopLoss(@"Long_Signal", CalculationMode.Price, Stop_Loss_Price, false);

    Question:
    1. Will NT8 round the Stop_Loss_Price number to 2663.75 or 2664?
    2. What if the Stop_Loss_Price was calculated as 2663.09 ? What will NT8 round the number to?

    Thanks for the help.
    Attached Files

    #2
    Hello simple_goodoboy,

    Thanks for your question.

    NinjaTrader will round the prices so they are valid for order submission.

    For a faster answer, this can be easily set up and tested on your end without having to wait for our office to open. For example, a strategy that places a Stop Loss or a Profit Target in State.Configure with the price you want to test can show you the order gets rounded.

    Code:
    else if (State == State.Configure)
    	{
    		SetProfitTarget(CalculationMode.Price, 3019.657829);
    	}
    }
    
    protected override void OnBarUpdate()
    {
    	if(State == State.Realtime)
    		EnterLong();
    }
    For testing Realtime data after hours, you can use the Playback Connection or use the Simulated Data Feed with a Default 24/7 Trading Hours template.

    If you have any other questions, please don't hesitate to ask.
    JimNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jim View Post
      Hello simple_goodoboy,

      Thanks for your question.

      NinjaTrader will round the prices so they are valid for order submission.

      For a faster answer, this can be easily set up and tested on your end without having to wait for our office to open. For example, a strategy that places a Stop Loss or a Profit Target in State.Configure with the price you want to test can show you the order gets rounded.

      Code:
      else if (State == State.Configure)
      	{
      		SetProfitTarget(CalculationMode.Price, 3019.657829);
      	}
      }
      
      protected override void OnBarUpdate()
      {
      	if(State == State.Realtime)
      		EnterLong();
      }
      For testing Realtime data after hours, you can use the Playback Connection or use the Simulated Data Feed with a Default 24/7 Trading Hours template.

      If you have any other questions, please don't hesitate to ask.
      Thank you so much Jim. I will try this.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Barry Milan, Yesterday, 10:35 PM
      5 responses
      16 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by DanielSanMartin, Yesterday, 02:37 PM
      2 responses
      13 views
      0 likes
      Last Post DanielSanMartin  
      Started by DJ888, 04-16-2024, 06:09 PM
      4 responses
      13 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by terofs, Today, 04:18 PM
      0 responses
      12 views
      0 likes
      Last Post terofs
      by terofs
       
      Started by nandhumca, Today, 03:41 PM
      0 responses
      8 views
      0 likes
      Last Post nandhumca  
      Working...
      X