Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Retracement Pivot system for Amibroker (AFL)

Rating:
3 / 5 (Votes 7)
Tags:
trading system, amibroker, pivots

This system is based on daily retacement. Read the code you get it.

I am attaching aurobindopharma result.

This is only for education. Before trying to real market test it yourself.

Screenshots

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("Multi Retra Pivots");
//chart colors
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 |ParamStyle("Style") | GetPriceStyle() );

T_F =ParamList("Pivot T_F","iDay|Hourly|2_Hrs|3_Hrs|4_Hrs|EOD|Weekly|Monthly");

if (T_F=="iDay")
{
H_1 = TimeFrameGetPrice( "H", inDaily, -1 );
L_1 = TimeFrameGetPrice( "L", inDaily, -1 );
H_2 = TimeFrameGetPrice( "H", inDaily, -2 );
L_2 = TimeFrameGetPrice( "L", inDaily, -2 );
H_3 = TimeFrameGetPrice( "H", inDaily, -3 );
L_3 = TimeFrameGetPrice( "L", inDaily, -3 );
}
else if (T_F == "Hourly")
{
H_1 = TimeFrameGetPrice( "H", inHourly, -1 );
L_1 = TimeFrameGetPrice( "L", inHourly, -1 );
H_2 = TimeFrameGetPrice( "H", inHourly, -2 );
L_2 = TimeFrameGetPrice( "L", inHourly, -2 );
H_3 = TimeFrameGetPrice( "H", inHourly, -3 );
L_3 = TimeFrameGetPrice( "L", inHourly, -3 );
}
else if (T_F == "2_Hrs")
{
H_1 = TimeFrameGetPrice( "H", inHourly*2, -1 );
L_1 = TimeFrameGetPrice( "L", inHourly*2, -1 );
H_2 = TimeFrameGetPrice( "H", inHourly*2, -2 );
L_2 = TimeFrameGetPrice( "L", inHourly*2, -2 );
H_3 = TimeFrameGetPrice( "H", inHourly*2, -3 );
L_3 = TimeFrameGetPrice( "L", inHourly*2, -3 );
}
else if (T_F == "3_Hrs")
{
H_1 = TimeFrameGetPrice( "H", inHourly*3, -1 );
L_1 = TimeFrameGetPrice( "L", inHourly*3, -1 );
H_2 = TimeFrameGetPrice( "H", inHourly*3, -2 );
L_2 = TimeFrameGetPrice( "L", inHourly*3, -2 );
H_3 = TimeFrameGetPrice( "H", inHourly*3, -3 );
L_3 = TimeFrameGetPrice( "L", inHourly*3, -3 );
}
else if (T_F == "4_Hrs")
{
H_1 = TimeFrameGetPrice( "H", inHourly*4, -1 );
L_1 = TimeFrameGetPrice( "L", inHourly*4, -1 );
H_2 = TimeFrameGetPrice( "H", inHourly*4, -2 );
L_2 = TimeFrameGetPrice( "L", inHourly*4, -2 );
H_3 = TimeFrameGetPrice( "H", inHourly*4, -3 );
L_3 = TimeFrameGetPrice( "L", inHourly*4, -3 );
}
else if (T_F == "EOD")
{
H_1 = TimeFrameGetPrice( "H", inDaily, 0 );
L_1 = TimeFrameGetPrice( "L", inDaily, 0 );
H_2 = TimeFrameGetPrice( "H", inDaily, -1 );
L_2 = TimeFrameGetPrice( "L", inDaily,-1 );
H_3 = TimeFrameGetPrice( "H", inDaily, -2 );
L_3 = TimeFrameGetPrice( "L", inDaily,-2 );
}
else if (T_F == "Weekly")
{
H_1 = TimeFrameGetPrice( "H", inWeekly, -1 );
L_1 = TimeFrameGetPrice( "L", inWeekly, -1 );
H_2 = TimeFrameGetPrice( "H", inWeekly, -2 );
L_2 = TimeFrameGetPrice( "L", inWeekly, -2 );
H_3 = TimeFrameGetPrice( "H", inWeekly, -3 );
L_3 = TimeFrameGetPrice( "L", inWeekly, -3 );
}
else if (T_F == "Monthly")
{
H_1 = TimeFrameGetPrice( "H", inMonthly, -1 );
L_1 = TimeFrameGetPrice( "L", inMonthly, -1 );
H_2 = TimeFrameGetPrice( "H", inMonthly, -2 );
L_2 = TimeFrameGetPrice( "L", inMonthly, -2 );
H_3 = TimeFrameGetPrice( "H", inMonthly, -3 );
L_3 = TimeFrameGetPrice( "L", inMonthly, -3 );
}

