Dax 30mn – Kama Supertrend Opening

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #113163 quote
    BobFlynn
    Participant
    Senior

    Hello guys,

    I’ve been on this forum for a few weeks now, and I’m really grateful to be part of this community. I feel it’s now time for me to contribute as I can.

    So I’ve decided to share with you this short idea, basically it takes position only in the first few hours of cash market.

    Using SuperTrend and KAMA to filter entries, and trailstop with another (faster) Supertrend.

    It is just a draft yet, looking forward to your inputs and ideas on how to make it better.

    // 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 à l'heure "FLATAFTER"
    // DEFPARAM FLATAFTER = 220000
    
    // 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 = 090000
    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 = 113000
    timeEnterAfter = time < noEntryAfterTime
    
    IF (CurrentTime = 090000) THEN
    OpeningPrice = Open[0]
    ENDIF
    
    /// --- MONEY MANAGEMENT
    //Capital = 350
    //Risk = 0.0714
    //StopLoss = 50 // Could be our variable X
    
    //equity = Capital + StrategyProfit
    //maxrisk = round(equity*Risk)
    //PositionSize = abs((maxrisk/StopLoss)/PointValue)
    
    PositionSize = 1
    /// ---------------------------------- Indicators ------------------------------------- ///
    iMACD1850 = MACDline[18,50,9](close)
    signal1850 = ExponentialAverage[9](iMACD1850)
    iSuperTrend = SuperTrend[3,17]
    kama = CALL "KAMA 50"[50, 2, 30]
    iVolatStop = SuperTrend[2,15]
    //LongStop = close[1] - (iATR[1] * 2)
    //ShortStop = close[1] - (iATR[1] * 2)
    iATR = AverageTrueRange[20](close)
    multiplicatorATR = 1.2
    /// ---------------------------------------------------------------------------------- ///
    
    /// --- LONG ENTRY PRICE DEF
    BullishOpening = (OpeningPrice > kama) AND (OpeningPrice > iSuperTrend)
    PriceBelowKamaST = (close < kama) AND (close < iSuperTrend)
    
    IF BullishOpening THEN
    LongEntryPrice = OpeningPrice + (multiplicatorATR*iATR)
    ENDIF
    
    IF PriceBelowKamaST THEN
    LongEntryPrice = iSuperTrend
    ENDIF
    
    
    ///------------------------------------------------------------------///
    
    /// --- SHORT ENTRY PRICES
    PriceAboveKamaST = (close > kama) AND (close > iSuperTrend)
    BearishOpening = (OpeningPrice < kama) AND (OpeningPrice < iSuperTrend)
    
    IF BearishOpening THEN
    ShortEntryPrice = OpeningPrice - (multiplicatorATR *iATR)
    ENDIF
    
    IF PriceAboveKamaST THEN
    ShortEntryPrice = iSuperTrend
    ENDIF
    
    /// -------------------------------- ///
    
    OpenLong = (iMACD1850 > signal1850) AND PriceBelowKamaST
    OpenShort = (iMACD1850 < signal1850) AND PriceAboveKamaST
    
    /// BUY
    IF OpenLong AND timeEnterBefore AND timeEnterAfter THEN
    BUY PositionSize CONTRACT AT LongEntryPrice STOP
    lowOpen = low[1]
    ENDIF
    IF BullishOpening AND timeEnterBefore AND timeEnterAfter THEN
    BUY PositionSize CONTRACT AT LongEntryPrice STOP
    lowOpen = low[1]
    ENDIF
    SELL AT lowOpen STOP
    SELL AT iVolatStop STOP
    
    /// SELL
    IF OpenShort AND timeEnterBefore AND timeEnterAfter THEN
    SELLSHORT PositionSize CONTRACT AT ShortEntryPrice STOP
    highOpen = high[1]
    ENDIF
    IF BearishOpening AND timeEnterBefore AND timeEnterAfter THEN
    SELLSHORT PositionSize CONTRACT AT ShortEntryPrice STOP
    highOpen = high[1]
    ENDIF
    EXITSHORT AT highOpen STOP
    EXITSHORT AT iVolatStop STOP
    
    SET STOP pLOSS iATR*2.5
    
    // TRAILING //////////////////////////////////////////////////////////

     

    daxkamasupertrendopening-15741928604p8cl-scaled.png daxkamasupertrendopening-15741928604p8cl-scaled.png DAX30_KAMA_Supertrend_Opening.itf
    #113285 quote
    Nicolas
    Keymaster
    Master

    Hi Bob and thanks a lot for sharing this strategy. In order to complete the review process before sending it into the library, it would be kind of you if you could do some WF testing, is it possible? Thanks again for your contribution to the website which is greatly appreciate! 😉

    #113287 quote
    BobFlynn
    Participant
    Senior

    Hello Nicolas,

    Thanks for your reply. I’ve never run a WF on ProRealTime. Any resources/documentation available to help me with my first one ?

    ( Et bravo pour le site, c’est top ! Belle communauté 🙂 )

    #113294 quote
    GraHal
    Participant
    Master

    Is below the Indicator you refer to in your code as KAMA 50 ?

    If No, where is KAMA 50 or has my coffee not worked through yet? 🙂

    https://www.prorealcode.com/prorealtime-indicators/kaufman-adaptive-moving-average-kama/

    #113303 quote
    BobFlynn
    Participant
    Senior

    Hello Grahal,

    Haha actually I just imported to try the code of this topic : https://www.prorealcode.com/topic/kama-200-2/

    So I don’t know really …

    #113328 quote
    Roger
    Participant
    Veteran

    Hi, I ve added the definition of KAMA50 (i think its the good one)  and its not too bad on DAX 30 minutes

    GraHal and BobFlynn thanked this post
    Dax-30mn-–-Kama-Supertrend.itf
    #113349 quote
    GraHal
    Participant
    Master

    I get attached over 100k bars with spread = 2.

    I like that losses are cut early and not stay in the trade hoping to finish all good!?

    Be good if we can increase the Gain to Loss ratio.

    Bob.png Bob.png Bob-2.png Bob-2.png
    #113362 quote
    Razz
    Participant
    Master

    Hello Roger
    Thank you for sharing your trading system. Do you have an explanation why there was movement in the Dax in the gray areas it was not really reflected in the profit? In the areas with the blue line he behaves completely differently?

    Probacktest   100.00 Einheiten , 2 Positionen , Spread 1

    Kama-1.jpg Kama-1.jpg Kama-2.jpg Kama-2.jpg
    #113365 quote
    Roger
    Participant
    Veteran

    I am on my phone I am not at home tonight but I try to work on it tomorrow.

    What bothers me is the % winning because you lose money most of the time so it is mentally hard.

    This kind of strategy reminds me the popular Breakout cac40 strat and these strategies need big and proper market move to make money. You typically lose money when the market reverses on the same day.

    #113367 quote
    Razz
    Participant
    Master

    Thanks for the answer then until tomorrow

    #113384 quote
    BobFlynn
    Participant
    Senior

    This kind of strategy reminds me the popular Breakout cac40 strat and these strategies need big and proper market move to make money. You typically lose money when the market reverses on the same day.

    Yes Roger, I just learned about London Morning breakout strategy. That’s very similar indeed, what’s funny is that I noticed the pattern myself while live trading. Unfortunately i didn’t find a good way to trail stop the trade… I used MACD crosses, Supertrend, ATR, lowest low… all with no success.

    #113386 quote
    jebus89
    Participant
    Master

    @BobFlynn have u tried the different kinds of trailing stop losses from this site? Has helped me alot on multiple strategies.

    #113390 quote
    BobFlynn
    Participant
    Senior

    Thanks for your message Jebus. Do you have any useful links ? I think I tried all the basics… but maybe with the wrong parameters so it’s hard to tell.

    #113391 quote
    jebus89
    Participant
    Master

    Try these ones, maybe they can help.
    https://www.prorealcode.com/blog/learning/trailing-stop-max-favorable-excursion-mfe/

     

    and

     

    
    //************************************************************************
    // TSL trailing stop function
    //************************************************************************
    
    
    //************************************************************************
    //trailing stop function
    trailingstart = 50// 20trailing will start @trailinstart points profit
    trailingstep = 10// 5trailing step to move the "stoploss"
     
    //reset the stoploss value
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
     
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
    newSL = tradeprice(1)+trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
    newSL = newSL+trailingstep*pipsize
    ENDIF
    ENDIF
     
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
    newSL = tradeprice(1)-trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
    newSL = newSL-trailingstep*pipsize
    ENDIF
    ENDIF
     
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    
    
    //************************************************************************
    
    #113401 quote
    Roger
    Participant
    Veteran

    Attached is a walk forward test. I have randomly chosen some parameters. And its not very good.

    Bobflynn have you already optimized the parameters in the code you have posted ?

    Dax-30mn-–-Kama-Supertrend-WF.itf CapturePRT.png CapturePRT.png CapturePRT2.png CapturePRT2.png
Viewing 15 posts - 1 through 15 (of 18 total)
  • You must be logged in to reply to this topic.

Dax 30mn – Kama Supertrend Opening


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
BobFlynn @bobflynn Participant
Summary

This topic contains 17 replies,
has 7 voices, and was last updated by BobFlynn
6 years, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/21/2019
Status: Active
Attachments: 10 files
Logo Logo
Loading...