Is it possible to modify StrategyProfit so that it resets every x period?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #175648 quote
    USER3000
    Participant
    Junior

    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.

    #175670 quote
    GraHal
    Participant
    Master

    It would be nice, but resource is limited …

    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? 🙂

    Snippet Link Library

    USER3000 thanked this post
    #175671 quote
    robertogozzi
    Moderator
    Master

    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.

    ONCE MyStrategyProfit   = 0
    ONCE TempStrategyProfit = 0
    IF IntraDayBarIndex = 0 THEN
       MyStrategyProfit   = StrategyProfit                //StrategyProfit at the beginning of a new day
    ENDIF
    TempStrategyProfit = StrategyProfit - MyStrategyProfit//Daily StrategyProfit (that you can change at will)
    nonetheless and USER3000 thanked this post
    #175673 quote
    GraHal
    Participant
    Master

    Link to above added as Log 300 here …

    Snippet Link Library

    #175731 quote
    USER3000
    Participant
    Junior

    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.

    #175732 quote
    USER3000
    Participant
    Junior

    Thank you so much. The functionality that your code provides is exactly what I had in mind.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Is it possible to modify StrategyProfit so that it resets every x period?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
USER3000 @user3000 Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by USER3000
4 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/18/2021
Status: Active
Attachments: No files
Logo Logo
Loading...