Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

A strategy with multiple profit targets and the effect on commissions

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

    #16
    Originally posted by koganam View Post
    Orders issued by Set() methods cannot be named: they use the defaults. Check again.
    Ninja,

    I am not naming Orders in Set..... My intention is only to link Set.... to Orders that were already named in Enter... methods.

    Syntax
    SetTrailStop(double currency)
    SetTrailStop(double currency, bool simulated)
    SetTrailStop(CalculationMode mode, double value)
    SetTrailStop(string fromEntrySignal, CalculationMode mode, double value, bool simulated)


    Idea is to use Managed Approach but targets and stop loss are fixed amounts calculated once at start of trade and then forgotten.

    And, some Linkage is definitely being done because I do see different exit prices being associated with different "Entry Names". However, linkages seem to be incorrect in Exit names as all exits are showing up as "profit target"....


    Also, what exactly does the simulated flag control? Whether I give false or true, output is same. Documentation says "If true, will simulate the stop order and submit as market once triggered"

    which I interpret to mean that if I set it to true, it will convert SL orders into regular market orders before execution.

    Comment


      #17
      Originally posted by cdjindia View Post
      Ninja,

      I am not naming Orders in Set..... My intention is only to link Set.... to Orders that were already named in Enter... methods.

      Syntax
      SetTrailStop(double currency)
      SetTrailStop(double currency, bool simulated)
      SetTrailStop(CalculationMode mode, double value)
      SetTrailStop(string fromEntrySignal, CalculationMode mode, double value, bool simulated)


      Idea is to use Managed Approach but targets and stop loss are fixed amounts calculated once at start of trade and then forgotten.

      And, some Linkage is definitely being done because I do see different exit prices being associated with different "Entry Names". However, linkages seem to be incorrect in Exit names as all exits are showing up as "profit target"....


      Also, what exactly does the simulated flag control? Whether I give false or true, output is same. Documentation says "If true, will simulate the stop order and submit as market once triggered"

      which I interpret to mean that if I set it to true, it will convert SL orders into regular market orders before execution.
      Exit orders will only show up with names, if they are named: not by reference to an entry signal.

      The simulated flag just means that the Stop Loss shows up marked on your chart, but is not actually submitted to the exchange until the price is hit, at which time a market order is issued to exit the position. This is NT's paen to those who insist that there is some evil cabal that can run their stops: so NT effectively hides the stop from the market, until the stop would have been triggered, if it were actually posted in the market.

      Comment


        #18


        I have absolutely no problems with default namings. My problem is that hit to stop loss is also being named as a "Profit Target". I can't attach this as unedited back test report to convince even a school kid to buy my strategy.

        Next, notice that one of the trade leg is getting closed within 1 bar itself

        Third, the exit price mentioned (6060) is totally out of the blue. Price of 6060 was never reached by stock in entire month.

        Here are few lines of 1 min data that was imported into Ninja.

        20130208 122500;5963.5498;5965.0000;5963.5498;5964.0000;143 00;0
        20130208 122600;5964.0000;5964.1499;5963.0000;5963.0000;330 0;0
        20130208 122700;5963.0000;5963.7002;5963.0000;5963.5498;545 0;0
        20130208 122800;5963.5498;5963.5498;5959.0000;5959.1001;253 00;0
        20130208 122900;5960.0000;5960.0000;5957.1001;5957.3999;403 50;0
        20130208 123000;5957.7500;5961.0000;5957.2500;5959.5498;200 50;0
        20130208 123100;5959.7002;5960.8999;5957.7998;5957.8999;120 00;0
        20130208 123200;5958.1001;5959.5498;5957.2002;5957.2002;108 00;0
        20130208 123300;5957.1001;5957.1001;5955.0000;5957.0000;660 50;0
        20130208 123400;5956.8501;5959.5000;5956.7998;5958.0000;169 00;0
        .....
        20130208 151800;5933.9502;5933.9502;5930.0000;5930.0000;118 550;0
        20130208 151900;5930.0000;5930.0000;5918.5000;5921.0000;409 600;0
        20130208 152000;5920.8999;5922.0000;5918.6001;5918.6001;104 200;0
        20130208 152100;5919.0498;5919.0498;5910.0000;5910.6499;229 350;0
        20130208 152200;5910.4502;5911.0000;5905.2500;5906.5498;170 800;0
        20130208 152300;5906.5000;5906.5000;5900.0000;5903.9502;243 200;0
        20130208 152400;5904.0000;5908.0000;5901.9502;5908.0000;140 300;0
        20130208 152500;5907.9502;5911.4502;5907.0000;5911.4502;171 400;0
        20130208 152600;5911.4502;5916.5000;5911.4502;5914.1499;173 900;0
        20130208 152700;5914.2002;5915.7500;5912.3999;5913.0000;902 00;0
        20130208 152800;5912.8501;5914.9502;5911.4502;5914.5498;110 450;0

        Comment


          #19
          Originally posted by cdjindia View Post


          I have absolutely no problems with default namings. My problem is that hit to stop loss is also being named as a "Profit Target". I can't attach this as unedited back test report to convince even a school kid to buy my strategy.

          Next, notice that one of the trade leg is getting closed within 1 bar itself

          Third, the exit price mentioned (6060) is totally out of the blue. Price of 6060 was never reached by stock in entire month.

          Here are few lines of 1 min data that was imported into Ninja.

          20130208 122500;5963.5498;5965.0000;5963.5498;5964.0000;143 00;0
          20130208 122600;5964.0000;5964.1499;5963.0000;5963.0000;330 0;0
          20130208 122700;5963.0000;5963.7002;5963.0000;5963.5498;545 0;0
          20130208 122800;5963.5498;5963.5498;5959.0000;5959.1001;253 00;0
          20130208 122900;5960.0000;5960.0000;5957.1001;5957.3999;403 50;0
          20130208 123000;5957.7500;5961.0000;5957.2500;5959.5498;200 50;0
          20130208 123100;5959.7002;5960.8999;5957.7998;5957.8999;120 00;0
          20130208 123200;5958.1001;5959.5498;5957.2002;5957.2002;108 00;0
          20130208 123300;5957.1001;5957.1001;5955.0000;5957.0000;660 50;0
          20130208 123400;5956.8501;5959.5000;5956.7998;5958.0000;169 00;0
          .....
          20130208 151800;5933.9502;5933.9502;5930.0000;5930.0000;118 550;0
          20130208 151900;5930.0000;5930.0000;5918.5000;5921.0000;409 600;0
          20130208 152000;5920.8999;5922.0000;5918.6001;5918.6001;104 200;0
          20130208 152100;5919.0498;5919.0498;5910.0000;5910.6499;229 350;0
          20130208 152200;5910.4502;5911.0000;5905.2500;5906.5498;170 800;0
          20130208 152300;5906.5000;5906.5000;5900.0000;5903.9502;243 200;0
          20130208 152400;5904.0000;5908.0000;5901.9502;5908.0000;140 300;0
          20130208 152500;5907.9502;5911.4502;5907.0000;5911.4502;171 400;0
          20130208 152600;5911.4502;5916.5000;5911.4502;5914.1499;173 900;0
          20130208 152700;5914.2002;5915.7500;5912.3999;5913.0000;902 00;0
          20130208 152800;5912.8501;5914.9502;5911.4502;5914.5498;110 450;0
          I did ask you to look again at your code. At that time, it was on general principles, because I was sure that you had a code snafu.

          Now that I look at the code, this does not look kosher. One of your targets must be misplaced, just by how they are being calculated.
          Code:
          SetProfitTarget("S1", CalculationMode.Price, SellStop - TgtDistance);
          SetProfitTarget("S2", CalculationMode.Price, SellStop + 2 * TgtDistance);
          You should also probably reexamine your CalculationMode. Are you sure that price mode is really what you should be using? Hard to say without seeing how you are calculating "SellStop".

          You may want to Print() some values to the Output Window, to be sure that what you are getting is really what you intend.
          Last edited by koganam; 01-02-2014, 05:28 PM.

          Comment


            #20
            Originally posted by koganam View Post
            I did ask you to look again at your code. At that time, it was on general principles, because I was sure that you had a code snafu.

            Now that I look at the code, this does not look kosher. One of your targets must be misplaced, just by how they are being calculated.
            Code:
            SetProfitTarget("S1", CalculationMode.Price, SellStop - TgtDistance);
            SetProfitTarget("S2", CalculationMode.Price, SellStop + 2 * TgtDistance);
            You should also probably reexamine your CalculationMode. Are you sure that price mode is really what you should be using? Hard to say without seeing how you are calculating "SellStop"..
            Koganam,

            Very nicely pointed out !!!... "S2" had + instead of -.

            With that + replaced, trades stay alive for lot more bars and exit prices seem to be more realistic. Sellstop is simply Low[0] - 1.

            Calculation mode at the moment are just an experiment. I have no idea what real version will use.

            CalculationMode.Percent, I understand.
            CalculationMode.Tick I don't get and documentation is non-existent on that.

            Calculationmode.Price is used because I do want fixed price target relative to the entry price (or buy/sell stop). Stop losses are meant to be fixed too and documentation clearly says I can either use SetStopLoss or SetTrailStop but not both together.

            Still the biggest problem that remains is that all the exits are named "Profit Target" only whether trade is actually in profit or in loss.

            Comment


              #21
              Originally posted by cdjindia View Post
              Koganam,

              Very nicely pointed out !!!... "S2" had + instead of -.

              With that + replaced, trades stay alive for lot more bars and exit prices seem to be more realistic. Sellstop is simply Low[0] - 1.

              Calculation mode at the moment are just an experiment. I have no idea what real version will use.

              CalculationMode.Percent, I understand.
              CalculationMode.Tick I don't get and documentation is non-existent on that.

              Calculationmode.Price is used because I do want fixed price target relative to the entry price (or buy/sell stop). Stop losses are meant to be fixed too and documentation clearly says I can either use SetStopLoss or SetTrailStop but not both together.

              Still the biggest problem that remains is that all the exits are named "Profit Target" only whether trade is actually in profit or in loss.
              I would think that the problem arises then from your CalculationMode. You really do want to Print() values to verify that what you are seeing is what you intend.

              CalculationMode.Price has been completely misunderstood. CalculationMode.Price is NOT relative to ANYTHING (other than the trivial zero price): it is absolute as a statement of an exit price. I do not understand why you think that CalculationMode.Ticks is not documented: it seems pretty clear to me.

              You are also using SetTrailStop() with CalculationMode.Price, when the literature specifically states that that mode is "irrelevant for trail stops", as is rather clear when one understands that CalculationMode.Price is an absolute price. Try rewriting your code in line with the valid options. (Just because the post reads snarky, and that it not my intention).

              Comment


                #22
                koganam

                I do not understand why you think that CalculationMode.Ticks is not documented: it seems pretty clear to me.
                What exactly does tick mean?

                Even in general usage, the word "tick" is so overloaded with so many meanings that its hard to know what is meant just by the word itself and real meaning is more apparent from the context.

                Particularly, in the trading world, it gets worse. In commodity market, it is minimum unit of price movement. In data world, it is one snapshot of data and on and on ....

                At the start of trade, I want my trail stop to be a certain absolute fixed units away (gap) from the entry and then as trade progresses and price moves, I want trail to move to maintain that gap, that distance. The function that I would understand would ask me to give two numbers. This function with only 1 number leaves me confused.

                I modified the function to read as

                SetTrailStop("S1", CalculationMode.Tick, SLDistance, false);

                where SLDistance is a parameter and when it is set to 3500, one short trade closed at $ 22.00 profit (entry price 5957 - exit price 5935)
                Last edited by cdjindia; 01-03-2014, 09:01 AM.

                Comment


                  #23
                  Originally posted by cdjindia View Post
                  koganam



                  What exactly does tick mean?

                  Even in general usage, the word "tick" is so overloaded with so many meanings that its hard to know what is meant just by the word itself and real meaning is more apparent from the context.

                  Particularly, in the trading world, it gets worse. In commodity market, it is minimum unit of price movement. In data world, it is one snapshot of data and on and on ....

                  At the start of trade, I want my trail stop to be a certain absolute fixed units away (gap) from the entry and then as trade progresses and price moves, I want trail to move to maintain that gap, that distance. The function that I would understand would ask me to give two numbers. This function with only 1 number leaves me confused.

                  I modified the function to read as

                  SetTrailStop("S1", CalculationMode.Tick, SLDistance, false);

                  where SLDistance is a parameter and when it is set to 3500, one short trade closed at loss of $ 22.00 profit (entry price 5957 - exit price 5935)
                  Ticks is being used in the context of price movement/offset, as the function is called Set(ting)TrailStop, so to me it immediately meant the number of ticks of price movement, not the number of trades. However, I must say that your questions do help me see why it could be unclear.

                  5957 - 5935 = 22

                  Without knowing what instrument you are using and what the TickSize of the instrument is, and what quantity, I cannot tell how that translates into $22.00.

                  Your statement means a Trailing Stop of 3500 ticks, placed initially that far from the entry, and moved everytime there is a 1-tick move in a favorable direction and not moved otherwise (stated only for clarity and completeness: I am sure you already knew that). It seems to me that your stopped was being moved, and then got triggered on a reversal.

                  Look in the log: there should be plenty of information there as to the progress of your Trailing Stop during the trade. You can get even more information if you use the TraceOrders directive.

                  Other than that, and indeed in conjunction with it, I would use Print() statements to track the values of interest, and verify that they are behaving as you intend.

                  Comment


                    #24
                    Originally posted by koganam View Post
                    Ticks is being used in the context of price movement/offset, as the function is called Set(ting)TrailStop, so to me it immediately meant the number of ticks of price movement, not the number of trades. However, I must say that your questions do help me see why it could be unclear.

                    5957 - 5935 = 22

                    Without knowing what instrument you are using and what the TickSize of the instrument is, and what quantity, I cannot tell how that translates into $22.00.

                    Your statement means a Trailing Stop of 3500 ticks, placed initially that far from the entry, and moved everytime there is a 1-tick move in a favorable direction and not moved otherwise (stated only for clarity and completeness: I am sure you already knew that). It seems to me that your stopped was being moved, and then got triggered on a reversal.

                    Look in the log: there should be plenty of information there as to the progress of your Trailing Stop during the trade. You can get even more information if you use the TraceOrders directive.

                    Other than that, and indeed in conjunction with it, I would use Print() statements to track the values of interest, and verify that they are behaving as you intend.
                    This post of yours is probably the best one to highlight the confusion.

                    I was thinking Tick as being what you see in drop down labelled "Type" under Category "Period" on "Data Series" dialog box which opens when you click File->Chart.

                    With this, I was just failing to understand how any number of ticks can be used to decide anything related to price.

                    Just for fun, NT7 has 3 properties TickSize, TickCount, TotalTicks and I am 100% sure that they don't all mean the same.

                    Just for fun, I searched for word tick in NT7 help and its a Ticking minefield. No pun intended. Just seeing all those highlighted ticks in help makes me feel that my room is full of summer-time deer ticks and the damn clock is ticking well past the dinner time.

                    Anyways, coming back to our trading world, I added following statement
                    Code:
                    Print("The ticksize of this instrument is " + TickSize.ToString());
                    to get result as

                    The ticksize of this instrument is 0.01
                    So, this Calculation Mode tick thing is 1/100th of the Price in this case. Since each instrument can have different values, I'd rather rely on price. So, is there a safe function that can reliably convert from price to what SetTrailStop function wants.

                    I certainly do not want to think in terms of ticks while setting stop losses. I want to specify SL in same manner as what Ninja shows in Open, High, Low, Close.

                    I need a reliable method that will enable me to always work in the price units. I don't think in terms of paisa and neither do any of my traders or trader client. If I want stop loss at 5 paisa. I am happy to give Rs. 0.05.

                    At this moment, I do not even know how this will change in forex and commodities.

                    Comment


                      #25
                      Solved it;

                      SetTrailStop("S1", CalculationMode.Ticks, SLDistance / TickSize, false);

                      Comment


                        #26
                        Originally posted by cdjindia View Post
                        Solved it;

                        SetTrailStop("S1", CalculationMode.Ticks, SLDistance / TickSize, false);
                        So, is everything tickety-boo now?

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        639 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        366 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        107 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        569 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        572 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X