Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

PLEASE help me understand SetProfitTarget and SetStopLoss

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

    PLEASE help me understand SetProfitTarget and SetStopLoss

    From what I'm understanding, SetProfitTarget and SetStopLoss set the offset value of the current entry price except the mode Price, right!?
    And it was set in the OnStateChange() under the condition State == State.Configure, right!?
    So all I need in the OnBarUpdate() is EnterLong or EnterShort then it will exit automatically for me once the Profit Target or Stop Loss is hit, right!?
    I don't need to put any ExitLong or ExitShort in my program, right!?
    But NO MATTER what and how I set up my PT and SL, my order was NEVER EXITED!
    Why was that!?!?!? What did I do wrong!? PLEASE help me out!!! Thank you very VERY much! God bless you !!!

    #2
    Hello YoutingChu,
    Thanks for your post.

    SetProfitTarget and SetStopLoss set the offset value of the current entry price except the mode Price, right!?
    Correct. In price mode the 'value' field represents the actual price.
    it was set in the OnStateChange() under the condition State == State.Configure, right!?
    Yes, that would be the correct place to use SetStopLoss() or SetProfitTarget() if your stop loss is a static value.
    So all I need in the OnBarUpdate() is EnterLong or EnterShort then it will exit automatically for me once the Profit Target or Stop Loss is hit, right!?
    Correct.
    I don't need to put any ExitLong or ExitShort in my program, right!?
    Correct. You can use whichever order methods work for your strategy.
    But NO MATTER what and how I set up my PT and SL, my order was NEVER EXITED!
    • What are the parameters for your SL, PT, and entry order?
    • Were the SL and PT submitted at all? If so, does the 'State' column on your 'Orders' tab say the SL/PT was canceled?
    • Are there any errors on the 'Logs' tab of your Control Center?
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Dear JoshG,

      Before I go any further, could you please teach me how could I check if my PT and SL is set and if my order is been exited, please!?
      I had tried to print the OrderAction and OrderState in OnOrderUpdate and OnExecutionUpdate, but it seems to be NOT what I think it is!
      Could you teach me the correct way to do it, please!?

      On another note, could you pleae teach me how can I get the current PT and SL prices please!?
      For example, if I SetProfitTarget(CalculationMode.Ticks,10) and SetStopLoss(CalculationMode.Ticks,10,false) and enter an order at the price of 1.2345.
      Then the PT will be 1.2355 and SL will be 1.2335, right!?
      Could you please teach me how could I get those 2 numbers please!?

      Thank you very much! God bless you!!!
      Last edited by YoutingChu; 05-29-2018, 11:30 PM.

      Comment


        #4
        Here is our help guide documentation on "Using OnOrderUpdate() and OnExecution() methods to submit protective orders". The sample demonstrates one way you could properly monitor OnExecutionUpdate() and OnOrderUpdate().
        Help Guide - Strategy Reference Samples

        Additionally, the two following links demonstrate how to monitor your PT and SL orders.
        https://ninjatrader.com/support/help...of_stop_lo.htm
        https://ninjatrader.com/support/help..._and_profi.htm

        You can monitor your Control Centers 'Orders' tab for information on the state of your SL and PT. If you have Chart Trader turned on then the SL and PT will be displayed on the chart as well.

        In regards to the specific values of a tick, that is going to be different for every instrument. You will need to consider that when building your logic. If you want those numbers specifically than you should use CalculationMode.Price and then use the price you want as the other input parameter for the SL or PT. Similar to SetProfitTarget(CalculationMode.Price,1.2355). Otherwise, you may need to do some math in your logic to get the specific stop loss and profit target values that you want.

        Edit: Spelling and formatting
        Josh G.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by toughiee, Today, 12:04 AM
        0 responses
        2 views
        0 likes
        Last Post toughiee  
        Started by vdoan20, Yesterday, 08:30 PM
        0 responses
        7 views
        0 likes
        Last Post vdoan20
        by vdoan20
         
        Started by gupagoer, Yesterday, 07:42 PM
        0 responses
        9 views
        0 likes
        Last Post gupagoer  
        Started by Holligoly, Yesterday, 05:13 PM
        2 responses
        11 views
        0 likes
        Last Post Holligoly  
        Started by Raginpower, Yesterday, 01:53 PM
        0 responses
        14 views
        0 likes
        Last Post Raginpower  
        Working...
        X