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

Profit target in a strategy

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

    Profit target in a strategy

    In the condition builder, I want to enter the value for the profit target as follows:

    If long, sell when the close 0 is lower than the low of highest bar
    If short, sell when the close 0 is higher than the low of the lowest bar.

    How?

    If not possible to do in condition builder, can you please give the code that i can just insert in the code of existing strategy. Thanks.

    #2
    Hi ju1234,

    Yes, you can create custom conditions taking you flat on the 'Conditions and Actions' screen of the wizard - http://www.ninjatrader-support.com/H...rdScreens.html

    Please illustrate your trading logic a bit more, so we can make recommendations on the realization.

    Thanks!
    BertrandNinjaTrader Customer Service

    Comment


      #3
      OK, now i have a simple strategy which has the condition stochastic cross over action enter long. Now to set a profit target on that long position i want to set in the "Profit target and stop price" screen of the wizard a condition which should exit my long position whenever subsequent to the long entry, the clocing price of the current bar closes below the low of the the bar which is highest since the long entry. Similar set for the short side.

      I know how to use the wizard but don't know how to construct these profit criteria.

      Specific instructions would be appreciated. Thanks.

      Comment


        #4
        ju1234,

        If you have a specific logic you want the profit trigger to hit at instead of just a certain amount of ticks or percentage from your entry price then you want to go back to your Conditions and Actions page and create the condition through a new Set. Put in your logic and then tell it to do an ExitLong().
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Thank you Josh. Here is the problem: I would choose price close of current bar on the left, choose < , on the right I am not sure what? How would i choose and "low of the highest high bar since long entry"? I am not even sure if it can be done through the wizard. Is there a code you can write for this whole thing that I can just add to my other strategy. Thanks.

          Comment


            #6
            Hi ju1234,

            Please take a look at this thread here, where a custom stop loss value was developed for use in the wizard - http://www.ninjatrader-support2.com/...ad.php?t=11609
            BertrandNinjaTrader Customer Service

            Comment


              #7
              I think this thread is perhpas not the correct one, i did not see anything about stop loss.

              Comment


                #8
                ju1234,

                It shows you logic on how to get highest high. You need to take it from there yourself. Add your own ExitLong or ExitShort action.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Thank you josh,

                  I know the "Highest High" but I am trying to figure out how I should write "the low of the bar which constitutes the highest high bar".

                  Low[0] < Low of Max(high,20)[0].

                  In this condition the "Max(High,20)[0]" component tells the strategy that in the last 20 bars the bar that is highest. I want the current bar to be less than the low of that bar. So please tell me how I can write the "low of " part of this condition.

                  Thank you and sorry if i am harping on the same question.

                  Comment


                    #10
                    You want to just use HighestBar() instead then. http://www.ninjatrader-support.com/H...ighestBar.html

                    That will give you a bar index that you can put into Low[].
                    Josh P.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by popecapllc, 08-09-2023, 07:42 PM
                    8 responses
                    1,339 views
                    0 likes
                    Last Post Johng22
                    by Johng22
                     
                    Started by ETFVoyageur, 04-30-2024, 02:04 PM
                    11 responses
                    99 views
                    0 likes
                    Last Post ETFVoyageur  
                    Started by bubblegum, 03-18-2024, 10:41 AM
                    3 responses
                    44 views
                    0 likes
                    Last Post vjsworld  
                    Started by JamesK1, Today, 02:48 PM
                    1 response
                    12 views
                    0 likes
                    Last Post JamesK1
                    by JamesK1
                     
                    Started by llanqui, Today, 03:51 PM
                    0 responses
                    10 views
                    0 likes
                    Last Post llanqui
                    by llanqui
                     
                    Working...
                    X