A Simple query on AFL

shanki99

Well-Known Member
#1
Some one plz help me

I have little knowledge on AFL

My query is how do we write an AFL for back-testing purpose--

1. Buy ONLY when the High of the current bar is breached in the next bar

2. Make SL as below the low of the current bar (SL triggers only when the low is breached)

In the Backtesting >>Settings>>Trades tab, we can set, when a trade can be effected, like setting it as High, Close etc.
But in back-test results, it shows that the trade is effected/done at the High price (when set as High), even though the next bar doesn't even touch the high of the current bar.
So i presume that we need to hard-code this in the form of AFL rather depend on the Settings page of Back-testing option within Auto Analysis menu.

Some one plz help
 
#2
shanki99,

I think the following will serve the purpose

SetChartOptions(0,chartShowArrows|chartShowDates);
GraphXSpace=5;
Plot(C,"Shanki99 Buy Sell",colorBlack,styleCandle);
x = Ref(H,-1);
SL = Ref(L,-1);
Buy = Cover = C > x;
Sell = Short = C < SL;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,L,-15);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,H,-15);

vidyasagar
 
#4
Help needed to make afl

AFL and exploration required on intraday chart. of ONLY TODAYS DATE.

conditions to generate buy signals: on any 1 condition.
1.when any time frame candle(1 min, or 3 min ) cross open price of today.
2.when current price rebound 2.5% from low.
3.new high is generated.

conditions to generate sell signals:eek:n any 1 condition.
1.when current price make new low,
2.when price is below open.
thanks
 
Thread starter Similar threads Forum Replies Date
M AmiBroker 1
R Options 2
S Commodities 1
abhijit sen Options 3
S Equities 2

Similar threads