BreakEven & Trailing Profit: complete function

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

Viewing 9 posts - 106 through 114 (of 114 total)
  • #201803

    Sorry for the delay, I’ll be back to you in a couple of days.

     

    #201842

    Hi Roberto.

    If i understand your code correct it moves limit and stolploss.

    Would you make a version with trailing limit. Where stoploss is not part of the code at all?

    #201883

    @SnorreDK

    This is the working strategy I created for testing:

    change values in lines 1-3, then lines 22-26, according to your preferences.

    Then post:

    • new settings
    • instrument and TF used

    so that I can test it.

     

    #202126

    Hi one thing I notice is that you are coding for the markets allowed exit price – how do you know that for a given market?

     

    IF y2 THEN                                                                 //Place pending STOP order when y2 > 0   (SHORT positions)
    ExitPrice = min(ExitPrice,PositionPrice (y2 * pipsize))     
    I have often when manually trading on charts been able to love a guaranteed stop (now in profit) and I can see on charts how far I can move it as it wont let you place it too close. Is there a way of coding for that (to absolutely lock in profits) – I think would have to start with guaranteed stops but thats ok.
    Lastly – the above post which has a strategy – if I wanted to use my own entry – am I correct that I would just omit lines 1 – 10? The rest seems to be an exit strategy
    #202299

    As to your last question, YES, just replace the first ten lines with your code, as the trailing stop snippet is not tied to any code (provided you name your variables differently from mine).

    As to the first part of your questions, will you please post a drawing with an example of what you mean. Thanks 🙂

     

    #202922

    I thought I had replied. Essentially with guaranteed stops there is a high ‘gap’ you cant set it in – and with ‘standard’ it still applies but is smaller. I have had issues with trailing stops (or if trailing stops are protecting profit) with the algo being stopped as its tried to place an ‘illegal order’. On charts I can see where I can place it and it wont let me move it to anywhere not allowed as per below. Is there a way of coding for this? ie knowing for that market what the closest I can go is? I think your algo above kind of does this?

    #203200

    When I trade manually (in this case IG) there is a minimum distance for stop loss- higher if guaranteed is selected. Sometimes my algos fail as they try to set it too close to current price. The number seems to be dynamic and is certainly different on each market. Is there a way to determine and code for this?

    #203202

    There’s no way to know when it changes. You must know it when you start your strategy and can’t change it while it’s running.

    You may want to add some points to (try to) accomodate for those increases.

     

    #203213

    @ausrod,

    As far as I can tell this is related to the changing spread. Thus, when between USA Stock market’s closing and  midnight (22:00 to 00:00 Amsterdam as long as daylight savings is equal to USA (which is not so the upcoming week)) … spread is increased to crazy numbers (e.g. 5 for NasDaq). This can be incorporated in the program, so you don’t need to deal with that distance (which is what it comes down to) throughout. Example :

    This in itself is to be incorporated in the stop distance.
    … which I don’t do myself with the below as the result (Strategy stopped).
    N.b.: I merely feel this is an anomaly at IG’s because the content of the message – 289 points – can’t be correct anyway, or I just don’t get it. What solves it, is not trading during that hour (only counts for 22:00 – 23:00 Amsterdam as after that it is closed for 1 hour), but net this is not worth it because it is a volatile time (earnings) and good trades may occur.

    Only once in a while this error occurs and only during that time, BUT have your distance correct in the first place.

    Important : When the Strategy is run in Demo (account) this goes far more often wrong (say 10 times more). So this is a bit misleading and not so comfortable.

Viewing 9 posts - 106 through 114 (of 114 total)

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