// To calculate the Pivot Levels for last trading day

R = H_1 - L_1; // Range
MID = (H_1 + L_1) / 2;
H1 = L_1 + R*0.62;
L1 = L_1 + R*0.38;
H2 = H_1;
L2 = L_1;
H3 = H_1 + R*0.38;
L3 = L_1 - R*0.38;
H4 = H_1 + R*0.62;
L4 = L_1 - R*0.62;
H5 = H_1 + R;
L5 = L_1 - R;

// To calculate the Pivot Levels for previous trading session
LASTR = H_2 - L_2; // LAST Range
LASTMID = (H_2 + L_2) / 2;
LASTH1 = L_2 + LASTR*0.62;
LASTL1 = L_2 + LASTR*0.38;
LASTH2 = H_2;
LASTL2 = L_2;
LASTH3 = H_2 + LASTR*0.38;
LASTL3 = L_2 - LASTR*0.38;
LASTH4 = H_2 + LASTR*0.62;
LASTL4 = L_2 - LASTR*0.62;
LASTH5 = H_2 + LASTR;
LASTL5 = L_2 - LASTR;

// To calculate the Pivot Levels for third trading session

THRDR = H_3 - L_3; // 3RD Range
THRDMID = (H_3 + L_3) / 2;
THRDH1 = L_3 + THRDR*0.62;
THRDL1 = L_3 + THRDR*0.38;
THRDH2 = H_3;
THRDL2 = L_3;
THRDH3 = H_3 + THRDR*0.38;
THRDL3 = L_3 - THRDR*0.38;
THRDH4 = H_3 + THRDR*0.62;
THRDL4 = L_3 - THRDR*0.62;
THRDH5 = H_3 + THRDR;
THRDL5 = L_3 - THRDR;

//Defining TF on charts
procedure AddT_fParam(defaultvalue)
{
global T_F;
T_F = ParamList("Time Frame", List =
"iDay|Hourly|2_Hrs|3_Hrs|4_Hrs|EOD|Weekly|Monthly" , defaultvalue);

if(T_F == "iDay") T_F = inDaily;
else if(T_F == "Hourly") T_F = inHourly;
else if(T_F == "2_Hrs") T_F = inHourly*2;
else if(T_F == "3_Hrs") T_F = inHourly*3;
else if(T_F == "4_Hrs") T_F = inHourly*4;
else if(T_F == "EOD") T_F = inDaily;
else if(T_F == "Weekly") T_F = inWeekly;
else if(T_F == "Montly") T_F = inMonthly;
}

//	Plot Pivot Levels in the charts
Plot (H5,"H5",ColorRGB(173,255,47),styleSwingDots,styleThick,1);
Plot (H4,"H4",ColorRGB(34,139,87),styleSwingDots,styleThick,1);
Plot (H3,"H3",ColorRGB(85,107,47),styleSwingDots,styleThick,1);
Plot (H2,"H2",ColorRGB(255,0,255),styleDashed,styleThick,1);
Plot (H1,"H1",ColorRGB(255,140,0),styleLine,styleThick,1);
Plot (MID,"MID",ColorRGB(128,0,128),styleLine,styleThick,1);
Plot (L1,"L1",ColorRGB(0,191,255),styleLine,styleThick,1);
Plot (L2,"L2",ColorRGB(0,255,255),styleDashed,styleThick,1);
Plot (L3,"L3",ColorRGB(250,128,144),styleDots,styleThick,1);
Plot (L4,"L4",ColorRGB(255,127,80),styleLine,styleThick,1);
Plot (L5,"L5",ColorRGB(255,215,0),styleLine,styleThick,1);


CON1 = C> H3;
CON2 = Volume > Ref( Volume, -1 )*1.5;

Buy = C> H3;
Sell = Cross( L1, Close ) ;


_SECTION_END ();

2 comments

1. k3325

Hai
Thanks a lot for sharing such a good AFL.
Keep it up.
Can you throw some light , how to use it in a better way and which timeframe should be used.

2. sanjith456

sir pls tell me how to use it sir
where to enter and exit
pls afl looking very promising

Leave Comment

Please login here to leave a comment.

Back