Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Current Trade Position High Watermark Threshold and ...

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

    Current Trade Position High Watermark Threshold and ...

    Hi folks:

    How would I express in a strategy the following:

    1. Plot on the chart the highest amount of ticks/points/currency the current position has been positive during the life of the trade. When new highs are made, then it would adjust to display the new high watermark for the trade.

    2. When the current position reaches a threshold (the following does not apply until this threshold is reached) of X number of ticks/points/currency, then apply the following exit condition: When the position loses X percentage/ticks/point/currency from the current high watermark for the trade then exit the position.

    ***As the current high watermark changes then so would the condition to exit.



    @Koganam or others...

    Greg

    #2
    Originally posted by birdog View Post
    Hi folks:

    How would I express in a strategy the following:

    1. Plot on the chart the highest amount of ticks/points/currency the current position has been positive during the life of the trade. When new highs are made, then it would adjust to display the new high watermark for the trade.

    2. When the current position reaches a threshold (the following does not apply until this threshold is reached) of X number of ticks/points/currency, then apply the following exit condition: When the position loses X percentage/ticks/point/currency from the current high watermark for the trade then exit the position.

    ***As the current high watermark changes then so would the condition to exit.



    @Koganam or others...

    Greg
    Use OnExecution() to record your entry price (entryPrice, say).

    Assuming long, your gain on the trade is
    Code:
    double currentGain = Close[0] - entryPrice;
    The max gain on the trade is
    Code:
    maxGain = Math.Max(maxGain, currentGain);
    The rest of your code is a straightforward comparison to the threshold, calculating the exit price, and issuing the ext order at that price.

    Adjust as necessary, for the short side: currentGain will be the negative of what it would be for a long entry.
    Last edited by koganam; 10-12-2013, 02:28 PM.

    Comment


      #3
      Hey @koganam

      Thanks for the info...could you potentially elaborate on where the code should be placed. I can not seem to get it to work.

      Or, any additional info that might help crystallize for me.

      Just when you are able...

      Sorry.

      ;(

      Greg

      Comment


        #4
        Hi @koganam

        You probably have been tied up or I sent this while the NT servers were down before. If you have a chance sometime, could you elaborate a little on this. I can not seem to get it to work and compile.

        See your previous code snippet...

        Just when you might have a chance...thanks...

        Greg

        Comment


          #5
          @koganam

          I found a workaround to get it to do what I want just FYI.

          If you ever have time to elaborate on this more someday then I would still welcome it (either way)...

          Thanks for the help!



          Greg

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          649 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          370 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          109 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          573 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          576 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X