Find Stocks To Buy for Amibroker (AFL)
soigau over 8 years ago Amibroker (AFL)
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
//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;
H3=HHV(H,26);
L3=LLV(L,26);
AddColumn(C,"Cur_Price");
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);6 comments
Leave Comment
Please login here to leave a comment.
Hi Friends, You should print something
Thanks
thank you so much, this code I have been looking for so long. great
@soulme @Hobathanh2012: Hope it’s helpful to you
thank you how do you choose stop loss and take profit?