DAILY Reseting postionperf to ZERO.
Forums › ProRealTime English forum › ProOrder support › DAILY Reseting postionperf to ZERO.
- This topic has 12 replies, 4 voices, and was last updated 7 years ago by
robertogozzi.
-
-
12/30/2017 at 11:50 PM #56916
Hi all,
I am trying to find the way to reset the function positionperf(n) to one day. If one day I have two losing operations, positionperf(1)<0 and positionperf(2)<0, I want the next day this function to be reset it to (1) again.
Verdi55 showed me one way playing with the bar index, but I don’t get it, and I wondered if there is another way to reach this.
Thanks,
Juan
12/31/2017 at 12:38 AM #56917I think POSITIONPERF cannot be reset, it can only be affected by trades.
You should use a variable and reset it each day, and update it at each new trade that is closed. It should not be straightforward, though.
1 user thanked author for this post.
12/31/2017 at 12:53 AM #56919Roberto,
Many thanks. Verdi55 found this original way but I don’t have it very clear:
1234567diffTiBi = barindex - tradeindexdiffTiBi1 = barindex - tradeindex(2)IF (positionperf(1)<0 and date[diffTiBi] = date and (not onmarket)) OR (positionperf(1)<0 and date[diffTiBi1] = date and onmarket) THENpositionsize=1ENDIF12/31/2017 at 12:59 AM #56922Yes, that’s something I was thinking about.
I will not be of any help for a few days, though and cannot test/write any code.
Try to study and test that code snippet.
Let us know if you could find a solution worth while being shared.
12/31/2017 at 1:03 AM #56923Actually any solution is worth while being shared, if it’s good anyone can learn from it, if it’s a bad one the author could benefit from improvements and suggestions by members.
12/31/2017 at 1:28 AM #56926Hi Roberto,
You are right. These days are to disconnect a bit from the codes 🙂
I think I will take these days to work on this and will post the results.
Many Thanks and Happy and prosperous 2018.
Juan
12/31/2017 at 11:27 AM #56943Wouldn’t it be easier to use StrategyProfit?
Record StrategyProfit and day / date then keep subtracting yesterdays StrategyProfit to start at zero again for each new day … or something similar? (My brain not woke up yet, coffee not got through! and I’ve not even been celebrating New Year! :))
https://www.prorealcode.com/documentation/strategyprofit/
GraHal
12/31/2017 at 12:09 PM #56951I agree, STRATEGYPROFIT could be a far better and easier solution!
12/31/2017 at 12:49 PM #56959Hey Roberto, your words below are so good and true that you should add them under your Profile pic!? 🙂
Any solution is worth sharing
If good, we can all learn from it
If bad, solution / author benefits from improvements and suggestions by members.2 users thanked author for this post.
01/02/2018 at 11:27 PM #57082Juan Salas, I tried to implement GraHal‘suggestions, first you can write:
1234ONCE MyProfit = 0IF IntraDayBarIndex = 0 THEN //At each new day save current strategyprofitMyProfit = StrategyProfitENDIFAt a later moment, when your, say, BUY conditions are met you can write:
123IF My_Conditions AND (StrategyProfit >= MyProfit) THEN //only BUY if no losses occurredBUY ....ENDIF1 user thanked author for this post.
01/03/2018 at 12:59 AM #57084Hi Roberto,
I think your solution above is more directed to monitoring daily operations through their dailyprofit. I don’t know if that can apply to what I am trying to get.
I am working with different types of Martingale, and although no filter may “soften” the unexpected and statistically proven drop of the Martingale, I am trying different approaches.
Example: I have a system that operates 3-4 times a day. Lets say I have 4 losing operations that day, and I want to apply a DAILY martingale. It means positionsize=1, 2, 4 and 8. Next day I want to start in positionsize=1. RIGHT NOW, each day starts as a continuation of the past day, in this case it starts with positionsize= 16.
It is tricky, since positionperf(n) doesn’t differentiate past performances by dates, so it doesn’t matter if the last and losing operation was three days ago, it still counts as positionperf(1)<0.
My intention is contain the Martingales within certain periods of time to avoid escalation (days and even periods of three-four hours). Probably, it may not work, but I want to know how to do it.
In any case, thanks so much for your approach.
Juan
01/04/2018 at 4:16 PM #57257Try to count the number of positions that you have openend every day. For example, set a parameter np to 0 every day at 0:00. When you open a new position, increase np by 1.
Then you can consider positionperf only for the number that np is currently showing.
For example, when np is 2, and a position is open, you consider only positionperf and positionperf(1). When no position is open, you consider only positionperf(1) and positionperf(2).
2 users thanked author for this post.
01/04/2018 at 5:26 PM #57266Try to count the number of positions that you have openend every day. For example, set a parameter np to 0 every day at 0:00. When you open a new position, increase np by 1. Then you can consider positionperf only for the number that np is currently showing. For example, when np is 2, and a position is open, you consider only positionperf and positionperf(1). When no position is open, you consider only positionperf(1) and positionperf(2).
Great idea, if NP = 0 you know positionperf(1) refers to previous days, if not then it reports today’s data. And you can easily reset it daily when IntrayDayBarIndex = 0.
1 user thanked author for this post.
-
AuthorPosts