I’ve been looking at the language documentation and found the StrategyProfit function too limiting because it is applied to the entire history of the strategy with seemingly no way to change the period. It would be useful to be able to calculate the StrategyProfit on, for example, a daily basis. I’ve noticed that this website has a lot of code but there is no library of features that one can use in one’s strategy. If the code has already been written and included in the uploaded indicators and strategies, it would be nice if it could be neatly compiled in a way similar to the language documentation.
Nicolas, the WebMaster / KeyMaster is max’d out permanently.
The Moderators and others help with code, RobertoGozzi works tirelessly and does a superlative job helping code up folks ideas and problems and he may be along sometime soon to help you.
In the meantime have a look on the link below, if it doesn’t help you this time you may remember a snippet exists to solve your next problem? 🙂
You can’t change system constants (they are so called because they are different from variables), such as STRATEGYPROFIT, CLOSE, POSITIONPERF, RANGE, TIME, etc…
But you can save STRATEGYPROFIT in one or more variables and change them as best suits you.
This snippet will store the daily STRATEGYPROFIT in a variable called TempStrategyProfit.
1
2
3
4
5
6
ONCEMyStrategyProfit=0
ONCETempStrategyProfit=0
IFIntraDayBarIndex=0THEN
MyStrategyProfit=StrategyProfit//StrategyProfit at the beginning of a new day
ENDIF
TempStrategyProfit=StrategyProfit-MyStrategyProfit//Daily StrategyProfit (that you can change at will)
I absolutely understand that it takes time. The reason I think it should be considered a worthwhile endeavor is because it would presumably allow everyone to save time. It would essentially function as a tidy FAQ.
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue