loss reduction based on profit

Forums ProRealTime English forum ProOrder support loss reduction based on profit

  • This topic has 3 replies, 3 voices, and was last updated 2 days ago by avatarIván.
Viewing 4 posts - 1 through 4 (of 4 total)
  • #245235
    kt

    Hi Expert,

    As shown in the attached trades performance chart, the losses are significantly higher than the average profits. I attempted to cut losses by converging the stop loss based on past gains with the code below, hope that the system will converge eventually with losses now being “normalized” based on profits. However, this code I wrote didn’t work, the trades performance went negative right away.  Any ideas? Thank you.

    / /code

    n = 1
    for k = 1 to 50 do
    if strategyprofit[k] > 0 then
    sloss = (strategyprofit[k] + strategyprofit[k+1])/n
    n = n + 1
    endif
    next

    set stop $loss sloss

    // end

     

    #245237
    kt

    found a problem but still haven’t resolved the issue, i.e., the loss is significant higher than the average gain trades.

    Updated the code to:

    / /code

    //Ensure sufficient data set before starting

    m = 1
    for j = 51 to 100 do
    if strategyprofit[j] > 0 then
    firstset = (strategyprofit[j] + strategyprofit[j+1])/m
    m = m + 1
    endif
    next

    if firstset <> 0 then

    n = 1
    for k = 1 to 50 do
    if strategyprofit[k] > 0 then
    sloss = (strategyprofit[k] + strategyprofit[k+1])/n
    n = n + 1
    endif
    next

    endif

    set stop $loss sloss

    // end

    #245266

    Bear in mind that strategyprofit[n] does not return the strategyprofit of the nth trade exixted, but the value returned by strategyprofit in the nth prior bar.

    So, when a trade is closed strategyprofit will change and will remain the same until the next trade will close. So it may well happen that for the next 100 bars it’s the same value and those are the data you are scanning.

     

     

     

    #245302

    Another thing I suggest before continuing down this path is to study the Maximum Adverse Excursions (MAE). This is what will allow you to find the optimal Stop Loss point.

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

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