Volume & Donchian – Daily Break Out trade

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #15597 quote
    Per
    Participant
    Average

    Intro to the strategies which is based on my view of a Daily trend break out:

    1. The Close is > DonchianUp  (40 day )
    2. Volume > 1,5 Volume[20]
    3. Buy on the next day open.
    The strategy criteria is:
    • Duration – 4-5 monts
    • Ref. index – SPY, which shall be BULL ie. MA 65D > 195D
    • The instrument, shall be BULL i.e. MA 40D > 120D
     The target is based on a ATR based trailing stop loss that is optimize by the parameter optimization function (it varies from instrument to instrument as 5-8 x ATR).

    Here is the code:

    REM Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    REM Basic Condition to trade
    myPriceCriteria = Close > 5.00
    myVolumeCriteria = (Average[20](volume) > 100000)
    myMA40 = Average[40](Close)
    myMA120 = Average[120](Close)
    myBullCriteria = myMA40 > myMA120
    c1 = myPriceCriteria and myVolumeCriteria and myBullCriteria
    
    REM Trigger to enter long positions
    // Condition 1 - DoncianUP - Break out
    myDonchianUp = (highest[40](high[1]))
    //myDonchianDown = LOWEST[40](LOW[1])
    c2 = close >= myDonchianUp
    //Condition 2 - Daily volume-breaks up > 1,5 x Volume(average) (20)
    myBOVolume = Volume > 1.5*(Average[20](Volume))
    c3 = myBOVolume
    
    REM Trading target = Trailing Stop loss based on ATR
    myATR = 4*averagetruerange[20]
    
    IF C1 AND C2 AND C3 THEN
    If myATR > 30 THEN
    BUY ((30/myATR) * close) CASH AT MARKET
    ELSIF myATR <= 30 THEN
    BUY 1500 CASH AT MARKET
    ELSE
    ENDIF
    ENDIF
    SET STOP TRAILING myAtr

    I ran a back-test on a NYSE stock (GOL LINHAS …) , with this outcome:

    The ProOrder order part (bellow t REM Trading target = Trailing Stop loss based on ATR) is  a challenge as it does not place trades.

    I have been reading the manual and seen lots of support on this site, while eventually seeking an advice so to progress with the development of this back testing script.

    Hoping for a positive reply.

     

    Best regards,

    Per Inge

    #15651 quote
    Per
    Participant
    Average

    I found the following money management setup, to which I will appreciate any comment to code enhancements:

    REM Trading target = Trailing Stop loss based on ATR a changing ATR
    myATR = averagetruerange[20]
    mySL = myATR * 5
    myBetSize = 1500*0.03 //3% loss,  unit of $1500 = $45
    myNoOStock = myBetSize/mySL //No of stocks at SL is = $45 (if ATR was fixed)
    myPosSize = myNoOStock * close //No. of stocks x close

    IF C1 AND C2 AND C3 THEN
    If myPosSize > 1500 THEN
    BUY 1500 CASH AT MARKET
    ELSIF myPosSize <= 1500 THEN
    BUY myPosSize CASH AT MARKET
    ELSE
    ENDIF
    ENDIF
    SET STOP TRAILING mySL

    The weakness is:

    • Small position at high ATR
    • Fluctuation of the ATR gives an innacurate SL
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Volume & Donchian – Daily Break Out trade


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Per @periho Participant
Summary

This topic contains 1 reply,
has 1 voice, and was last updated by Per
9 years, 3 months ago.

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