Volume & Donchian – Daily Break Out trade
Forums › ProRealTime English forum › ProOrder support › Volume & Donchian – Daily Break Out trade
- This topic has 1 reply, 1 voice, and was last updated 8 years ago by Per.
-
-
10/26/2016 at 7:58 PM #15597
Intro to the strategies which is based on my view of a Daily trend break out:
- The Close is > DonchianUp (40 day )
- Volume > 1,5 Volume[20]
- 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:
1234567891011121314151617181920212223242526272829303132REM Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivatedREM Basic Condition to trademyPriceCriteria = Close > 5.00myVolumeCriteria = (Average[20](volume) > 100000)myMA40 = Average[40](Close)myMA120 = Average[120](Close)myBullCriteria = myMA40 > myMA120c1 = myPriceCriteria and myVolumeCriteria and myBullCriteriaREM Trigger to enter long positions// Condition 1 - DoncianUP - Break outmyDonchianUp = (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 = myBOVolumeREM Trading target = Trailing Stop loss based on ATRmyATR = 4*averagetruerange[20]IF C1 AND C2 AND C3 THENIf myATR > 30 THENBUY ((30/myATR) * close) CASH AT MARKETELSIF myATR <= 30 THENBUY 1500 CASH AT MARKETELSEENDIFENDIFSET STOP TRAILING myAtrI 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
10/27/2016 at 7:35 PM #15651I 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 closeIF 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 mySLThe weakness is:
- Small position at high ATR
- Fluctuation of the ATR gives an innacurate SL
-
AuthorPosts
Find exclusive trading pro-tools on