TRYING TO MAKE POSITIONSIZE DEPENDING OF STRATEGYPROFIT

Forums ProRealTime English forum ProOrder support TRYING TO MAKE POSITIONSIZE DEPENDING OF STRATEGYPROFIT

Viewing 15 posts - 1 through 15 (of 17 total)
  • #72452

    Hi,

    I want to make the positionsize depending of the strategyprofit over/under its average. With something like this:

    It doesn´t work. Trying different ways and nothing, I am getting a little crazy about it. Anybody knows why?

     

    #72453

    Could it be that when you start strategy profit = zero and you then comparing that to an average of zero?

    1 user thanked author for this post.
    #72455

    Maybe you are right but in that case shouldn´t it affect only the first 5000 candles (the periods of the avegarage)

    Anyway I will try to take that in consideration and will see

    Thanks Vonasi

    #72459
    #72460

    Try adding

    to your strategy, provided you have PreLoaded enough bars.

    I tried and it always shows the same value, so I guess it is not allowed, though syntax is correct!

     

    #72463

    I put this in a code and it gave me graph lines.

     

    #72464

    Yes, I saw it before asking and I didn´t find nothing to help me. But I see now in the replays a couple of people comment that it doens´t seem to work, Nicholas says it will take it to the PRT people. This is more than two years ago, I guess it doesn´t work yet, it´s a shame it really looked like a nice way to avoid big losses with systems go bust

    I found this topic that contains other ways to get the same idea, just seemed more complicated, I liked the simplicity of the strategyprofit average 🙁

    https://www.prorealcode.com/topic/position-size-management-performance-based-increases/

     

    #72467

    Try my code in post #72463. It appears the issue is having StrategyProfit in the average calculation. If it is a variable it works.

    #72468

    So your code should be:

    Not tested yet.

    1 user thanked author for this post.
    #72469

    You should be aware that StrategyProfit is only updated when positions are closed so if you have an accumulating positions strategy then if it starts with the equity curve above the average and then you keep adding to a losing position it will add positionsizes of 2 continually as it will not be aware that your floating equity curve is below the average of the equity curve.

    #72470

    I had the same idea about the variables and was trying… I had to do it a couple of times because I thought I did something wrong… no operations at all!!! It seems something is really wrong with this thing of the average/strategyprofit

    #72471

    No accumulated positions in this system

    #72472

    That is strange because I just threw it into a rubbish strategy and it works for me. Graphed line is positionsize.

    #72475

    …and the strategyprofit and strategyprofit average

    #72478

    Yes, Vonasi, you are right, using your code it seems to work.

    I think I have nailed where is the key, is using a variable in the subject of the average so…

    so we don´t need the average variable, just this seems to work…

    Strange but the important thing is that the problem is solved

    Thank you

     

    1 user thanked author for this post.
Viewing 15 posts - 1 through 15 (of 17 total)

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