Entry on fib retracement?

Viewing 11 posts - 16 through 26 (of 26 total)
  • Author
    Posts
  • #22431 quote
    kg6450
    Participant
    Average

    Hi Grahal, thanks so much for the reply! Sorry I took so long to get back to you, it’s been a busy weekend!

    Thanks for the code, I’ve tested it and its working well for me! I think when I was trying it before I was making it much more complicated than it needed to be!

    Looking at your results, how come you are able to get 5 minute data going back 2 years? on my chart I am only able to test back one month. Also, what is the reasoning behind the close being greater than the exponential moving average?

    Thanks!

    #22435 quote
    Nicolas
    Keymaster
    Master

    Here is what I get with 200k bars and 1 point spread. Unfortunately, the stoploss is so wide that it can blow up some nice profit made by the strategy. Entries seem correct, so you should work on this stoploss part I think 🙂

    dax-intraday-strategy-trading.png dax-intraday-strategy-trading.png
    #22440 quote
    kg6450
    Participant
    Average

    Thanks Nicolas, I will update when I have sorted the correct exit.

    For the short side would it be correct to write the code like this:

    IF MakeTrade = 1 AND lowest[20](low) < ll THEN
    fib1 = (hh - lowest[20](low)) * 0.382
    Entry1 = lowest[20](low) + fib1
    ENDIF
    
    
    IF MakeTrade = 1 AND lowest[20](low) < ll AND close < ExponentialAverage[15](close) THEN
    SELLSHORT 1 SHARES AT Entry1 LIMIT
    ENDIF

    This would be written alongside the buy instructions to enter if the low is broken instead of the high

    #22467 quote
    GraHal
    Participant
    Master

    Hi Kg

    Is your Platform  via IG and are you selecting 5Min : X Units then select 100,00 units … see attached.

    Re Close > EMA is so Buys are made during an Up Period when it is more likely that following a 0.382 retracement price will then continue upwards.

    Cheers
    GraHal

    2017-01-25_17-28-52.jpg 2017-01-25_17-28-52.jpg
    #22477 quote
    Nicolas
    Keymaster
    Master

    I didn’t follow the first logic of the buy side of the strategy. Any idea GraHal? Since you have fixed it already? 🙂

    #22491 quote
    GraHal
    Participant
    Master

    I have to ‘see in my mind / vision’ what code is doing … so I get lost easily! 🙂

    If I visioned it correct, the strategy is based on a 38% retracement after a rise; then continues up (Elliott Waves)?  I added Close > EMA as an extra Buy condition to reduce buy trades during consolidation (Stage Analysis – 1 & 3).

    SellShort needs to be the opposite logic I guess? I’ve had a play and also with 23.6% and 61.8% retracement, but I can’t get the full code to work as well as the ‘Long only code’.

    My next thought / test was Line 3, is it correct KG?:  Entry1 = lowest[20](low) + fib1

    (I’ve been ‘lured away’ for a while by the ‘Raul Dax 5 Min Scalp’ Algo:))

    Cheers
    GraHal

    #22543 quote
    Nicolas
    Keymaster
    Master

    Maybe an indicator made of the entries signals could help? That way kg6450 could easily see on charts if everything’s correct for his own strategy.

    GraHal thanked this post
    #22623 quote
    kg6450
    Participant
    Average

    I thought that line was correct, but like you said getting it to work as well as the buy side is difficult.

    There was one instance in my backtest where there was a break to the upside and it entered long, but then before the maketrade period was over there was a breakout on the bottom too. The system simply exited the long and went short which shouldnt happen.

    I will have another play around with the code and post any updates!

    GraHal thanked this post
    #22732 quote
    GraHal
    Participant
    Master

    Hi KG

    Your ‘Long + my revisons’ is making money on Demo, but I’m not sure it’s working in line with Elliott Waves / Fib Retracement theory? (see attached).

    Look forward to what you come up with for the Long + Short version. I’m not great at coding, but I’m enjoying helping / adding bits.

    Thanks
    GraHal

    KG-Fib.jpg KG-Fib.jpg KG-Fib2.jpg KG-Fib2.jpg
    #22757 quote
    Nicolas
    Keymaster
    Master

    I made modifications myself about the code, I’m not sure about the short positions logic.. it’s may be wrong, but here is the full code.

    I add a short stoploss (40 points), with a simple monthly pivots filter (above / below). Just throwing ideas on this Friday afternoon. Results are decent, even if we loose almost 2 times more than we win .. I let you review entries logic.

    DEFPARAM CumulateOrders = False
    DEFPARAM FlatAfter = 214500
    
    StartTime = 065000
    FinalTime = 113000
    
    // Set Breakout box for between 5pm and 7am
    If Time = 065000 THEN
    hh = highest[80](high)
    ll = lowest[80](low)
    ENDIF
    //Only make trade between 7am and 10am
    MakeTrade = Time >= StartTime AND Time <= FinalTime 
    
    IF MakeTrade AND highest[20](high) > hh THEN
    fib = (highest[20](high) - ll) * 0.382
    Entry = ll + fib
    ENDIF
    
    IF MakeTrade AND lowest[20](low) < ll THEN
    fib1 = (hh - lowest[20](low)) * 0.382
    Entry1 = lowest[20](low) + fib1
    ENDIF
    
    hhh = max(high,hh)
    lll = min(low,ll)
    If Month<>Month[1] then
    monthlyHigh = hhh[1]
    monthlyLow = lll[1]
    monthlyPivot = (monthlyHigh + monthlyLow + Close[1]) / 3
    hh = 0
    ll = close*100
    Endif
    
    IF MakeTrade AND highest[20](high) > hh AND close > monthlyPivot THEN
    Buy 1 SHARE AT Entry LIMIT
    ENDIF
    
    IF MakeTrade AND lowest[20](low) < ll AND close < monthlyPivot THEN
    SELLSHORT 1 SHARES AT Entry1 LIMIT
    ENDIF
    
    SET TARGET pPROFIT 100
    SET STOP pLOSS 40
    GraHal thanked this post
    fibonacci-retracement-and-monthly-pivot-test.png fibonacci-retracement-and-monthly-pivot-test.png
    #22891 quote
    GraHal
    Participant
    Master

    Nice work! Thank you Nicolas. What timezone is it please?

    Regards
    GraHal

Viewing 11 posts - 16 through 26 (of 26 total)
  • You must be logged in to reply to this topic.

Entry on fib retracement?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
kg6450 @kg6450 Participant
Summary

This topic contains 25 replies,
has 4 voices, and was last updated by GraHal
9 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/09/2016
Status: Active
Attachments: No files
Logo Logo
Loading...