Strategy pauses for a day on losses

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #189424 quote
    phoentzs
    Participant
    Master

    I saw a code somewhere here… and unfortunately I can’t find it anymore. It’s about the following: If my strategy makes a loss of, say, 1% during the day, the strategy should stop working for that day and only start working again the next day. Optionally, the strategy should pause for that day if it has a following number of losing trades. Both individually or combined. Can someone help me please?

    #189432 quote

    Hi Phoentzs
    You can use this, but keep in mind that it works like everything at close, so if by any chance you have a loss of 0.95% it does not freeze, but make another trade and if the next one loses 2% on the day you have lost 2.90%.

    DailyLoss=1
    once StopDay=1
    If intradaybarindex=0 then
    ProfitDay=STRATEGYPROFIT
    StopDay=1
    endif
    If StrategyProfit<=ProfitDay-DailyLoss*(close/100) then
    StopDay=0
    endif
    IF not longonmarket AND StopDay =1   and Conditions THEN
    

    Ciao

    Mauro T.

    #189440 quote
    phoentzs
    Participant
    Master

    Thanks Mauro Can I just put the code in front of the strategy code, i.e. at the beginning?

    #189442 quote

    I normally put it on my terms ….. above here.

    IF not longonmarket AND StopDay =1   and Conditions THEN

    hello

    Mauro T.

    #189444 quote
    deletedaccount051022
    Participant
    New

    Hi phoentzs

    Here is a version which robertogozzi kindly wrote which works on a monthly basis, and can be adapted to run on a daily basis.  It currently runs on notional value of loss;

    Max loss per month

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

Strategy pauses for a day on losses


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
phoentzs @phoentzs Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/05/2022
Status: Active
Attachments: No files
Logo Logo
Loading...