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

Net Lines for Amibroker (AFL)

Rating:
3 / 5 (Votes 3)
Tags:
amibroker

I don’t remember the name of the trader who found this, but basically the philosophy of this very simple system is that when you have 3 consecutive higher close, you will mark the low of the first bar of the sequence by a dot on the chart. That is a NLSL (net sell line), and the opposite is a NLBL line (net buy line).
As long as there is no higher and more recent similar “3 higher close” sequence, the dots will remain horizontal. When a new higher sewuence occurs, new dot will be placed at the low of the new sequence, and so forth.
Same for bearish sequence. The thing is: when price breaks and closes beyond a dot, you have a reversal signal, or at least an exit for current position.
If you want stronger signal, you can just change the “3” consecutive by 4 or even 5: less frequent but probably stronger signals will ensue.
Note the color of the bar: when the bar is in between 2 opposite net lines, the color is black= neutral and consolidating. Otherwise, it clearly indicates the direction to follow.

Screenshots

Similar Indicators / Formulas

Kavach Of Karna v2
Submitted by hbkwarez over 10 years ago
Advanced Elliott Waves
Submitted by MarcosEn about 13 years ago
3_6Day GuaiLiLv
Submitted by motorfly about 13 years ago
Williams Alligator System
Submitted by durgesh1712 about 13 years ago
*Level Breakout system*
Submitted by Tinych about 13 years ago
Horizontal Live Priceline Tool
Submitted by northstar about 13 years ago

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("NetLines");

netbull= Sum(C<Ref(C,-1),3)==3;
netbear= Sum(C>Ref(C,-1),3)==3;

NLBL= ValueWhen(netbull,Ref(H,-2));
NLSL= ValueWhen(netbear,Ref(L,-2));

netline=IIf(BarsSince(NLBL)<BarsSince(NLSL),NLBL, NLSL);
Color= IIf(netline==NLBL,colorBlue, colorRed);

Plot(IIf(Ref(C,-1)< NLBL,NLBL,Null),"NLBL",colorBlue,styleDots|styleNoLine|styleThick);
Plot(IIf(Ref(C,-1)> NLSL,NLSL,Null),"NLSL",colorRed,styleDots|styleNoLine|styleThick);

