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

Can you Cancel a Profit Target

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

    #16
    Yes Bruce that is certain. I generally do not watch my trades once I automate, but the distortion is certainly true, IF i wish to watch and the PT moves to 600 I can always cancel it manually. I would lose my stop but at the point that the Modification moves to 600 I am far enough away from entry should not need the stoploss order. I just use the stoploss as insurance incase something has a hicup on the chart I want a backup stop in place

    thanks

    Comment


      #17
      Hi, you can have more than one call to SetProfitTarget. Please read all of the documentation first:


      Notice the overload that takes a "FromEntrySignal". This can be used to target a specific entry order.

      SetProfitTarget(string fromEntrySignal, CalculationMode mode, double value)

      e.g.

      SetProfitTarget("MyLongEntry", CalculationMode.Ticks, 600);
      EnterLong("MyLongEntry");

      ...

      SetProfitTarget("MyShortEntry", CalculationMode.Ticks, 600);
      EnterShort("MyShortEntry");
      Chris L.NinjaTrader Customer Service

      Comment


        #18
        && (BarsSinceEntryExecution(0, "", 0) > 3)

        definitely NOT adhearing to this condition
        so had to tell from there

        I change all to MyLong and MyShort and also added a Long and ShortFlag bool

        Comment


          #19
          Just to be cliear where I am right now

          Backtesting with NO Modification to Profit Target all of my results show a Largest Winning Trade equal to the Profit Target default

          Backtesting wiit Modifications set to apply my results show a larger largest winning Trade and I have Many Profit results equal to the Profit Target default which would indicate that the Condition sets are being read as expected and some of the Profit Targets are trading at the default PT and some are trade with the PT moved to 600 out of reach

          LOOKS PERFECT

          but on live trading the Profit Target is always 600 on the first entry

          SHOULD THE SetProfitTarget default be located with the Enter Long part of the of the code

          Currently I have that in State.Configure as shown in the Help Guide you referred me to

          Thanks

          Comment


            #20
            Hi, my example above was a bit misleading because I placed the modification right above the entry order, which in your case would not be needed, you would need to call SetProfitTarget() at 600 ticks only when the condition to do so becomes true.
            Chris L.NinjaTrader Customer Service

            Comment


              #21
              Yes I have the condition and the SetProfitTarget() at 600 with the condition (I did know that part)

              ONCE I did that addtional conditions set to modity the SetProfitTarget is always 600 NOW with the Orignal Default located in the State.Configure region
              SetProfitTarget("Short ST",CalculationMode.Ticks, ProfitTargetTicks);

              NOW AS A TEST I moved that to the placement with the entryshort order

              which Now when Short sends the Correct NONE modified PT

              I am currently watching to see if the Condition Set to Mod to 600 ticks works as expected I May not find out today, the back test results do not indicate that the Short modification is working as expected

              Comment


                #22
                Chris I have determine thru backtest that with the Condition set that we have ONCE the PT is changed to 600 ticks it remains that way. I will have a PT exit on the first day of backtest and then never have another for 6 weeks

                So seems ONCE MyLongProfitTargetFlag becomes true it will never be false again


                && !MyLongProfitTargetFlag)
                {
                SetProfitTarget("Long ST", CalculationMode.Ticks, 600);/// this will update the existing order
                MyLongProfitTargetFlag = true;​


                I did try to create when Flat to have them both set back to false and also with and without reset on Profit targets back to default
                THAT STOP all modifications back to 600

                With only reset of bool to false had no effect there is only ONE PT at default, then all must be set to 600 ticks in backtest (which is what I see in live always sends immediately 600 ticks PT

                if (Position.MarketPosition == MarketPosition.Flat)

                {
                SetProfitTarget("Long ST",CalculationMode.Ticks, ProfitTargetTicks);
                MyLongProfitTargetFlag = false;
                SetProfitTarget("Short ST",CalculationMode.Ticks, ProfitTargetTicks);
                MyShortProfitTargetFlag = false;
                }


                with both the bool reset to false and the PT reset to default input of ProfitTargetTicks (not 600)

                This seems to fix the issues​

                Thanks for the help - I will update on live if anything malfunctions

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by AaronKoRn, Today, 09:49 PM
                0 responses
                6 views
                0 likes
                Last Post AaronKoRn  
                Started by carnitron, Today, 08:42 PM
                0 responses
                9 views
                0 likes
                Last Post carnitron  
                Started by strategist007, Today, 07:51 PM
                0 responses
                10 views
                0 likes
                Last Post strategist007  
                Started by StockTrader88, 03-06-2021, 08:58 AM
                44 responses
                3,977 views
                3 likes
                Last Post jhudas88  
                Started by rbeckmann05, Today, 06:48 PM
                0 responses
                9 views
                0 likes
                Last Post rbeckmann05  
                Working...
                X