MACD-Strategy M1 SP500

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #211370 quote
    phoentzs
    Participant
    Master

    Hello folks,
    here is my very simple strategy on SP500 (spread 0.4). Long has been consistently working well for months, so I disabled short. I found the settings around September 2022, so I can say that the strategy has been working in the raw version for at least the last year. The main trend is none other than the MA20 from the TF M15. The MACD entries work in reverse, so the bot enters each mini-pullback and tries to make a profit. The tandem filter works as a trend filter, although it should be used with caution. Can easily be over-optimized. The strategy is also only positive with a MA20 filter and a very low drawdown. The TP/SL ratio is 1:1.1 and I’ve kept it that way since last year. The only thing I tweak from time to time is really the tandem filter.


    @PeterSt
    Can you try it on PRT-IB how the curve looks there?
    I would appreciate opinions and suggestions for improvement (perhaps a better filter?).

    Sorry, I can’t see the “Insert code” option.

     

    //SP500 Spread 0.4

    DEFPARAM CUMULATEORDERS = false
    defparam preloadbars = 10000

    //Risk Management
    PositionSize = 5

    //Hauptfilter M15 10…50

    Timeframe(15minute, updateonclose)
    //Trend
    M15L1 = close > Average[20,0](close) and Average[20,0](close) > Average[20,0](close)[1]
    M15S1 = close < Average[20,0](close) and Average[20,0](close) < Average[20,0](close)[1]
    //Tandem
    M15L2 = Average[30,1](close) > Average[55,1](close)
    M15S2 = Average[20,1](close) < Average[50,1](close)

    Timeframe(default)

    //Trigger
    MACDLinie = MACDline[12,26,9](close) > 0
    MACDCross = MACD[12,26,9](close) crosses over 0

    MACDLinieshort = MACDline[12,26,9](close) < 0
    MACDCrossshort = MACD[12,26,9](close) crosses under 0

    TrendL = M15L1 and M15L2
    TrendS = M15S1 and M15S2

    long = MACDLinie and MACDCrossshort and TrendL

    short = MACDLinieshort and MACDCross and TrendS

    // trading window
    ONCE BuyTime = 153000
    ONCE SellTime = 210000

    // position management
    IF Time >= BuyTime AND Time <= SellTime THEN

    If long Then //not onmarket and
    buy PositionSize CONTRACTS AT MARKET
    SET STOP pLOSS hl
    SET TARGET pPROFIT hl*p

    ENDIF

    //If short Then //not onmarket and
    //sellshort PositionSize CONTRACTS AT MARKET
    //SET STOP pLOSS hs
    //SET TARGET pPROFIT hs*p2
    //
    //ENDIF

    endif

    if time >= 220000 then
    sell at market
    exitshort at market
    endif
    if time >= 215900 and dayofweek=5 then
    sell at market
    exitshort at market
    endif

    A2-M1-MACD-SP500.jpg A2-M1-MACD-SP500.jpg A2-M1-MACD-SP500.itf
    #211373 quote
    PeterSt
    Participant
    Master

    First IG (below). What can I be doing wrong ?
    TF is 1 minute. Nasdaq 1 euro. 200K bars. I did not change any parameter nor anything in the code. Spread is 0.4 per your own setting. Tick by Tick is on.

    image_2023-03-11_165731264.png image_2023-03-11_165731264.png
    #211375 quote
    phoentzs
    Participant
    Master

    The system is SP500 my dear. Spread 0.4. The joke is I couldn’t find a setting for Nasdaq with this functionality.

    #211377 quote
    MaoRai54
    Participant
    Master

    Hi,

    I’ve just downloaded this system.

    I’m running it in demo on SP500. I’m working to let it work also on short position and it seems it positively works.

    I’ve changed your original SL and TP ’cause it could do better than 10 pips. I’ve also modified the timeframes: 30M instead of 15 for short position, I’ve added a 3M timeframe for the trigger and left 1M as default.

    It seems to work quite well

    #211380 quote
    PeterSt
    Participant
    Master

    Bzzzp

    We had this issue before that I can’t find the SP500 you are using. The smallest is $50 and that leads to 341000 profit; you would not want that.

    What you see below is from IB and I think this is the contract amount you are using (see 2nd attachment). Please let me know.

    I added a fee of 1,34 per order (this is 1,34 for in and another 1,34 for out). I can’t see the spread currently, but I think it is 0.5 (I sustained the 0.4).

    image_2023-03-11_181145367.png image_2023-03-11_181145367.png image_2023-03-11_181226757.png image_2023-03-11_181226757.png
    #211383 quote
    JS
    Participant
    Senior

    Peter, I think you use two contracts with a value of 5 dollars per point, to compare you must use 1 contract with a value of 5 dollars per point…

    #211384 quote
    PeterSt
    Participant
    Master
    OK, thanks. This is with one contract.
    image_2023-03-11_184933174.png image_2023-03-11_184933174.png
    #211386 quote
    phoentzs
    Participant
    Master
    OK danke. Dies ist mit einem Vertrag.
    PRT-IB?
    #211387 quote
    phoentzs
    Participant
    Master
    Hallo, Ich habe gerade dieses System heruntergeladen. Ich lasse es in der Demo auf SP500 laufen. Ich arbeite daran, es auch auf Short-Positionen funktionieren zu lassen, und es scheint, dass es positiv funktioniert. Ich habe Ihr ursprüngliches SL und TP geändert, weil es besser als 10 Pips sein könnte. Ich habe auch die Zeitrahmen geändert: 30M statt 15 für Short-Positionen, ich habe einen 3M-Zeitrahmen für den Trigger hinzugefügt und 1M als Standard belassen. Es scheint ganz gut zu funktionieren
    Could you post your code?
    #211388 quote
    MaoRai54
    Participant
    Master
    Yes, I’ll do but after my tests
    #211389 quote
    PeterSt
    Participant
    Master
    Phoentzs, you did not ask for it, but in the first screenshot you see the mouse at the bottom on ~ half September 2022. It is where the zero line is (1M bars were used here). The second screenshot shows where you would have started backtesting. This is where the deepest dip is. Thus, quite over-optimized, I’d day. Of course with this I am referring to my other post from this morning. And Yes, I know that you like to regularly re-optimize, so no problem. The fun is that you can see by this that indeed it is over-optimized. I use this to test myself (did I really not over-optimize too much ?). It requires one thing only : never optimize over that spare bars available (200K bars back up to 1M back).
    image_2023-03-11_185608012.png image_2023-03-11_185608012.png image_2023-03-11_185825076.png image_2023-03-11_185825076.png
    #211393 quote
    phoentzs
    Participant
    Master
    Please test over 1 million bars without the tandem filter. Just comment out “M15L2″… I would be interested.
    #211397 quote
    PeterSt
    Participant
    Master
    #211400 quote
    phoentzs
    Participant
    Master
    In this TF you just have to optimize it regularly. You can’t get around it.
    #211401 quote
    PeterSt
    Participant
    Master
    Which TF are you referring to ? 15 minutes or 1 minute ? I use both in the one strategy and I never ever – even want to – change it. That put differently : in my view it is not the way to re-optimize such (entry-dependent) things. But I already told : you think differently here and that is fine.
Viewing 15 posts - 1 through 15 (of 19 total)
  • You must be logged in to reply to this topic.

MACD-Strategy M1 SP500


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
phoentzs @phoentzs Participant
Summary

This topic contains 18 replies,
has 5 voices, and was last updated by phoentzs
2 years, 11 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/11/2023
Status: Active
Attachments: 14 files
Logo Logo
Loading...