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 ghoul, Today, 06:02 PM
                          3 responses
                          13 views
                          0 likes
                          Last Post NinjaTrader_Manfred  
                          Started by jeronymite, 04-12-2024, 04:26 PM
                          3 responses
                          44 views
                          0 likes
                          Last Post jeronymite  
                          Started by Barry Milan, Yesterday, 10:35 PM
                          7 responses
                          20 views
                          0 likes
                          Last Post NinjaTrader_Manfred  
                          Started by AttiM, 02-14-2024, 05:20 PM
                          10 responses
                          180 views
                          0 likes
                          Last Post jeronymite  
                          Started by DanielSanMartin, Yesterday, 02:37 PM
                          2 responses
                          13 views
                          0 likes
                          Last Post DanielSanMartin  
                          Working...
                          X