Couleur= IIf(C> NLBL, colorBlue, IIf(C<NLSL, colorRed, colorBlack));
Plot( C, "Close", couleur, styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

if( ParamToggle("Tooltip shows", "All Values|Only Prices" ) )
{
 ToolTip=StrFormat("Open: %g\nHigh:  %g\nLow:   %g\nClose:  %g (%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
}
_SECTION_END();

11 comments

1. extremist

this is the nice code. lill safer to trade. coz u will find the signal right when the trend is already set.

just for the better appearance u can add the following code at the end of ur code :

FS=Param(“Font Size”,30,11,100,1);
GfxSelectFont(“Times New Roman”, FS, 700, True );
GfxSetBkMode( colorBlack );
GfxSetTextColor( ParamColor(“Color”,colorBlack) );
Hor=Param(“Horizontal Position”,890,1,1200,1);
Ver=Param(“Vertical Position”,12,1,830,1);
GfxTextOut(""+C, Hor , Ver );
YC=TimeFrameGetPrice(“C”,inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont(“Times New Roman”, 11, 700, True );
GfxSetBkMode( colorBlack );
GfxSetTextColor(ParamColor(“Color”,colorYellow) );
GfxTextOut(""+DD+" (“xx”%)", Hor , Ver+45 );

thanx !

Rohan Patel
rhn_patel@rediffmail.com

2. carlvan

Thanks Rohan, I like your added code as well. What I forgot to mention is that this “net lines” setup in fact coincides more or less with the well know candle formation called “3 little soldiers”, which in my opinion adds to its validity. I personnally use the net lines in my trading, as a trigger when I get a signal from other favorite indicators.

3. ippfx

Thank you for the indicator. This could used for turtle trading.

4. hoierman

4. Dick
Most interesting. Could you provide Buy – Sell formulas based on Price breaking Trend ? so I could set up Exploration Thanks. Also I couldn’t get the added Graphics to work (came up with error message).
You response will be appreciated.

5. kv_maligi

Hellow Carlvan,

My appraciation & deep regards for you as you are sharing this exellent code. This is one of the superb AFL i have come across.

And also many thanks to the author and wisestocktrader.com

Thanks
Viswanath

6. expert

Rohan Patel friend can u edit complete AFL please becouse i am finding syntax error, thanks a lot!!

7. prasadbrao

The corrected afl submitted by extremist……………….

FS=Param(“Font Size”,30,11,100,1);
GfxSelectFont(“Times New Roman”, FS, 700, True );
GfxSetBkMode( colorBlack );
GfxSetTextColor( ParamColor(“Color”,colorWhite) );
Hor=Param(“Horizontal Position”,890,1,1200,1);
Ver=Param(“Vertical Position”,12,1,830,1);
GfxTextOut(""+C, Hor , Ver );
YC=TimeFrameGetPrice(“C”,inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont(“Times New Roman”, 11, 700, True );
GfxSetBkMode( colorBlack );
GfxSetTextColor(ParamColor(“Color”,colorYellow) );
GfxTextOut(""+DD+" " “(”XX+")"+ “%” , Hor , Ver+45 );

8. carlvan

To the request of Dirk, I am adding 2 lines of code for buy/sell conditions. Of course the inverse conditions applies for short/cover. However, I don’t use those conditions just like that. To me, the color change, for example a new blue bar, means the trend is about to change. THEN, I need an additional trigger. For my style of trading the trigger is a correction that will not break below the new red dots that now should stand below prices. For example you might want to wait for a lower low after an upside break then enter on the first higher high. Hope it helps.

_SECTION_BEGIN(“NetLines”);

netbull= Sum(C<Ref(C,-1),3)==3;
netbear= Sum(C>Ref(C,-1),3)==3;

NLBL= ValueWhen(netbull,Ref(H,-2));
NLSL= ValueWhen(netbear,Ref(L,-2));

netline=IIf(BarsSince(NLBL)<BarsSince(NLSL),NLBL, NLSL);

Plot(IIf(Ref(C,-1)< NLBL,NLBL,Null),“NLBL”,colorLime,styleDots|styleNoLine|styleThick);
Plot(IIf(Ref(C,-1)> NLSL,NLSL,Null),“NLSL”,colorRed,styleDots|styleNoLine|styleThick);

Couleur= IIf(C> NLBL, colorBlue, IIf(C<NLSL, colorRed, colorBlack));
Plot( C, “Close”, couleur, styleNoTitle | ParamStyle(“Style”) | GetPriceStyle() );

if( ParamToggle(“Tooltip shows”, “All Values|Only Prices” ) )
{
ToolTip=StrFormat("Open: g\nHigh: %g\nLow: %g\nClose: %g (.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC));
}

Buy= Cross(C,NLBL);
Sell= Cross(NLSL,C);

_SECTION_END();

9. worldastro

error for carlvan code :-

error 31

10. kv_maligi

Please find here with the code with buy/sell arrows. Buy/sell are at HH/LL.

Thanks
Viswanath
=======

_SECTION_BEGIN("NetLines");

netbull= Sum(C<Ref(C,-1),3)==3;
netbear= Sum(C>Ref(C,-1),3)==3;

NLBL= ValueWhen(netbull,Ref(H,-2));
NLSL= ValueWhen(netbear,Ref(L,-2));

netline=IIf(BarsSince(NLBL)<BarsSince(NLSL),NLBL, NLSL);

Plot(IIf(Ref(C,-1)< NLBL,NLBL,Null),"NLBL",colorLime,styleDots|styleNoLine|styleThick);
Plot(IIf(Ref(C,-1)> NLSL,NLSL,Null),"NLSL",colorRed,styleDots|styleNoLine|styleThick);

Couleur= IIf(C> NLBL, colorBlue, IIf(C<NLSL, colorRed, colorBlack));
Plot( C, "Close", couleur, styleNoTitle | ParamStyle("Style") | GetPriceStyle() );


Buy= Cross(C,NLBL);
Sell= Cross(NLSL,C);

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
//Short = ExRem(Short, Cover);
//Cover = ExRem(Cover, Short);
AlertIf( Buy, "", "BUY @ " + C, 1 );
AlertIf( Sell, "", "SELL @ " + C, 2 );

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;

//Plot( Close, "Price", colorBlack, styleCandle );

PlotShapes( shape, IIf( Buy, colorBlue, colorRose ), 0, IIf( Buy, Low, High ) );



dist = 0.5*ATR(10);
dist1 =1*ATR(10);
//SLB = LLV(L,swingN);
//SLS = HHV(H,swingN);
sup=LLV(L,10);
res=HHV(H,10);

/*
tar1 = entry - (entry * .0050);
tar2 = entry - (entry * .0112);
tar3 = entry - (entry * .0212);

tar1 = entry - (entry * .0050);
tar2 = entry - (entry * .0112);
tar3 = entry - (entry * .0212);
*/


for( i = 0; i < BarCount; i++ )
{
if( Buy[i] )
{
//PlotText( "\nBuy:" + H[ i ] + "\nRisk= " + (H[i]-sup[i]) + "\nSL= " + (sup[i]), i, L[ i ]-dist[i], colorGreen, colorWhite );
PlotText( "\n" + H[ i ] + "(R)" + (H[i]-sup[i]) , i, L[ i ]-dist[i], colorWhite, colorBlue );

}


if( Sell[i] )
{
PlotText( "" + L[ i ] + "(R)" + ((res[i]-L[i])) , i, H[ i ]+dist1[i], colorWhite, colorPlum );
}
}


_SECTION_END();
11. kv_maligi

For Net Lines for Amibroker (AFL): Buy/sell are added. Plz find the code herewith.

_SECTION_BEGIN(“NetLines”);

netbull= Sum(C<Ref(C,-1),3)==3;
netbear= Sum(C>Ref(C,-1),3)==3;

NLBL= ValueWhen(netbull,Ref(H,-2));
NLSL= ValueWhen(netbear,Ref(L,-2));

netline=IIf(BarsSince(NLBL)<BarsSince(NLSL),NLBL, NLSL);

Plot(IIf(Ref(C,-1)< NLBL,NLBL,Null),“NLBL”,colorLime,styleDots|styleNoLine|styleThick);
Plot(IIf(Ref(C,-1)> NLSL,NLSL,Null),“NLSL”,colorRed,styleDots|styleNoLine|styleThick);

Couleur= IIf(C> NLBL, colorBlue, IIf(C<NLSL, colorRed, colorBlack));
Plot( C, “Close”, couleur, styleNoTitle | ParamStyle(“Style”) | GetPriceStyle() );

Buy= Cross(C,NLBL);
Sell= Cross(NLSL,C);

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
//Short = ExRem(Short, Cover);
//Cover = ExRem(Cover, Short);
AlertIf( Buy, "", "BUY @ " + C, 1 );
AlertIf( Sell, "", "SELL @ " + C, 2 );

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;

//Plot( Close, “Price”, colorBlack, styleCandle );

PlotShapes( shape, IIf( Buy, colorBlue, colorRose ), 0, IIf( Buy, Low, High ) );

dist = 0.5*ATR(10);
dist1 =1*ATR(10);
//SLB = LLV;
//SLS = HHV;
sup=LLV;
res=HHV;

/*
tar1 = entry – (entry * .0050);
tar2 = entry – (entry * .0112);
tar3 = entry – (entry * .0212);

tar1 = entry – (entry * .0050);
tar2 = entry – (entry * .0112);
tar3 = entry – (entry * .0212);
*/

for( i = 0; i < BarCount; i++ )
{
if( Buy[i] )
{
//PlotText( “\nBuy:” + H[ i ] + "\nRisk= " + (H[i]-sup[i]) + "\nSL= " + (sup[i]), i, L[ i ]-dist[i], colorGreen, colorWhite );
PlotText( “\n” + H[ i ] + “®” + (H[i]-sup[i]) , i, L[ i ]-dist[i], colorWhite, colorBlue );

}

if( Sell[i] )
{
PlotText( "" + L[ i ] + “®” + ((res[i]-L[i])) , i, H[ i ]+dist1[i], colorWhite, colorPlum );
}
}

_SECTION_END();

Leave Comment

Please login here to leave a comment.

Back