Mr Mubashar virk Many thanks for this superfast reply. Real kind of you to provide me the code you have separated trend in a good way warm regards keep your spirit up ford ps please refer to following I am sure you must be well aware of it. ========================================================== /* Formula Name: Trend Exploration: Slope Moving Average Author/Uploader: marcus - marcusdavidsson Date/Time added: 2009-09-20 06:38:06 Origin: Keywords: Level: basic Flags: exploration ========================================================== take care
--- In amibroker@yahoogroups.com, Mubashar Virk <mvir...@...> wrote: > > //uptrend > event1 = IIf(C > MA(C,20),20,0); > event3 = IIf(C>MA(C,50),35,0); > event5 = IIf(C>MA(C,200),45,0); > > // downtrend > event2 = IIf(C < MA(C,20),-20,0); > event4 = IIf(C < MA(C,50),-35,0); > event6 = IIf(C < MA(C,200),-45,0); > > totalscore = event1 + event2 + event3 + event4 + event5 + event6; > > // Plot(totalscore, "" , colorRed); > > Filter = 1; > > AddColumn (totalscore , "Score", 1.0); > > Trend = > WriteIf(totalscore == 100, "Strong Uptrend", > WriteIf(totalscore >= -40 OR totalscore <= 40 OR totalscore > 0 AND > totalscore <= 40, "Neutral", // this argument needs to be written more > accurately. > WriteIf(totalscore > 40 AND totalscore <= 99, "Uptrend", > WriteIf(totalscore < -40 AND totalscore <= -99, "Downtrend", > WriteIf(totalscore == -100, "Strong Down Trend", > ""))))); > > On 8/8/2010 10:43 AM, ford7k wrote: > > > > > > Hi afl experts > > > > I am trying to make an afl code. > > This code uses points alloted to each event like > > price above 20dma =20, > > price above 50dma=35 pointr, > > price goes above 200=45 points. > > > > if the opposite happens,score is negative, > > price cross below 20ma= -20 points > > price cross below 50ma = -35 points > > price cross below 200dma = -45 points > > > > I like to see the total score at current time or current day or anyday > > on screen or in exploration > > > > Can I try this way > > event1 > > iif(c > ma(c,20),20,0); > > event3 > > iif(c>ma(c,50),35,0); > > event5 > > iif(c>ma(c,200),45,0); > > > > event2 > > iif(c < ma(c,20),-20,0); > > event4 > > iif(c < ma(c,50),-35,0); > > event6 > > iif(c <ma(c,200),-45,0); > > > > total score = > > example > > currently event1 occured,event3 occured and event6 occured > > the score is =5 > > current total score = 20+30+(-45) =5 means mild uptrend or neutral > > > > suppose > > event1 + event2 +event 3 occured then > > total score =20+35+45=100 strong uptrend occured > > time to initiate longs > > suppose > > event2 +event4+event6 occured, > > we get total score =-100 strong downtrend-time to initiate shorts > > > > the score summation was used in,Mr Hiutels against all odds. afl > > > > I just gave the line of my thinking > > please give some help > > > > regards > > thanks > > ford > > > > >