"1 par jour !" Stratégy on DJ H1 ( one par day)

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #38515 quote
    TheAccountant
    Participant
    Average

    Hello ! 🙂

    Here is a strategy that takes only one position per day. On the DJ in h1 at the opening.

    This is my version of a classic strategy that I am trying to improve.

    It is very simple: we take position once a day in the direction of the trend. Trend confirmed by the MACD and an MA100 at the time of opening.

    We exit postion with the ATR trailing stop (code on prorealcode) :

    // Période
    p = 14
    
    // Average True Range X
    ATRx = AverageTrueRange[p](close) * 1.5
    
    
    // ATRts = ATR Trailing Stop
    
    // Inversion de tendance
    IF close crosses over ATRts THEN
    ATRts = close - ATRx
    ELSIF close crosses under ATRts THEN
    ATRts = close + ATRx
    ENDIF
    
    // Cacul de l'ATRts lors de la même tendance
    IF close > ATRts THEN
    ATRnew = close - ATRx
    IF ATRnew > ATRts THEN
    ATRts = ATRnew
    ENDIF
    ELSIF close < ATRts THEN
    ATRnew = close + ATRx
    IF ATRnew < ATRts THEN
    ATRts = ATRnew
    ENDIF
    ENDIF
    
    
    return ATRts as "ATR Trailing Stop"
    

    I did not over-optimize it. I code it on 50 000 unit and i test on 200 000 unit. The Spread of 1.8 is included. Starting capital 1000 usd.

    The problem is that there are sometimes long series of losses.

    Any ideas to reduce the drawdown or to improve the strategy will be appreciated 🙂

    TheAccountant

    PS : Google translation is my new friends now 🙂  🙂  🙂

     

    // Définition des paramètres du code
    DEFPARAM CumulateOrders = False // Cumul des positions désactivé
    
    // Empêche le système de placer des ordres pour entrer sur le marché ou augmenter la taille d'une position avant l'heure spécifiée
    noEntryBeforeTime = 145000
    timeEnterBefore = time >= noEntryBeforeTime
    
    // Empêche le système de placer des ordres pour entrer sur le marché ou augmenter la taille d'une position après l'heure spécifiée
    noEntryAfterTime = 151000
    timeEnterAfter = time < noEntryAfterTime
    
    // Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiés
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    // Conditions pour ouvrir une position acheteuse
    indicator1 = Average[100](close)
    c1 = (close > indicator1)
    indicator2 = MACD[12,26,9](close)
    c2 = (indicator2 > 0)
    
    IF (c1 AND c2) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions pour fermer une position acheteuse
    indicator3 = CALL "ATR trailling Stop"
    c3 = (close CROSSES UNDER indicator3)
    
    IF c3 THEN
    SELL AT MARKET
    ENDIF
    
    // Conditions pour ouvrir une position en vente à découvert
    indicator4 = Average[100](close)
    c4 = (close < indicator4)
    indicator5 = MACD[12,26,9](close)
    c5 = (indicator5 < 0)
    
    IF (c4 AND c5) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions pour fermer une position en vente à découvert
    indicator6 = CALL "ATR trailling Stop"
    c6 = (close CROSSES OVER indicator6)
    
    IF c6 THEN
    EXITSHORT AT MARKET
    ENDIF
    
    // Stops et objectifs
    SET STOP pLOSS 50
    1-par-jour-DJ-H1.itf 1-par-jour.png 1-par-jour.png 1-par-jour-dj.png 1-par-jour-dj.png
    #38521 quote
    Juan Salas
    Participant
    Master

    Hi Accountant,

    Thanks so much for your reply!!!! I will take a look to your system, although I am afraid I am not going to be able to test it for more than 100.000 units, since PRT does not allow more than that.

    I can see you have a very narrow timeframe: 14:50-15:10h, so I cannot apply to my system. I operate in M15 from 09:00 to 14:00 and the average time for an operation is 30-60 min, so after that time another one is open. I am browsing the different forums and getting new ideas, but in any case, I do appreciate your help.

    As I said, I will review your code and if I see any room for improvement, I will let you know.

    Very best,

    Juan

    P.S.- Good luck with Google translation. I am living in Germany and I can’t live without it ;))))))))

    TheAccountant thanked this post
    #39817 quote
    TheAccountant
    Participant
    Average

    hello !

    For now the positions taken directly on the demo account are exactly the same as the backtest !

    #39843 quote
    Nicolas
    Keymaster
    Master

    Good news TheAccountant!

    Did you try to test the slope of the 100SMA and/or the MACD one to trigger your orders?

    #39846 quote
    TheAccountant
    Participant
    Average

    I do not understand what you mean ? I use the 100sma and the MACD. ( une ptite trad en french de “the slope” ?  🙂  ou une ptite explication de ce que tu veux dire en french ? )

    #39848 quote
    Nicolas
    Keymaster
    Master

    Slope means “pente” in French or the “direction” of the curve to be precise 🙂

    #39874 quote
    TheAccountant
    Participant
    Average

    ok thank ! 🙂

    I do not know how to do that. I can put price above or below but according to the Slope I do not know

    #39877 quote
    Nicolas
    Keymaster
    Master

    You can compute a simple slope just by comparing if the current period value of the indicator is superior or inferior to the previous one:

    sma100=average[100]
    bullish=sma100>sma100[1]

    Or you can also add a filter to know the current slope is bullish since 10 bars for example:

    sma100=average[100]
    bullish=sma100>sma100[1]
    longtermbullish=summation[10](bullish)=10
    #39893 quote
    TheAccountant
    Participant
    Average

    Ok thank you Nicolas. I tested both ways and it’s not better for the drawdown.

    I also tried to add a 50sma (sma 50> sma100 for buy) and replaced ATR trailing stop by a simple trailing stop : It’s a little better for the winnings but still with a big drawdown 🙁

    #39895 quote
    Nicolas
    Keymaster
    Master

    You can also use the same slope condition with your MACD.

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

"1 par jour !" Stratégy on DJ H1 ( one par day)


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/17/2017
Status: Active
Attachments: 3 files
Logo Logo
Loading...