Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Stress Indicator - Moddified for Amibroker (AFL)
Simple trade based on how a Stock is “Stressed” compared to it’s Index.
Option to display Stoch for both Stock & Index.
1. Wait for STRESS level to fall BELOW 10.
2. Three CONSECUTIVE LOWER CLOSE that forms a “Buy Zone”.
3. Exit trade when STRESS crosses 50.
4. All of the above is Buying a Stock and Selling the Index after checking correlation (between 30-70 percent to offset tracking).
5. Change the SETFOREIGN parameter if you want to use BANKNIFTY.
Screenshots
Indicator / Formula
_SECTION_BEGIN("Stress"); function PJKStress( High2, Low2, Close2, period ) { range1 = HHV( High, period ) - LLV( Low, period ); range2 = HHV( High2, period ) - LLV( Low2, period ); stoch1 = ( Close - LLV( Low, period ) )/range1; stoch2 = ( Close2 - LLV( Low2, period ) )/range2; VarSet("sstoch1", 100 * stoch1 ); VarSet("sstoch2", 100 * stoch2 ); diff = stoch1 - stoch2; range1 = HHV( diff, period ) - LLV( diff, period ); return 100 * ( diff - LLV( diff, period ) )/range1; } Per = Param("Period", 60, 5, 100, 5); momper = Per; Hedgeper = Per; SetForeign("NIFTY"); // store index data in High2/Low2/Close2 variables High2 = High; Low2 = Low; Close2 = Close; RestorePriceArrays(); stress = PJKStress( High2, Low2, Close2, momper ); Stress_Buy_Level = Param("Buy Level", 10, 1, 49, 1) ; Stress_Sell_Level = Param("Sell Level", 50, 50, 90, 1) ; Stress_BuyWatch_Level = Stress_Buy_Level + 10; Stress_Short_Level = Param("Short Level", 90, 50, 100, 1) ; Stress_Cover_Level = Param("Cover Level", 50, 50, 89, 1) ; Stress_ShortWatch_Level = Stress_Short_Level - 10; Stress_Buy = Cross(Stress_Buy_Level, stress) ; //AND sstoch1 < 20 ; Stress_Sell = Cross(stress, Stress_Sell_Level) ; //AND sstoch1 > 80 ; Stress_buy = ExRem( Stress_buy, Stress_sell ); Stress_sell = ExRem( Stress_sell, Stress_buy ); Stress_Short = Cross(Stress, Stress_Short_Level) ; Stress_Cover = Cross(Stress_Cover_Level, Stress) ; Stress_Cover = ExRem( Stress_Cover, Stress_Short ); Stress_Short = ExRem( Stress_Short, Stress_Cover ); shape_Buy = Stress_Buy * shapeUpArrow + Stress_Sell * shapesmallsquare; //PlotShapes( shape_Buy, IIf( Stress_Buy, colorTurquoise, colorTurquoise ), 0, // IIf( Stress_Buy, Stress_Buy_Level, Stress_Sell_Level ) ); shape_Short = Stress_Short * shapeDownArrow + Stress_Cover * shapesmallsquare; //PlotShapes( shape_Short, IIf( Stress_Short, colorPink, colorPink ), 0, // IIf( Stress_Cover, Stress_Cover_Level, Stress_Short_Level ) ); //SetGradientFill( colorIndigo /*top*/, colorDarkGrey /*bottom*/, 0 /*baseline level*/, GetChartBkColor() /*baseline color */ ); //PlotOHLC( stress, stress, 0, stress , "Stress Nifty("+Per+")", colorBluegrey, styleLine | styleGradient, Null, Null, 0, 0 ); Stress_Color = IIf(Cross(stress,Stress_Short_Level), colorRed, IIf(Cross(Stress_Buy_Level,stress), colorRed,colorBlueGrey )); SetGradientFill( colorIndigo /*top*/, colorDarkGrey /*bottom*/, 0 /*baseline level*/, GetChartBkColor() /*baseline color */ ); PlotOHLC( stress, stress, 0, stress , "Stress Nifty("+Per+")", Stress_color, styleLine | styleGradient, Null, Null, 0, 0 ); //Plot( stress, "Stress Nifty("+Per+")", colorTan, ParamStyle("Style", styleGradient, maskHistogram), Null, Null, 0, 0, 1) ; //stylethick ); if (ParamToggle("Show Stoch","NO|YES",0)) { //Plot( stress, "Stress Nifty("+Per+")", colorTan, ParamStyle("Style", styleGradient, maskHistogram), Null, Null, 0, 0, 1) ; //stylethick ); Plot( sstoch1, "Stoch-"+Name(), colorGreen, Null, Null, 0, 0, 1) ; Plot( sstoch2, "Stoch-Nifty", colorGold, Null, Null, 0, 0, 1) ; } //Plot( Stress_Buy_Level, "", colorViolet, stylenolabel) ; //Plot( Stress_Sell_Level, "", colorGrey50, styleDots | stylenolabel) ; //Plot( Stress_BuyWatch_Level, "", colorViolet, styleDashed | styleNoLabel) ; //Plot( Stress_Short_Level, "", colorViolet, stylenolabel) ; //Plot( Stress_Cover_Level, "", colorgrey50, styleDots | stylenolabel) ; //Plot( Stress_ShortWatch_Level, "", colorViolet, styleDashed | styleNoLabel) ; _SECTION_END();
13 comments
Leave Comment
Please login here to leave a comment.
Back
AFL not working
Great job. Thanks for sharing.
AFL not working, AmiBroker 5.50.5
Ln:62, Col:16: Error 32. Syntax error, unexpected’(‘.Is there semicolon missing at the end of the previous line?
Ln:63, Col:103: Error 29. Variable ’stylegradient’ used without having been initialized.
I’m using in latest Amibroker 5.9 but I don’t think there is anything in the AFL that should not work with older versions.
Try using the “Copy & Paste friendly” link.
If you wanted to use S&P 500 as the index would you replace Nifty with ^GSPC or what thanks
Dear MA5YK,
can you suggest which is the best TF for trade ?
and which are the Best Script for trade….!
@davidalan: Yes, just replace NIFTY with any Market-Index you trade in.
@Divyesh: I don’t trade intraday so no idea how it performs there. Rising or Falling Stress shows Stock is going to move. Just create a simple exploration from the Buy/Sell conditions and run it on NSE Futures to get ideas. It’s one more tool to help us find an Entry point.
Thank You
NOT WORKING
Following Error
Ln:62, Col:16: Error 32. Syntax error, unexpected’(‘.Is there semicolon missing at the end of the previous line?
Ln:63, Col:103: Error 29. Variable ’stylegradient’ used without having been initialized.
Masyk,
Interesting AFL.
I have attempted to add an Exploration (see below) to this fine code but but when implemented get zilch(0) Buys… all sells on a 3700 database. Your help in letting me know changes necessary to make the BUY work. Your help will be most appreciated
Dick
Dick,
If I’m not mistaken you may need to add Buy/Sell to the filter.
Filter = BUY OR SELL…
I’m also going to assume you’ve changed the Index in the SETFOREIGN parameter to the market you are trading in.
This site needs some sort of comment notification system.
Hi,
I need some help from you about C/C++
if I am not wrong you have written AmibrokerFeeder.