Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Find Stocks To Buy for Amibroker (AFL)

3 / 5 (Votes 4)
amibroker, exploration, scan

Hi Friends, this is very simple and efficient exploration code for detection buy signal.

This formula’s buy rule is composed of the following conditions:

- Closing price is higher than the 15 day moving average.
- Todays close is higher then yesterdays
- Over the past 5 days the price hasn’t risen by more then 5%
- Todays money flow index value is greater then yesterdays.

By soigau

Indicator / Formula

Copy & Paste Friendly
//Buy Signal
Cond1 = C > MA (C, 15);
Cond2 = MACD (7,15) >= Signal (7,15,3);//MACD cross up
Rate = (C-Ref (C,-1))/Ref (C,-1);
Cond3 = Rate >= 0;
HP = HHV (Ref (C, -1), 5);
LP = LLV (Ref (C, -1), 5);
Cond4 = HP <= 1.05*LP; //  the percentage change in price (5%)
Cond5 = MFI (14) >= Ref (MFI (14), -1);
Cond_Price = C >= 1;
Cond_Volume = V > 10000;
Buy = (Cond1 AND Cond2 AND Cond3 AND Cond4 AND Cond5 AND Cond_Price AND Cond_Volume);
//Signal filtering
Cond6 = (HHV(High,360)-LLV(Low,360))/LLV(Low,360)*100 >= 50; 
Filter = C>= Ref(C,-1) AND C>= Ref(C,-2)
AND C<= 7 AND C*V>100000
AND Cond6
AND Ref(V,-2)>10000 AND Ref(V,-1)> 15000;
AddColumn( H3,"Highest");
AddColumn( L3,"Lowest");
AddColumn(Ref(V,-1),"Volume -1 day");
AddColumn(((C - Ref(C,-1))/Ref(C,-1))*100 ,"% Change of Price ");
AddColumn(((V - MA(V,21))/MA(V,21))*100 ,"% Change of Volume");
AddTextColumn(WriteIf((Cond1 AND Cond2 AND Cond3 AND Cond4 AND Cond5 AND Cond_Price AND Cond_Volume)> 0,"Buy",""),"Signal");
AddSummaryRows(16, 1.2,5);


1. ll98123

Hi Friends, You should print something

2. soulme


3. Hobathanh2012

thank you so much, this code I have been looking for so long. great

4. soigau

@soulme @Hobathanh2012: Hope it’s helpful to you

5. kevinleijh

thank you how do you choose stop loss and take profit?

Comment hidden - Show

Leave Comment

Please login here to leave a comment.