• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order with a StopLoss and ProfitTarget

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

    Order with a StopLoss and ProfitTarget

    Greetings,

    I'm new to NT8, could anybody teach me how to make a simple strategy placing a market order with a StopLoss at the certain price below the buying price and a ProfitTarget at the certain price above the buying price, PLEASE!?

    I'm currently using one made by Strategy Builder and it put

    SetProfitTarget(@"", CalculationMode.Currency, PT);
    SetStopLoss("", CalculationMode.Currency, SL);

    within the State == State.Configure if clause.

    Will that do the trick I wish for or it's something totally different!?

    Thank you very VERY much!!!
    Last edited by YoutingChu; 04-24-2018, 02:11 AM.

    #2
    Hello

    You must to the following :

    1- In OnBarUpdate, check that this.Historical == false

    2- When this.Historical == false then :

    3- Use this.EnterLong() or this.EnterShort() functions with a custom signal name (ex : "MySignalName")

    4- Use this.SetProfitTarget() and this.SetStopLoss() with the previously defined signal name

    I hope that this helps !

    Comment


      #3
      Will that condition stop me from optimizing the strategy!?

      Comment


        #4
        Hello YoutingChu,
        Thanks for your post.

        Is your goal to set the Stop Loss and Profit Target from the strategies parameters before you start the strategy, or is your goal for the Stop Loss and Profit target to be a dynamic value eg. always 5 ticks above/below the close ?

        Will that condition stop me from optimizing the strategy!?
        You are correct. If your strategy is not processing historical data you will not be able to backtest or optimize the strategy.
        Last edited by NinjaTrader_JoshG; 04-25-2018, 09:05 AM.
        JoshNinjaTrader Customer Service

        Comment


          #5
          I would like it to be parameters where I can set up before I run the strategy.
          Maybe I should say, I need it to be parameters so I could optimize it!
          And I'm facing a weird problem too.
          No matter how big I set my StopLoss, it ALWAYS exit my order at the same price I enter it!!!
          On the other hand, it NEVER exit my order no matter how small I set my ProfitTarget!
          It was like to whole parameter thing is useless!!!
          PLEASE tell me what should I do!
          Thank you very VERY much!!!
          Last edited by YoutingChu; 04-24-2018, 07:41 PM.

          Comment


            #6
            Hello YoutingChu,
            Because the Strategy Builder will put SetStopLoss and SetProfitTarget inside State.Configure you would need to use one of the other Stop Order methods to optimize those values. Otherwise, you will need to unlock the strategy and put your SetStopLoss and SetProfitTarget methods elsewhere.
            JoshNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by razeus, Today, 12:00 PM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by kitwit, Today, 09:47 AM
            5 responses
            20 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by guidoisot, Today, 11:17 AM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_PatrickG  
            Started by razeus, Today, 10:11 AM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Jim  
            Started by tonynt, Today, 10:18 AM
            5 responses
            16 views
            0 likes
            Last Post tonynt
            by tonynt
             
            Working...
            X