Take Profit sur prix rond

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #220248 quote
    Raph50
    Participant
    New

    Bonjour à tous,

    je débute sur le codage avec PRT et je n’arrive pas à faire fonctionner un take profit que je place au prochain prix rond (arrondi à la centaine).

    Par exemple TP fixé à 14100 si prise de position à l’achat à 14060 par exemple et inversement TP fixé à 14000 si pris en position vendeuse.

    ///////////////// ouvrir position acheteuse //////////////
    
    IF NOT OnMarket AND time>090000 AND time<170000 AND C>Kijun AND C>pivot AND C>Open THEN
    BUY 1 CONTRACT AT MARKET
    SET TARGET PROFIT ceil(tradeprice(1),2)-tradeprice(1)
    SET STOP PlOSS 100
    ENDIF
    
    //////////// ouvrir vente à découvert /////////////////
    IF NOT OnMarket AND time>090000 AND time<170000 AND C<Kijun AND C<Pivot AND C<Open THEN
    SELLSHORT 1 CONTRACT AT MARKET
    SET TARGET PROFIT tradeprice(1)-floor(tradeprice(1),2)
    SET STOP PlOSS 100
    ENDIF
    

    Les positions s’ouvrent bien mais ne se clôturent que sur stop loss ou en fin de sessions à 17h30 (avec instruction “defparam flatafter = 173000” en début de code).

    C’est un code en construction, je ne mets que la partie qui me pose problème.

    Si quelqu’un peut m’expliquer pourquoi cela ne marche pas (backtesté sur 10k unité en M15 sur DAX).*

    Merci d’avance pour votre aide.

    #220264 quote
    fifi743
    Participant
    Master

    pas testé:

    r=round(close/100)*100
    if close>R then
    SET TARGET PROFIT r+100-close
    else
    SET TARGET PROFIT r-close
    endif

    pour le long et pour les indices

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

Take Profit sur prix rond


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
Raph50 @raph50 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by fifi743
2 years, 6 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 09/03/2023
Status: Active
Attachments: No files
Logo Logo
Loading...