Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

75% of Profit Target - Move stop?

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

    75% of Profit Target - Move stop?

    Hi,

    Is there a way of moving my stop when the open profit gets to at least 75% towards the set Profit Target?

    Thanks,

    Michael

    #2
    Sure Michael, you would need to add code for this change referencing the price needed to activate this stop change. This can be calculated by working with Position.AvgPrice (your entry) and your set profit target value.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Stop movement

      This code moves a stop loss for a long position from 20 ticks below entry to the low pivot (Fractal) once it is in profit 0.5 points. When I run the strategy only the low pivot stoploss level gets recognised and executed. Basic stuff but I really cannot figure out why the first line profit logic does not get recognised. Any ideas?



      if ((GetCurrentBid() - Position.AvgPrice) < 0.50);
      {
      SetStopLoss (
      "LongFractal",CalculationMode.Ticks,20,false);
      SetProfitTarget (
      "LongFractal",CalculationMode.Ticks,500);
      }
        
       
       
      if ((GetCurrentBid() - Position.AvgPrice) >= 0.50);
       
      {
      SetStopLoss (
      "LongFractal",CalculationMode.Price,(Low[lowPivot] - 0.02),false);
      //SetProfitTarget ("ShortFractal",CalculationMode.Ticks,500);
      }

      Comment


        #4
        everington_f, what trace orders output would you see for this order modification then?

        BertrandNinjaTrader Customer Service

        Comment


          #5
          I have now set TraceOrders to true, and will let you know Bertrand. Is there an obvious problem with the code logic that you can see?

          Regards and thx

          Comment


            #6
            It seems that it takes the price value as being - 0.2.... when should be (Position.Avg - 0.2)


            19.07.2011 08:25:00 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='DivLongFractal' Mode=Price Value=-0.2 Currency=0 Simulated=False

            19.07.2011 08:25:00 Entered internal SetStopTarget() method: Type=Target FromEntrySignal='DivLongFractal' Mode=Ticks Value=500 Currency=0 Simulated=False

            Comment


              #7
              Hi Bertrand,

              I have algo, which wants to know orderprofit of each order and then depending on this it moves the stop. Can you please let me know how to do it. I did not find any method to check orderprofit of each order.

              Earlier I used some other lanaguge, where I used group each type of order depending on ordercomment. I used check each order status using order comment. Is there anything available similar to this in NT.

              My algo is hugely successful in fx, I want to replicate in futures. I am using NT 7 for futures, Since I think it is the best. But I want to port same algo. It goes something like this.

              foreach order where ordercomment is equal to "probe"
              select order ()
              If (slectedorder.OrderProfit() > x)
              then send "stone"


              Stone here is pyramid order. Please let me know following
              #1 Access order using ordercomment
              #2 moving stops of each order
              #3 Knowing profit or loss of each order.

              This would really help aunch my real trades soon next week. Please help.

              thx
              Nagendra

              Comment


                #8
                Hi everington_f, it looks like you need to debug the Low[LowPivot] value you calculate, as the Price mode call does not seem to evaluate to a price level you intend to use. I would calculate the stop value needed separately and use it then...
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  I have sorted the problem. Just needed extra logic. Danke Bertrand. Gruesse aus Zurich

                  Comment


                    #10
                    Ok, glad to hear you got it worked out - beste gruesse nach zuerich!
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      Nagendra, great to hear about your successful algo - what methods would you use in NT for your order management? If you work with the Set() methods for stoploss and profittarget we have a sample up showing how to add those to a collection for reference :

                      BertrandNinjaTrader Customer Service

                      Comment


                        #12
                        Hi Bertrand,

                        I want to set dynamic stop loss per order basis, in different time frames. For example. 30 minute, 1 hr, 4 hr and 1 d. There will be different orders in all these time frame, and each order will have different stops. Please let me know about how to set stop differently for different order.

                        thx
                        Nagendra

                        Comment


                          #13
                          Nagendra, this will depend how you plan to structure the strategy - are you planning to code this up as a MultiSeries script or run a strategy instance per timeframe needed?

                          For most and more precise control you would want to work with the IOrder objects:



                          A complete example how to work in OnOrderUpdate / OnExecution with those is located here :

                          The OnOrderUpdate() and OnExecution() methods are reserved for experienced programmers. Instead of using Set() methods to submit stop-loss and profit target orders, you can submit and update them manually through the use of IOrder and IExecution objects in the OnOrderUpdate() and OnExecution() methods. The OnOrderUpdate()
                          BertrandNinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by janefoster, Yesterday, 11:50 PM
                          0 responses
                          2 views
                          0 likes
                          Last Post janefoster  
                          Started by kaywai, 07-13-2024, 09:05 PM
                          3 responses
                          25 views
                          0 likes
                          Last Post kaywai
                          by kaywai
                           
                          Started by stafe, Yesterday, 01:32 PM
                          2 responses
                          19 views
                          0 likes
                          Last Post stafe
                          by stafe
                           
                          Started by Jakub, Yesterday, 11:06 AM
                          2 responses
                          24 views
                          0 likes
                          Last Post ashpang
                          by ashpang
                           
                          Started by MatthewLesko, 05-21-2021, 09:37 PM
                          4 responses
                          167 views
                          0 likes
                          Last Post Mahmad1323  
                          Working...
                          X