How To Optimize An ADX Breakout (Amibroker Code)
The strategy in plain English:
This post is about optimizing a strategy using the ADX indicator. We test the following:
- ADX ends the day at an n-bar high
- DI+ is higher than DI-
- We sell when the DI+ ends below DI-
Click here to see the original article.
Amibroker code:
ADXdays=Optimize(“ADXdays”,40,5,50,5);
ADXhighOpt=Optimize(“ADXhighOpt”,20,5,50,5);
ADXhigh=HHV(ADX(ADXdays),ADXhighOpt);
Buy= ADX(ADXdays)>Ref(ADXhigh,-1) AND PDI(ADXdays)>MDI(ADXdays) ;
buyPrice=Close;
Sell= PDI(ADXdays)<MDI(ADXdays); //PDI is the DM+ and MDI is the DI-
sellPrice=Close ;
Disclosure: We are not financial advisors. Please do your own due diligence and investment research or consult a financial professional. All articles are our opinions – they are not suggestions to buy or sell any securities.
