AFL help needed to plot lines

amitrandive

Well-Known Member
#1
Dear All

A post from ST Sir



See those magenta colour lines on the chart ? Those are the lines showing gaps in the earlier top and the reaction bottom after breaking the tops....these gaps show that the trend is strong and about to blow off.. .... After such gaps the trend accelerates.....you can see that on any chart, any time frame......if coupled with other techniques, it gives great confidence to hold the positions, add and wait till the trend is about to end.....

Smart_trade
I need an AFL to plot the lines similar to the magenta lines as shown in the chart.

The idea behind that is

Those are the lines showing gaps in the earlier top and the reaction bottom after breaking the tops...Referring to the gap between the Pivot high market breaks to the upside and the Pivot low or reaction low after the high is broken. If there is no such gap and market breaks the top,and reacts and gets into the top it broke...that trend is called a creeping trend which is weak and as a general rule indicates that market is near its reversal ( there are certain exceptions though....).

Appreciate all the help.
 

mastermind007

Well-Known Member
#3
Dear All

A post from ST Sir





I need an AFL to plot the lines similar to the magenta lines as shown in the chart.

The idea behind that is

Those are the lines showing gaps in the earlier top and the reaction bottom after breaking the tops...Referring to the gap between the Pivot high market breaks to the upside and the Pivot low or reaction low after the high is broken. If there is no such gap and market breaks the top,and reacts and gets into the top it broke...that trend is called a creeping trend which is weak and as a general rule indicates that market is near its reversal ( there are certain exceptions though....).

Appreciate all the help.

Amit, Can you outline of logic for the AFL here ...
 

amitrandive

Well-Known Member
#4
Amit, Can you outline of logic for the AFL here ...
What I got from ST Sir

See those magenta colour lines on the chart ? Those are the lines showing gaps in the earlier top and the reaction bottom after breaking the tops....these gaps show that the trend is strong and about to blow off.. .... After such gaps the trend accelerates.....you can see that on any chart, any time frame......if coupled with other techniques, it gives great confidence to hold the positions, add and wait till the trend is about to end.....
 

casoni

Well-Known Member
#5
Here's the possible concept of the lines :)

share your views ,if this looks perfect we can proceed furthur

Thank you
 
Last edited:

amitrandive

Well-Known Member
#6
Here's the possible concept of the lines :)

share your views ,if this looks perfect we can proceed furthur

Thank you
Casoni

Though the image is not clear,it looks conceptually okay.

We need to draw the gap lines,if these gap lines are there,we can assume a strong trend forthcoming.
 

mastermind007

Well-Known Member
#7
Casoni

Though the image is not clear,it looks conceptually okay.

We need to draw the gap lines,if these gap lines are there,we can assume a strong trend forthcoming.
Amit, Casoni


Essentially entire AFL coding circles around identifying a particular candle (the chosen candle) that fits certain rules. As long as we can pin-point the rules, we can make the AFL.

For example, in the chart displayed by amit, some of the rules are
1) We identify a candle that has made a higher high relative to the candle that was M bars ago.
2) Our chosen candle must not be making a higher high relative to N bars previous.
3) The Low of chosen candle must be higher than Low of Candle M bars ago but not higher than Low of candle N bars ago.
..... and so on ....
Here, M == integer; N == M / 2 thru to (M - 1);
So if M is 10, N is from 5 to 9.

You need to evolve what ST said into a logic such as above for it to be converted into the AFL.

Do bear in mind that when we manually identify candle, we may sometimes miss a valid one and sometimes make incorrect choices... AFL will not make the same mistakes...

After all this AFL geeky stuff, I have one idea that is a lot simpler to identify what ST identifies by means of Gaps.

If you have BNF data from the time period ST shows on chart, simply plot MA(L, 20) on it. My hunch is that in all the middle periods (the hold-on periods), Low would not breach the average. You may even use EMA....
 

Raghuveer

Well-Known Member
#8
Here's the possible concept of the lines :)

