Racheter 1 action le jour où le SL est touché

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #135909 quote
    Khaled
    Participant
    Veteran

    Bonjour,

    Je viens d’essayer d’écrire quelques lignes, mais je bute sur un petit problème. Pour les jours où mon Trailing SL (0.75%) est touché, je voudrais que ProRealTime rachète 1 action juste avant la clôture entre 17h et 17h30. Autrement, je reste en position.

    Par avance merci de votre aide.

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Prevents the system from placing new orders on specified days of the week
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    // Conditions to enter long positions
    c1 = (close > 0)
    
    IF c1 AND not daysForbiddenEntry THEN
    BUY 1 SHARES AT MARKET
    ENDIF
    
    // Stops and targets
    SET STOP %TRAILING 0.75
    #135961 quote
    Nicolas
    Keymaster
    Master

    Dans ce cas il faudra lancer la stratégie dans un timeframe inférieur au journalier ou l’horaire de 17h30 est rencontré (UT 30minutes par exemple), à tester :

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Prevents the system from placing new orders on specified days of the week
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    // Conditions to enter long positions
    c1 = (close > 0)
    
    IF c1 AND not daysForbiddenEntry THEN
     BUY 1 SHARES AT MARKET
    ENDIF
    
    if itnradaybarindex=0 or day<>day[1] then 
     trigger = 0
    endif
    
    if onmarket[1] and not onmarket then 
     trigger = 1
    endif
    
    if time = 173000 and c1 AND not daysForbiddenEntry and trigger then 
     BUY 1 SHARES AT MARKET
    ENDIF
    
    // Stops and targets
    SET STOP %TRAILING 0.75
    #136035 quote
    Khaled
    Participant
    Veteran

    Merci infiniment Nicolas.

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

Racheter 1 action le jour où le SL est touché


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
Khaled @khaled Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Khaled
5 years, 9 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 06/14/2020
Status: Active
Attachments: No files
Logo Logo
Loading...