Maximim profit then stop trading on that day

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #204049 quote
    mikael6446
    Participant
    New

    Hello to All,

    Could someone please help me with the line to add for a maximum points per day on this basic strategy and then stop trading?

    I have put the line:
    SET TARGET PROFIT DAY = 30

    However, I am not sure this is working fine.

    Thanks a lot !

    // Définition des paramètres du code
    DEFPARAM CumulateOrders = False // Cumul des positions désactivé
    // Annule tous les ordres en attente et ferme toutes les positions à 0:00, puis empêche toute création d'ordre avant l'heure "FLATBEFORE".
    DEFPARAM FLATBEFORE = 090000
    // Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"
    DEFPARAM FLATAFTER = 153000
    
    // Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiés
    daysForbiddenEntry = OpenDayOfWeek = 5
    
    // Conditions pour ouvrir une position acheteuse
    indicator1 = Average[50](close)
    c1 = (close > indicator1)
    indicator2, ignored, ignored, ignored, ignored = CALL "ExtraTrend"[0, 1, 1, 1, 1, 1](close)
    c2 = (close CROSSES OVER indicator2)
    
    IF (c1 AND c2) AND not daysForbiddenEntry THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // Stops et objectifs
    SET STOP pLOSS 40 pTRAILING 40
    SET TARGET pPROFIT 40
    SET TARGET PROFIT DAY = 30
    
    #204063 quote
    JS
    Participant
    Senior

    Hi Mikael,

    Maybe you can add something like this…

    IF IntraDayBarIndex = 0 THEN
    TradeON = 1
    ENDIF

    IF (StrategyProfit – StrategyProfit[1]) > MaxPoints THEN
    TradeON = 0
    ENDIF

    IF MyConditions AND TradeON THEN
    … Buy / SellShorts

    ENDIF

    #204122 quote
    mikael6446
    Participant
    New

    Thank you for your help 🙂

    Will try to incorporate it.

    Mikaël

    #204168 quote
    MauroPro
    Participant
    Veteran

    This code (written by Roberto)  blocks intraday trading once you reach a certain profit in euro (maxDailyProfit)

    maxDailyProfit = XXX
    floatingPosition = positionPerf*positionPrice/pointSize*pointValue
    once tradeAllowed = 1
    if intradayBarIndex = 0 then
    tradeAllowed = 1
    myProfit=strategyProfit
    endif
    if (strategyProfit + floatingPosition) >= (myProfit+maxDailyProfit) then
    tradeAllowed = 0
    endif

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

Maximim profit then stop trading on that day


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
mikael6446 @mikael6446 Participant
Summary

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

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