[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Simple Query



PureBytes Links

Trading Reference Links

Try this - it's one way of doing it - there are many ways - and I added the reverse of your buy signals for sell signals so you can see how it would work both directions.

Buy1 = Cross(Ref(Close,-2), Ref (MA(Close, 50),-2));

Buy2 = Ref(Close,-1)> Ref (MA(Close, 50),-1);

Buy3 = Close > MA(Close,50);

Buy = Buy1 AND Buy2 AND Buy3;

Plot (Buy,"Buy",colorGreen,styleOwnScale + styleArea,0,2);

Sell1 = Cross ( Ref (MA(Close, 50),-2), Ref(Close,-2));

Sell2 = Ref(Close,-1) < Ref (MA(Close, 50),-1);

Sell3 = Close < MA(Close,50);

Sell = Sell1 AND Sell2 AND Sell3;

Plot (Sell,"Sell",colorRed,styleOwnScale + styleArea,0,2);

I separated each into three statements for clarity of intent - one for each condition - first day cross, second day and third days still above (or below respectively) the moving average........... and gave you a plot of the buy and sell signals if you want to use this in a separate indicator from the arrows on the price chart for testing or whatever.

Good luck, the initial learning curve is steep, but sweet.............

Mike

 

 

----- Original Message -----
From: Sam Baskar
Sent: Wednesday, February 02, 2005 2:29 PM
Subject: [amibroker] Simple Query


I know this must be in the manual some where..

Can anyone write me a quick Buy condition
that if the stock closed up - last 3 days above the 50 day moving Average?

Please no flames.....

-- thanks -- newbie.





Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html




Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html




Yahoo! Groups Links