My First DAX 15 min Code

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #7265 quote
    Robert975
    Participant
    Junior

    Hi there, this is my first dax code made with PRT. Like to learn from it. So don’t use it to trade. Don’t know of this test is good so let’s make this a coding lesson.

    I used the MA 20 and MA 8 to enter positions.

    Test shows results in 15 / 30 / 1 H / 4 H and daily time frames.

    I guess its a false signal.

    So don’t blame me, let’s learn

    So here is the code

     

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Conditions to enter long positions
    indicator1 = ExponentialAverage[8](medianPrice)
    indicator2 = ExponentialAverage[20](medianPrice)
    c1 = (indicator1 CROSSES OVER indicator2)
    
    IF c1 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions to exit long positions
    indicator3 = ExponentialAverage[8](medianPrice)
    indicator4 = ExponentialAverage[20](medianPrice)
    c2 = (indicator3 CROSSES UNDER indicator4)
    
    IF c2 THEN
    SELL  AT MARKET
    ENDIF
    
    // Conditions to enter short positions
    indicator5 = ExponentialAverage[8](medianPrice)
    indicator6 = ExponentialAverage[20](medianPrice)
    c3 = (indicator5 CROSSES UNDER indicator6)
    
    IF c3 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions to exit short positions
    indicator7 = ExponentialAverage[8](medianPrice)
    indicator8 = ExponentialAverage[20](medianPrice)
    c4 = (indicator7 CROSSES OVER indicator8)
    
    IF c4 THEN
    EXITSHORT  AT MARKET
    ENDIF
    
    // Stops and targets
    SET STOP %LOSS 1 %TRAILING 1
    SET TARGET %PROFIT 3
    SET TARGET $PROFIT 25
    SET STOP PTRAILING 5
    germany-cash-mini-my-dax-codepng-1463421414p48cl1.png germany-cash-mini-my-dax-codepng-1463421414p48cl1.png
    #7283 quote
    Adolfo
    Participant
    Senior

    Hi Robert, great job!

    If you want to be more accurate, don’t set profit targets and see results.

    The point is that your conditions are only tested once at bar, if your profit is reached at same candle, even if market goes against you, backtest shows you in a profit.

    This issue will be soon fixed by ProRealTime developers team.

    Cheers!

    Nicolas and Robert975 thanked this post
    #7563 quote
    Robert975
    Participant
    Junior

    Oke, Thank’s Adolfo

    I’ll see what it does without them

     

    Have a nice weekend.

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

My First DAX 15 min Code


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Robert975 @robert975 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Robert975
9 years, 9 months ago.

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