Max loss per month

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #175708 quote
    deletedaccount051022
    Participant
    New

    Hi,

    Is there any way to limit the max loss per month?  For example, when backtesting I’d like a strategy to stop trading for the month if losses reach a certain level, then resume at the start of the following month.

    Is this something that can be managed within the code?

    Thank you very much

    S

    @AlgoHunter1 thanked this post
    #175718 quote
    robertogozzi
    Moderator
    Master

    There you go:

    ONCE MyProfit = 0
    ONCE TradeON  = 1
    IF Month <> Month[1] THEN
       MyProfit = STRATEGYPROFIT //store profits/losses at the beginning of each month
       TradeON  = 1              //enable trading each new month
    ENDIF
    IF (STRATEGYPROFIT - MyProfit) < -200 THEN  //disable trading when losing > 200 currency units
       TradeON = 0
    ENDIF
    MyLongConditions = close CROSSES OVER average[10,0](close)
    IF MyLongConditions AND TradeON THEN
       BUY 1 Contract at Market
       SET TARGET pPROFIT 500
       SET STOP   pLOSS   100
    ENDIF
    //graph strategyprofit
    //graph MyProfit
    //graph TradeON coloured(255,0,0,255)
    Midlanddave and kbot2021 thanked this post
    #175721 quote
    deletedaccount051022
    Participant
    New

    Grazie mille!  I am very grateful for your help.

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

Max loss per month


ProOrder: Automated Strategies & Backtesting

New Reply
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by deletedaccount051022
4 years, 6 months ago.

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