Price action strategy cant WF test correctly/missing orders

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

    Hi, I made a mostly price action strategy that also uses some moving averages. The result seems fine but despite having a MA-filter for positions it still longs under the Ma allowed.

    The other problem i have is when i forward test the longs disappears, PRT wont execute the trades! If i add some more conditions they disappear aswell.

    This is Dax 1h timeframe.

    Does anyone know the solution to these problems?

    Kind regards,

    Anders

    DEFPARAM CumulateOrders = false
    K = 3
    l = 40
    Higher =high[k] > highest[l](close)
    Lower = low[k] - lowest[l](close)
    HigherShort =high[l] - highest[k](close)
    LowerShort = lowest[k](close) - low[l]
    Ma = exponentialaverage[80]
    ma2 = exponentialaverage[50]
    ma3 = average[3000]
    n = 1.5                                //contracts
    
    
    c1 = close > ma3 and close > ma and Higher and lower > 15 and time => 091500 and time <= 190000
    c2 = close crosses under ma2
    c3 =close < ma and Highershort <-30 and LowerShort and time => 091500 and time <= 190000 and close < ma3
    c4 = close crosses over ma2
    
    If c1 then
    buy n contract at market
    endif
    
    if c2 and longonmarket then
    sell at market
    endif
    
    If c3 then
    sellshort n contract at market
    endif
    
    if c4 and shortonmarket then
    buy at market
    endif
    
    
    SET STOP ptrailing 140
    SET TARGET PROFIT 300
    
    Higher-highs-FW.png Higher-highs-FW.png hh-FW.png hh-FW.png
    #104221 quote
    robertogozzi
    Moderator
    Master

    From the atteched pics I can’t see where your three MA’s are.

    Since at line 14 you don’t check MA2, close can be lower than that.

    #104238 quote
    GraHal
    Participant
    Master

    Line 32 should read as below (not Buy to exit a Short trade) …

    ExitShort at Market
    robertogozzi thanked this post
    #104240 quote
    Ander5
    Participant
    New

    Thank you both for replying.

    I changed the code to exitshort grahal, thank you for the tip! i’ve only been coding for a week so im still learning. That fixed my problem with the longs below the moving average!

    ma = powerful enough trend to long/short, ma2 = ema to stop trades that have weak trends, and ma3 should be the one that decides if to short or long, sorry for the confusion.

    The Ma visible on the pictures is the long/short filter. The long trades are all visible during regular backtests but during WF almost all of them disappear. 107 trades is missing..

    #104260 quote
    Ander5
    Participant
    New

    Problem solved by using

    DEFPARAM PRELOADBARS = 10000000
    #104261 quote
    robertogozzi
    Moderator
    Master

    Max preload bars is 10K, no matter what you write.

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

Price action strategy cant WF test correctly/missing orders


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Ander5 @ander5 Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/05/2019
Status: Active
Attachments: 2 files
Logo Logo
Loading...