Strange behaviour MFE Trailing Stop

Forums ProRealTime English forum ProOrder support Strange behaviour MFE Trailing Stop

Tagged: ,

Viewing 3 posts - 1 through 3 (of 3 total)
  • #85515

    When playing around with a MFE Trailing Stop, I came across this very strange problem.

    On the 9th of may 2018 at 9:21 on the Germany 30 Cash (€1)(3min) a Long trade is entered for a price of 12,920.9. At 11:39 a first temporary top is reached at 12,960.7 (closing price). A difference of 39.8 points.

    In my code the MFE Trailing Stop is set to be activated after 100 points. Despite the fact that the top was not higher than 39.8 points the Long trade will be sold at 14:03.

    When I changed the parameter of the priceexit I noticed the following.

    Formula: priceexit = MAXPRICE-trailingstop*pointsize*0.63

    When the value is between 0.63 and 0.70 the problem will arise and the Long trade will be sold at 14:03.

    But when this value is lower than 0.63 or higher than 0.71, the MFE Trailing Stop will work normal again. In those instances the system will sell the Long trade on the 10th of may, after 10:00, when a top of 110.90 points is reached.

    This seems like a very strange and range specific problem and I don’t know what is causing it. It also only seems to happen at the 9th of may. On the 8th of june, for example, a similar Long trade is activated, but there don’t seem to be any problems with the MFE Trailing Stop.

    If anyone could explain the reason behind this problem (something in the code?), I would be very grateful.

    1 user thanked author for this post.
    #85542

    There are two major logical errors to correct:

    1 – as from my pic, when the trade on May 9th is opened PRICEEXIT still retains the previous value because the second previous price on May 7th was not properly closed, but automatically closed when a new one was entered on the 8th, so the status ONMARKET has always been true and lines 72-73 have NEVER been executed (my suggestion is to add a condition at line 58 to check OnMarket status:

    2 – you trail stops when LONGONMARKET (lines 77-82) but not when SHORTONMARKET.

    I also suggest adding these invaluable lines (only 5 variables for real accounts, unlimited for demo ones?) to debug your code using your dearest friend GRAPH:

     

    2 users thanked author for this post.
    #85549

    The trade opened on the 8th was obviously opposite to the one opened on the 7th.

Viewing 3 posts - 1 through 3 (of 3 total)

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