A simple trend following strategy built with MACD default settings and ADX.
Orders are launched when the MACD cross the 0 level line and with ADX minimal value condition.
Orders have stoploss and takeprofit.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
defparam cumulateorders = false indicator = macd[12,26,9] n = 1 adxmin = 5 profitti = 70 perdite = 60 cl = indicator crosses over 0 and summation[n](indicator[1]<0)=n and adx[14]>adxmin cs = indicator crosses under 0 and summation[n](indicator[1]>0)=n and adx[14]>adxmin if cs then sellshort 2 contract at market endif if cl then buy 2 contract at market endif set target pprofit profitti set stop ploss perdite |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :
Filename : download the ITF files
How to import ITF files into ProRealTime platform?
PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Hi Francesco,
Maybe I didn’t undersdant well your strategie but it’s looks like have a mistake In the short part : “cs = indicator crosses under 0 and summation[n](indicator[1]>0)=n and adx[14]>adxmin”
Should be for adx[14]
Isn’t it ?
Well, I just checked the Adx advices And I understand the meaning of your code (trend) , did you try with: “Adx Adxr” ?
Hi, no I didnt try with ADXr but you are more than welcome to post some results of your ideas based on my strategies.
Thank you
DId some tests using MACD validations on higher timeframes using MTF functionality and unfortunately couldn’t get improved results without tweaking other parameters (i.e. SL and TP) as well. Leading me to believe that either higher timeframe validations on MACD are not beneficial or the TP and SL parameters are too optimized. Either way, I like the simplicity of the strategy.
Hi Francesco I tried with :
adx[14]>adxmin and adx[14] > adxr[14] and adx[14]>adxmin and adx[14] DIminus[3](close) and DIplus(close)>adxmin and DIplus[1](close)adxmin and even with optimisation of “adxmin ” not better than your code
Hello,
I’m new to ProRealCode and I do not understand the following
summation[n](indicator[1]<0)=n
Can you explain it to me please ?
Thanks
It seems he’s just checking that the previous MACD is < 0 for maximum one period ? I'm new too so I may be wrong
Hi do you know how have and entry after the second cross? There is crosses below 0 and crosse about 0 I am looking to have an entry when we have a cross below and after about