share your views ,if this looks perfect we can proceed furthur

Thank you
I think ST's gap concept is like this:
In uptrend: Find a PH called PH1. Find a higher PL called PL2. If PL2 minus PH1 is greater than user defined minimum gap, then we have ST's gap.
In downtrend: Find a PL called PL1. Find a lower PH called PH2. If PL1 minus PH2 is greater than user defined minimum gap, then we have ST's gap.
In sideways: not applicable.

By how much PL must be greater than PH can be left to the parameters (% and/or absolute number).
Entry/exit signals not required as they depend on one's method.
Also scan/explore capability in various TF's will be ideal.

ST's gap is explained in detail in his "Thoughts on day trading and swing trading". http://www.traderji.com/day-trading/49521-thoughts-day-swing-trading-9.html#post540250
There are some charts with ST's gap shown:
http://www.traderji.com/day-trading/49521-thoughts-day-swing-trading-10.html#post541772
http://www.traderji.com/day-trading/49521-thoughts-day-swing-trading-11.html#post543372
http://www.traderji.com/day-trading/49521-thoughts-day-swing-trading-12.html#post546036
http://www.traderji.com/day-trading/49521-thoughts-day-swing-trading-12.html#post546050
http://www.traderji.com/day-trading/49521-thoughts-day-swing-trading-13.html#post546241
http://www.traderji.com/day-trading/49521-thoughts-day-swing-trading-14.html#post546783
...and many more

@others: please correct me if my understanding of ST's gap is wrong.
 

casoni

Well-Known Member
#9
1) We identify a candle that has made a higher high relative to the candle that was M bars ago.
2) Our chosen candle must not be making a higher high relative to N bars previous.
3) The Low of chosen candle must be higher than Low of Candle M bars ago but not higher than Low of candle N bars ago.
i think this code will do the job ,[ as per rules you have mentioned ]
* its Edward Pottasch code

// AFL code by Edward Pottasch,
xx=BarIndex();x=xx;Lx=LastValue(x);
rightStrength=Param("Fractal Pivot Right side Strength",3,0,50,1);
leftStrength=Param("Fractal Pivot Left side Strength",5,0,50,1);
pk=H>Ref(HHV(H,leftStrength),-1) AND Ref(HHV(H,rightStrength),rightStrength)<=H;
tr=L<Ref(LLV(L,leftStrength),-1) AND Ref(LLV(L,rightStrength),rightStrength)>=L;
SetChartBkColor(ColorRGB(0,0,0));SetChartOptions(0,chartShowDates);
SetBarFillColor(IIf(C>O,colorGreen,IIf(C<=O,colorRed,colorLightGrey)));
Plot(C,"Price",IIf(C>O,colorDarkGreen,IIf(C<=O,colorDarkRed,colorLightGrey)),64,0,0,0,0);
PlotShapes(shapeSmallCircle*tr,IIf(Lx-ValueWhen(tr,x)>rightStrength,ColorRGB(0,100,0),colorWhite),0,L,-10);
PlotShapes(shapeSmallCircle*pk,IIf(Lx-ValueWhen(pk,x)>rightStrength,ColorRGB(255,0,0),colorWhite),0,H,10);

peak or trough will be confirmed when the shape turn's its color i.e from white to red / green

Thank you
 

mastermind007

Well-Known Member
#10
Amit

I have a question that relates to the market movement this week and very creative use of gaps in December 2014 NIFTY and BANKNIFTY.

On the day that the indice opened with bullish gap { O > Ref (C, -1) } , it closed bearish and vice-versa.

Last two days (18 and 19) have been claimed as being bullish in emails from brokers and media but it is actually bears who have ensured that prices remained high and they've continued selling!

19 Dec by comparison has +ve close relative to 18 dec but all those who went long at start of 19th show max profit of 15-25 points whereas bears got 45-50 points on an average. Actual sentiment is that of sell-off
 

Similar threads