3 Candle Strategy

Viewing 15 posts - 61 through 75 (of 83 total)
  • Author
    Posts
  • #77491 quote
    VonasiVonasi
    Moderator
    Master

    This is how they are indexed in a strategy:

    [attachment file=77492]

    Marc thanked this post
    Screenshot_3-1.png Screenshot_3-1.png
    #77628 quote
    MarcMarc
    Participant
    Average

    Good Day to you,

    I think that code is now correct. can someone prrof this according to the systemrules? I think there could be an issue with SL and TP.

    Thank you Marc

    DEFPARAM CumulateOrders = false
     
    //Buy-Condition l1 Exapmle (For daily): Candle from monday is bullish and followed by 2 candles with lower highs and lower lows. Close of current candle (wednesday-candle) is higher than close of monday candle
    l1 = OPEN[2] < CLOSE[2] AND High[2] > High [1] AND High[1] > High AND Low[2] > Low[1] AND Low[1] > Low AND Close > Close[2]
     
    //Buy-Condition l2 Exapmle (For daily): Candle of monday is bearish and followed by 2 candles with lower highs and lower lows. Close of current candle (wednesday-candle) is higher than open of monday candle
    l2 = OPEN[2] > CLOSE[2] AND High[2] > High [1] AND High[1] > High AND Low[2] > Low[1] AND Low[1] > Low AND Close > Open[2]
     
    //Sell-Condition s1 Exapmle (For daily): Candle of monday is bullish and followed by 2 candles with higher highs and higher lows. Close of current candle (wednesday-candle) is lower than close of monday candle
    s1 = OPEN[2] < CLOSE[2] AND High[2] < High [1] AND High[1] < High AND Low[2] < Low[1] AND Low[1] < Low AND Close < Close[2]
    
    //Sell-Condition s2 Exapmle (For daily): Candle of monday is bearish and followed by 2 candles with higher highs and higher lows. Close of current candle (wednesday-candle) is lower than open of monday candle
    s2 =OPEN[2] > CLOSE[2] AND High[2] < High [1] AND High[1] < High AND Low[2] < Low[1] AND Low[1] < Low AND Close < Close[2]
     
    //Buy @ open of nextcandle if condition l1 or l2 is met
    IF l1 OR l2 AND Not OnMarket THEN       //Not OnMarket will prevent SL & TP to be recalculated
    SL = (open - low[1])                //difference between current price and LOW of candle 1
    TP = (high[2] - open)               //difference between the HIGH of candle 2 and current price (a lower current price is assumed)
    BUY 1 SHARES AT MARKET //MarketOrder
    SET STOP   LOSS   SL
    SET TARGET PROFIT TP
    ENDIF
     
    //Sell @ open of nextcandle if condition s1 or s2 is met
    IF s1 OR s2 AND Not OnMarket THEN      //Not OnMarket will prevent SL & TP to be recalculated
    SL = (high[1] - open)              //difference between current price and HIGH of candle 1
    TP = (open - low[2])               //difference between the LOW of candle 2 and current price (a higher current price is assumed)
    SELLSHORT 1 SHARE AT MARKET //MarketOrder
    SET STOP   LOSS   SL
    SET TARGET PROFIT TP
    ENDIF
    #77632 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    It works, but I cannot tell if it’s working fine, I dod not check the patterns.

    I checked SL & TP and sometimes they’re huge, sometimes very close to the minimun requirements!

    The main isssue is the very few trades opened, on DAX daily just 3 in 8 years!

    It’s for sure good practice to improve your know-how.

    Marc thanked this post
    #77650 quote
    MarcMarc
    Participant
    Average

    I think that the patterns are still not correct recognized…I have to filter this out -.-
    It’s a lot of workd for such a simple system…

    Rgsd

    Marc

    #77654 quote
    MarcMarc
    Participant
    Average

    Recognition of patterns seems to be okay, but setting up of TP and SL is curious…

    Wrong-Patter.jpg Wrong-Patter.jpg
    #77656 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Try using ATR, searching this forum will allow you to find many examples about it.

    #77767 quote
    MarcMarc
    Participant
    Average

    I will do and check out if there are some possibilities how tp play with ATR

    #77774 quote
    MarcMarc
    Participant
    Average

    Another example with ATR-based SL and TP calculation

    DEFPARAM CumulateOrders = false
     
    //Buy-Condition
    l1 = OPEN[2] > CLOSE[2] AND OPEN[1] > CLOSE[1] AND High[2] > High [1] AND High[1] > High AND Low[2] > Low[1] AND Low[1] > Low AND Close > Close[2]
     
    //Sell-Condition
    s1 = OPEN[2] < CLOSE[2] AND OPEN[1] < CLOSE[1] AND High[2] < High [1] AND High[1] < High AND Low[2] < Low[1] AND Low[1] < Low AND Close < Close[2]
    
     
    //Buy @ open of nextcandle if condition l1 is met
    IF l1 AND Not OnMarket THEN       //Not OnMarket will prevent SL & TP to be recalculated
    SL = TP               //difference between current price and LOW of candle 1
    TP = (AverageTrueRange[x]((open+close+low+high)/4))*2               //difference between the HIGH of candle 2 and current price (a lower current price is assumed)
    BUY 1 SHARES AT MARKET //MarketOrder
    SET STOP   LOSS   SL
    SET TARGET PROFIT TP
    ENDIF
     
    //Sell @ open of nextcandle if condition s1 is met
    IF s1 AND Not OnMarket THEN      //Not OnMarket will prevent SL & TP to be recalculated
    SL = TP              //difference between current price and HIGH of candle 1
    TP = (AverageTrueRange[x]((open+close+low+high)/4))*2              //difference between the LOW of candle 2 and current price (a higher current price is assumed)
    SELLSHORT 1 SHARE AT MARKET //MarketOrder
    SET STOP   LOSS   SL
    SET TARGET PROFIT TP
    ENDIF
    
    #77776 quote
    MarcMarc
    Participant
    Average

    With more variables

    DEFPARAM CumulateOrders = false
    
    TPL = (AverageTrueRange[TPLATR]((open+close+low+high)/4))*TPLMOD
    SLL = (AverageTrueRange[SLLATR]((open+close+low+high)/4))*SLLMOD
    
    TPS = (AverageTrueRange[TPSATR]((open+close+low+high)/4))*TPSMOD
    SLS = (AverageTrueRange[SLSATR]((open+close+low+high)/4))*SLSMOD
     
    //Buy-Condition
    l1 = OPEN[2] > CLOSE[2] AND OPEN[1] > CLOSE[1] AND High[2] > High [1] AND High[1] > High AND Low[2] > Low[1] AND Low[1] > Low AND Close > Close[2]
     
    //Sell-Condition
    s1 = OPEN[2] < CLOSE[2] AND OPEN[1] < CLOSE[1] AND High[2] < High [1] AND High[1] < High AND Low[2] < Low[1] AND Low[1] < Low AND Close < Close[2]
    
     
    //Buy @ open of nextcandle if condition l1 is met
    IF l1 AND Not OnMarket THEN
    BUY 1 SHARES AT MARKET //MarketOrder
    SET STOP   LOSS   SLL
    SET TARGET PROFIT TPL
    ENDIF
     
    //Sell @ open of nextcandle if condition s1 is met
    IF s1 AND Not OnMarket THEN
    SELLSHORT 1 SHARE AT MARKET //MarketOrder
    SET STOP   LOSS   SLS
    SET TARGET PROFIT TPS
    ENDIF
    
    #77792 quote
    GraHalGraHal
    Participant
    Master

    @Marc thank you for sharing, please could you also share the .itf file of the multi-variable System as then it saves me entering all the Labels (and probably getting it wrong!? 🙂 ).

    Many Thanks
    Graham

    #77793 quote
    MarcMarc
    Participant
    Average

    Hi GraHal,

    pls find attached 3 Candle Strategy itf attached.

    3-Candle-System-Mod.itf
    #77804 quote
    GraHalGraHal
    Participant
    Master

    Marc big thank you!

    I’ve set it going on Demo Fwd Test as I get attached on 5 min TF on DJI on 100,000 bars!

    Bigger drawdown than I like, but if it’s out of money already gained by the System then I can live with that! 🙂 🙂

    Marc thanked this post
    Marc-5.jpg Marc-5.jpg Marc-6.jpg Marc-6.jpg
    #77807 quote
    VonasiVonasi
    Moderator
    Master

    Draw down has to be accepted as relative to run up or overall profit. As a rule of thumb I like to see at a glance that draw down multiplied by ten is less than run up and overall profit. So for example if draw down is £2000 then I want to see at least £20000 run up or £20000 overall profit. It is not a ‘set in stone’ rule but is an easy way to assess how bad draw down really is by comparison.

    GraHal thanked this post
    #77811 quote
    GraHalGraHal
    Participant
    Master

    Well by your rule of thumb Vonasi it more or less passes! 🙂

    #77812 quote
    MarcMarc
    Participant
    Average

    I think that the 5 minute backtest looks okay…which settings did you use?

Viewing 15 posts - 61 through 75 (of 83 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

3 Candle Strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Marc @mast83 Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/25/2018
Status: Active
Attachments: 23 files
ProRealCode ProRealCode
Loading...