TRYING TO MAKE POSITIONSIZE DEPENDING OF STRATEGYPROFIT
Forums › ProRealTime English forum › ProOrder support › TRYING TO MAKE POSITIONSIZE DEPENDING OF STRATEGYPROFIT
- This topic has 16 replies, 4 voices, and was last updated 7 years ago by
GraHal.
-
-
06/06/2018 at 11:30 AM #72452
Hi,
I want to make the positionsize depending of the strategyprofit over/under its average. With something like this:
12345IF STRATEGYPROFIT>AVERAGE[5000](STRATEGYPROFIT) THENPOSITIONSIZE = 2ELSEPOSITIONSIZE = 1ENDIFIt doesn´t work. Trying different ways and nothing, I am getting a little crazy about it. Anybody knows why?
06/06/2018 at 11:44 AM #72453Could 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.
06/06/2018 at 11:49 AM #72455Maybe 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
06/06/2018 at 11:58 AM #72459Have you seen this:
https://www.prorealcode.com/blog/trading-strategy-profit-curve/
06/06/2018 at 11:59 AM #72460Try adding
12graph strategyprofitgraph average[5000](strategyprofit)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!
06/06/2018 at 12:11 PM #7246306/06/2018 at 12:12 PM #72464Yes, 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/
06/06/2018 at 12:18 PM #7246706/06/2018 at 12:20 PM #72468So your code should be:
12345678sp = strategyprofitspave = Average[5000](sp)IF STRATEGYPROFIT > spave THENPOSITIONSIZE = 2ELSEPOSITIONSIZE = 1ENDIFNot tested yet.
1 user thanked author for this post.
06/06/2018 at 12:25 PM #72469You 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.
06/06/2018 at 12:33 PM #72470I 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
06/06/2018 at 12:34 PM #72471No accumulated positions in this system
06/06/2018 at 12:42 PM #7247206/06/2018 at 12:45 PM #7247506/06/2018 at 1:00 PM #72478Yes, 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…
123Average[5000](strategyprofit) --> NO workAverage[5000](sp) --> YES workso we don´t need the average variable, just this seems to work…
1234567sp = StrategyProfitIF strategyprofit > Average[5000](sp) THENPOSITIONSIZE = 2ELSEPOSITIONSIZE = 1ENDIFStrange but the important thing is that the problem is solved
Thank you
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on