Basic AFL help needed

wabuf

Well-Known Member
#1
hello afl experts

i have started afl editing two days ago only.

i want this condition to run

Short = RSI( 14 ) > 80
PlotShapes(IIf(Short==1, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-20);

the prob is , rsi stays above 80 for 30 mins , i want only a single down arrow not for the whole duration of rsi staying above 80. this is what i am getting all red down arrows :lol:

what i am doing wrong ?
 
#2
hello afl experts

i have started afl editing two days ago only.

i want this condition to run

Short = RSI( 14 ) > 80
PlotShapes(IIf(Short==1, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-20);

the prob is , rsi stays above 80 for 30 mins , i want only a single down arrow not for the whole duration of rsi staying above 80. this is what i am getting all red down arrows :lol:

what i am doing wrong ?
Before asking if u have searched on google u will get many references of it.

https://www.amibroker.com/guide/afl/exrem.html
http://www.traderji.com/amibroker/74204-how-avoid-multiple-buy-sell-signals-same-scrip.html
 

vijkris

Learner and Follower
#3
hello afl experts

i have started afl editing two days ago only.

i want this condition to run

Short = RSI( 14 ) > 80
PlotShapes(IIf(Short==1, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-20);

the prob is , rsi stays above 80 for 30 mins , i want only a single down arrow not for the whole duration of rsi staying above 80. this is what i am getting all red down arrows :lol:

what i am doing wrong ?
or u can use cross function as well.
BTW short when rsi>80 is bit confusing..
 

wabuf

Well-Known Member
#4
ty man , i am really new to coding .
 

wabuf

Well-Known Member
#5
i thought cross was only for ema and ma crossing :|
 

vijkris

Learner and Follower
#6
i thought cross was only for ema and ma crossing :|
i m not a professional coder like ankur. i have learnt it on my own. the trick to learn is first read help file which has detailed explanation of meaning of arrays etc.
thenn there r so many working afls in net and even TJ.
copy them and load it in ami.
open the afl and start reading it line by line and try to see help file regarding the commands used.
simple strategies can easily be coded. for me loops is very difficult and didn understand it much..:(
 
#7
i m not a professional coder like ankur. i have learnt it on my own. the trick to learn is first read help file which has detailed explanation of meaning of arrays etc.
thenn there r so many working afls in net and even TJ.
copy them and load it in ami.
open the afl and start reading it line by line and try to see help file regarding the commands used.
simple strategies can easily be coded. for me loops is very difficult and didn understand it much..:(
I am not too experienced only 3-4 years of experience.:p
loops are easy just u have to put initial value, condition of ending and increment/decrement the initial value.

It's really good to hear that you have learnt it by your known...:thumb:
 

LOVEENAJYOTHI

Well-Known Member
#8
hello afl experts

i have started afl editing two days ago only.

i want this condition to run

Short = RSI( 14 ) > 80
PlotShapes(IIf(Short==1, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-20);

the prob is , rsi stays above 80 for 30 mins , i want only a single down arrow not for the whole duration of rsi staying above 80. this is what i am getting all red down arrows :lol:

what i am doing wrong ?

That is bcoz---> ur above code is NOT COMMANDING ur AmiBroker to SHUT UP once ur condition is achieved so what it thinks is u like playing holi with ColorRed and Gleefully Splashes Red Arrows as & when ur condition is met irrespective of of an open SHORT signal present in the previous Bar/s,
[ NOTE: Open SHORT Signal = a SHORT Signal which is Not Yet Covered by either Cover signal or BUY signal ]

Fortunately Ami has a simple solution to ur above prob ---> all u hafta do is add ExRem (Excess Remove) code after ur BUY, SHORT Conditions-- > see below

Code:
Buy=Ur Buy Condtn;
Sell=Ur Sell Condn;
Buy=ExRem(Buy,sell);
Sell=ExRem(Sell,buy);
Short=Ur Short Condtn;
Cover=Ur Cover Condtn;
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,short);
Now all ur Excess arrows will b Removed and a New Short (or Buy) arrow will appear only if the Previous Short (or Buy) entry was exited.
 
Last edited:

bunti_k23

Well-Known Member
#9
i m not a professional coder like ankur. i have learnt it on my own. the trick to learn is first read help file which has detailed explanation of meaning of arrays etc.
thenn there r so many working afls in net and even TJ.
copy them and load it in ami.
open the afl and start reading it line by line and try to see help file regarding the commands used.
simple strategies can easily be coded. for me loops is very difficult and didn understand it much..:(
now this is the best thing, i too have learnt little bit of coding on my own by by copy pasting the formulas and editing them by understanding some things....:)
 

bunti_k23

Well-Known Member
#10
hello afl experts

i have started afl editing two days ago only.

i want this condition to run

Short = RSI( 14 ) > 80
PlotShapes(IIf(Short==1, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-20);

the prob is , rsi stays above 80 for 30 mins , i want only a single down arrow not for the whole duration of rsi staying above 80. this is what i am getting all red down arrows :lol:

what i am doing wrong ?

u need to use only this function in ur afl,just copy and paste this,

///////////////////////
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

Buy[BarCount-1]=Null;
Sell[BarCount-1]=Null;

Cover=Buy;
Short=Sell;



shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorWhite, colorWhite ),0, IIf( Buy, Low, High ) );


////////////////

just save this code and use in any afl u just need to define the buy and sell conditions thats it.:thumb:
 

Similar threads