Req Afl code for breakout lines concept

#1
Hi experts

I have a simple code concept. can anybody help me with code afl please!


Chart = daily bars, thick bar is better
context =down close bar(bar opened and then fell down to close lower than open)
CALCULATE Trigger for upmoving price
rule=up occurs after a downmove
Trigger = (high - low)*0.24
(High & Low are of down close bar)
buybreakprice =bbp = close of downclosebar +Trigger= c +trigger;
=========================================
context=upclose bar on daily chart
Calculate Trigger for downmoving price
rule= down move occurs after an upmove
trigger =(high-low)*0.24
(high &low are of upclose bar)
sellbreakdownprice=sbp= close - trigger
close here is upclose bars close,also high,low belong to same bar

draw a line at bbp or sbp by code
just to monitor and enter at right time. if wrong,exit with tight stoploss


regards
ford
 
Last edited:
#3
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | styleThick | styleBar);

TimeFrameSet(inDaily);
BO = IIf(C < O, C + (High - Low)*0.24, C - (High - Low)*0.24);
TimeFrameRestore();
Trig = TimeFrameExpand(BO,inDaily);
Plot(Trig,"Trigger",colorYellow, styleStaircase,0,0,1);
_SECTION_END();

maybe use it on hourly or smaller charts to see the bo-bd lines more clearly


Happy :)
 

extremist

Well-Known Member
#4
Ford7k u didn't answered so i coded as i felt better.

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} \n Op=> %g, \n Hi=> %g, \n Lo=> %g, \n Cl=> %g \n
{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | styleThick | styleBar);

po=TimeFrameGetPrice( "O", inDaily, -1 );
ph=TimeFrameGetPrice( "H", inDaily, -1 );
pl=TimeFrameGetPrice( "L", inDaily, -1 );
pc=TimeFrameGetPrice( "C", inDaily, -1 );

/*bbp=(ph+pl)/2;
sbp=(ph+pl)/2;*/

DB=po>pc; //Down Bar
UB=po<pc; //Up Bar

bbp=IIf(DB,pc+((ph-pl)*0.24),Null); //Buy Break Price
sbp=IIf(UB,pc-((ph-pl)*0.24),Null); //Sell Break Price


Plot(bbp,"\n Buy Trigger",colorBrightGreen, styleStaircase,0,0,0,1);
Plot(sbp,"\n Sell Trigger",colorRed, styleStaircase,0,0,0,1);

_SECTION_END();

output is same as happy sing but way of coding and display is different.





 
Last edited:
#5
output is same as happy sing but way of coding and display is different.
Extremist bro

Happy is Singh but after a wonderful way the short trades have worked today will definitely sing . . . . :rofl:



Please Don't Mind the PJ and Thanks for the laughs :thumb:


Happy :)
 
#7
Hi extremist

Thanks for the question.
I was away from pc as my bsnl net failed and doesnt comeback.

Here it is
we have a Downclose bar, the bar has close<open
H and L remain untouched.
you have three different things H,L,C
Downclose just closed lower than open price.
similarly for upclose bar. bar just closed higher than open.H & L remain out of picture of calculation.
It is pleasure to see two of you tried your best to do the coding.
please give me a bit of time to check & get back.
Happy singhs code seems to be in place on first look as per my rule set.
Rule 2
you can replace 0.24 with 0.38 or 0.50 or even 0.62 but make sure your instruments suits the factor you use.

Once again thanks to you & Happysingh!
best regards

context =down close bar(bar opened and then fell down to close lower than open)

here do u mean tht
H =O
of tht particular bar.

or just to look for C < O

i will try 4 this code.
 
Last edited:
#8
Hi friends
here is a chart



what was missing in the afl was extending the buytrigger line or sell trigger line as a dotted line.

This small thing makes picture very clear and helps decide if it is time to act or not.

HTML:
Remember the rules
1 Buy only if price crosses above[B][U] Buy above trigger line[/U][/B] and use a tight stoploss
2.Sell only if price moves below [B][U]Sell below trigger[/U][/B] line and use a tight stoploss
Regards
ford
 
#9
Why this concept posted?

In general traders use indicators. They focus on indicators and ignore price action.
PRICE ACTION IS THE MOST IMPORTANT THING.This code focuses directly on it
Here in this code no indicators that crowd uses have been used.
When you dont do what crowd does, your safety goes up.Risk decreases.

WHEN YOU DEPEND ON PRICE ACTION,THE RESULT IS FAST.
Indicators bring in time delay and LAG into picture.
In this method no indicators like RSI-MACD-CCI-STOCHASTICS-MA-EMA etc have been used.
So the reliability is likely to be better.
What the trader has to do?
buy upside breakout and exit if tight stop is hit.
Sell if downside breakout is crossed by price and exit with a tight stoploss.

Happy Trading
 

johnnypareek

Well-Known Member
#10
Hi friends
here is a chart



what was missing in the afl was extending the buytrigger line or sell trigger line as a dotted line.

This small thing makes picture very clear and helps decide if it is time to act or not.

HTML:
Remember the rules
1 Buy only if price crosses above[B][U] Buy above trigger line[/U][/B] and use a tight stoploss
2.Sell only if price moves below [B][U]Sell below trigger[/U][/B] line and use a tight stoploss
Regards
ford
Dear,

Can you share that afl whose image u posted. The colors looking awesome.