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

Trying to understand StopLimit Buy Order

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

    Trying to understand StopLimit Buy Order

    Hello

    I am trying to understand how StopLimit Buy Orders work.
    I use the Simulated Data Feed with Instrument = FDAX 06-18

    When I place a StopLimit Buy Order with :
    - Stop price = 12560
    - Limit price = 12570

    Then the order is well opened when the price is below 12560 and reaches 12560.
    Then when the price keeps on going up, the order is not closed when the price reaches 12570.

    Could you explain how to force the order to be closed with the Limit price ?

    Thanks !

    #2
    Hello investdatasystems,

    A stop limit order when the stop is touched at the stop price becomes a limit at the specified limit price.

    A limit order fills at the specified price or better.

    If the market is ahead of a limit order it will not fill. Only one the price drops to the to limit or behind it will the order fill.

    Below are public links to investopedia on Stop Limit and Limit orders.




    If you are wanting an order that fills when touched, use a Stop Market order. When the stop is touched, this order type becomes a Market Order.

    Below is a public link to investopedia on Stop Market orders.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello !

      Thank you for your reply.

      I will find more info in french. I have found a link in french that is very good : https://www.activtrades.com/fr/types-d-ordres

      What I want to do is :
      - When the price reaches a specified level
      - Then open a Buy order with a specified TP and SL

      So I think I should do the following :
      - Use a Buy Stop Order with level to reach for the position to be opened
      - Use SetTargetProfit and SetStopLoss on the Buy Stop Order (Is that possible ?)

      Thanks

      Update :
      It is ok now, here is how I proceed :

      Code:
      		double ask = 0;
      		double bid = 0;
      		bool done = false;
              /// <summary>
              /// Called on each bar update event (incoming tick)
              /// </summary>
              protected override void OnBarUpdate()
              {
      			ask = this.GetCurrentAsk();
                  bid = this.GetCurrentBid();
      			
      			if (this.Historical == true) return;
      			
      			if (done == false){
      				IOrder order = this.EnterLongStop(1, ask+5, "MonSignalName");
      				this.SetProfitTarget("MonSignalName", CalculationMode.Price, bid+10);
      				this.SetStopLoss("MonSignalName", CalculationMode.Price, ask-20, false);
      				Print("stop price = " + (ask+5));
      				Print("tp price = " + (bid+10));
      				Print("sl price = " + (ask-20));
      				done = true;
      			}
              }
      Last edited by investdatasystems; 04-24-2018, 02:18 AM.

      Comment


        #4
        Hello investdatasystems,

        I see you are creating a NinjaScript Strategy instead of placing manual orders.

        Yes you can use SetStopLoss() and this will use a stop limit order with the limit hard coded to be 20 ticks a head of the stop price. This means when the stop is touched the limit should be ahead of the market and should fill immediately.

        I recommend that you call SetStopLoss() and SetProfitTarget() before placing the entry order. (As these cannot be unset and will continue to use an old price when an new entry is made unless the signalName / fromEntrySignal is unique for each new entry)

        Below I am providing a link to a NinjaTrader 7 example strategy called CustomStopStrategyWithTrailExample that demonstrates using SetStopLoss().
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CortexZenUSA, Today, 12:53 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by CortexZenUSA, Today, 12:46 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by usazencortex, Today, 12:43 AM
        0 responses
        5 views
        0 likes
        Last Post usazencortex  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        168 responses
        2,266 views
        0 likes
        Last Post sidlercom80  
        Started by Barry Milan, Yesterday, 10:35 PM
        3 responses
        13 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X