NDQ mean reversion 5 min Strategy

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #210763 quote
    coincatcha
    Participant
    New

    Hi crew,

    Here I have taken a 1 min trade to a 5 min version that looks ok. It was a challenge to myself to create something with less limitations ie. time, hard stops etc. I cannot get it to run however and believe it’s to do with the MTF. I have used this feature to filter many trades but never had a problem.

    I can have it in my live portfolio but does not execute or get rejected, can someone please take a look? It should be trading in this environment.

    There is further work to be done on it’s entry, but for the most part seems ok.

    // Definition of code parameters
    DEFPARAM CumulateOrders = false // Cumulating positions deactivated
    // The system will cancel all pending orders and close all positions at 0:00. No new ones will be allowed until after the "FLATBEFORE" time.
    DEFPARAM Preloadbars = 10000
    
    
    //Read market strucure
    timeframe (30 minute,updateonclose)
    indicator1 = ExponentialAverage[100]
    c1 = (close < indicator2[1])
    
    // Conditions to enter long positions
    timeframe (default)
    c2 = (close < low[3])
    indicator2 = Average[1000](close)
    c3 = (indicator2 <= indicator2[100]) 
    c4= (close <= indicator2)
    Indicator3 = ExponentialAverage[10]
    Indicator4 = ExponentialAverage[20]
    c5 = (Indicator4 CROSSES OVER indicator3) 
    
    
    Once MaxLoss    = 50
    Once TempProfit = 0
    Once TradeON    = 1
    If IntraDayBarIndex = 0 Then
    TempProfit = StrategyProfit
    TradeON    = 1
    Endif
    If TempProfit - StrategyProfit >= MaxLoss then
    TradeON = 0
    Endif
    
    
    IF c1 AND c2 AND c3 AND c4 AND c5 AND TradeOn THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions to exit long positions
    indicator5 = ExponentialAverage[50](close) 
    c6 = (close CROSSES Under indicator5[0])
    indicator6 = Volume
    c7 = (indicator6 < 2000[3]) //volume specific to current NDQ environment. Needs % version for robustness
    c8 = (close < open[2]) //boosts profits!
    
    
    IF c6 OR c7 AND c8 THEN 
    SELL AT MARKET
    ENDIF
    
    #210782 quote
    robertogozzi
    Moderator
    Master

    Line 10 should read:

    c1 = (close < indicator1[1])  //instead of c1 = (close < indicator2[1])

    and line 47 should read:

    IF OnMarket AND (c6 OR c7 AND c8) THEN
    coincatcha thanked this post
    #210805 quote
    coincatcha
    Participant
    New

    Line 10 should read:

    <!– Crayon Syntax Highlighter v_2.7.2_beta –>

    <!– [Format Time: 0.0002 seconds] –> and line 47 should read:

    <!– Crayon Syntax Highlighter v_2.7.2_beta –>

    <!– [Format Time: 0.0002 seconds] –>

    Thanks, and thanks for the MAX loss code I use it in everything and it has kept me safe.

    I liked the back test results with the failed code much better!

    Uh, back to the drawing board…I’ll poke around with it a bit longer. The 1 min version has been in profit for 6 months so I’m sure there is something in the concept of this counter trend trade.

    #210814 quote
    coincatcha
    Participant
    New

    The 30min TF filter is neither here nor there to be honest. If I code the bot correctly it’s for the bin.

    Regards the Exit conditions of my inactive code (c6 OR c7 AND c8), without correct format of “IF OnMarket THEN” What exactly have I asked it to do?

    Because it does something which makes it amazing = 10%DD and 60%WR, 50% Annualized. It goes ballistic in a ‘bear mrkt’ and holds itself  in a grinding trend.

    Be honest, is this fools gold? Anyone?

     

    Cheers CC

     

    File attached is incorrect code and what I thought I was building!

    NASDAQ-5-minutesFOOLSGOLD.png NASDAQ-5-minutesFOOLSGOLD.png
    #210821 quote
    robertogozzi
    Moderator
    Master

    IF OnMarket THEN” simply makes SELL (which means exit from a Long position) only IF ONMARKET, otherwise your code will end up BUYing in line 36, then SELLing immediately in line 48 before any position is even opened (and you will be returned empty reports).

    coincatcha thanked this post
    #210822 quote
    robertogozzi
    Moderator
    Master

    Beear in mind that backtests are only based (and optimized for) the past. There’s no forecasting skill in it!

    So, it’s wise to let any code run in autotradimg on a demo account for several months before letting it manage real money!

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

NDQ mean reversion 5 min Strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
coincatcha @coincatcha Participant
Summary

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

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