BreakEven & Trailing Profit: complete function

Forums ProRealTime English forum ProOrder support BreakEven & Trailing Profit: complete function

Viewing 15 posts - 46 through 60 (of 114 total)
  • #164055

    I made some changes, again. Goal is use of percentage, splitted long/short and working on different markets. That combo is tricky.

    2 users thanked author for this post.
    #164306

    By running the main code and testing with 1m bars is not working so good as some trades run super long back in time.

    #165005

    Hello Roberto,

    I am trying to understand your great code. I have the following 2 questions:

    1. SellPriceX = max(max(SellPriceX,SellPrice),q1)      What is the meaning of SellPriceX?
    2. ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent))      Should the ‘100’ not be ‘1’?

    Best regards,

    Dré

     

    #165009
    1. SellPriceX = max(max(SellPriceX,SellPrice),q1)      What is the meaning of SellPriceX?
      it makes sure that whatever the calculations are, the PRICE  at which the position is closed is NEVER less than the previous one
    2. ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent))      Should the ‘100’ not be ‘1’?
      yes, it should be 1, you can change it. I actually was reported by another user last year, but I always forgot to change it as it doesn’t affect calculations

     

     

    2 users thanked author for this post.
    #165134

    Hello Roberto,

    Thank you for your quick response. I understand the code now better.

    I have the following remarks:

    1.   r1 = ((PositionPrice – SrcL) * ProfitPerCent)   I think it should be:      r1 = PositionPrice – ((PositionPrice – SrcL) * ProfitPerCent)

    2. ExitPriceX should be inialized to 9999999 (ExitPriceX = 9999999) otherwise the ExitPrice will always be zero (0).

    Best regards,

    Dré

     

     

    #165141

    Well spotted DreaC, you are right for both glitches.

    R1 must mirror Q1 (in the opposite direction) and ExitPriceX must be like ExitPrice.

    Thank you for sharing with us.

     

     

    #165577

    Hi Roberto,

    Is there a way to set basepercent also to 0, with the result when the trailingstop kicks in and there is no progress followed by retracement, that the entryprice is the exitprice, so in the statistics it’s not a win?

     

     

    #165602

    You should try setting a STEP of 9999.

     

     

    #165637

    thnx it’s solved

    #165972

    Well spotted DreaC, you are right for both glitches.

    R1 must mirror Q1 (in the opposite direction) and ExitPriceX must be like ExitPrice.

    Thank you for sharing with us.

    Could you please post the correct code that should be in those lines?

    #165976

    There you go:

     

    2 users thanked author for this post.
    #165989

    Here’s a very minor mod, if you want to use % instead of points

    Thanks again Roberto for all your work on this!

    1 user thanked author for this post.
    #165993

    I would have written

    because you may be out of the market at that time

    #165994

    Hmm … I’d say that the trailing stop has an extremely low chance of starting if you’re not onmarket. 😁

    But it does make me think that perhaps it should be positionprice, to allow for cumulative orders ??

    #165995

    I personally struggle to fully understand Roberto’s code 🙂

    But from what I read the trailing stop is set up when you are not on market or when there is a direction switch. By the way I dont really understand why, but there must be a logic behind this!

     

     

     

     

Viewing 15 posts - 46 through 60 (of 114 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login