Skip to main content

Behgozin slope finder modified for Amibroker (AFL)

richuw over 13 years ago Amibroker (AFL)

  • Rating:
    4 / 5 (Votes 17)
  • Tags:
    trading system, amibroker

This is a modified version of Behogozin slope finder, It adds Buy and Sell signal along with Ribbon information. Buy when it is Green, Sell when it is Red. Pink means you can get out if you wants.

Indicator / Formula

Copy & Paste Friendly
SetChartBkGradientFill(1,23);
_SECTION_BEGIN("Behgozin Slope Finder");
 
Tr2 = Ref(C,1);
Tr3=Ref(C,7);
Trend2 = MA(Tr2,7);
Trend3=MA(Tr3,7);
Slope1=((Trend3-Trend2)/Trend3)*100;
Plot(Slope1,"Buy When it is Green and Sell when it is Red or Pink",colorGold,styleLine+styleDots|styleThick);


Tr4 = Ref(C,7);
Tr5=Ref(C,15);
Trend3 = MA(Tr4,15);
Trend4=MA(Tr5,15);
Slope2=((Trend4-Trend3)/Trend4)*100;
Plot(Slope2,"",colorGreen,styleLine+styleDots|styleThick);
Plot(0,"",colorWhite,styleLine);
_SECTION_END();SetSortColumns(-2);

//Richu


Buy= nwbull=slope1 > 0 AND slope2 > 0 ; 
Sell=nwbear=slope1 < 0 AND slope2 < 0 ;
Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );

PlotShapes(IIf(Buy,shapeUpArrow,Null),colorGreen,0,0,-10); 

PlotShapes(IIf(Sell,shapeDownArrow,Null),colorRed,0,0,-10); 

 Plot( 1, /*efines the height of the ribbon in percent of pane width */"ribbon",
 IIf( nwbull, colorLime, IIf( nwbear, colorRed,IIf(Signal()<MACD(), colorPink, colorPink ))), /* choose color */
 styleOwnScale|styleArea|styleNoLabel, -01, 50 );

29 comments

3. amon
over 13 years ago

I warning you, this code uses future prices to adjust the current slope.
Ref(C,7) is the price over the next 7 periods in the future!

5. gopal
over 13 years ago

Hi,
Can we use any other method instead of Ref() which refers to future prices ?
Gopi

6. morgen
over 13 years ago

To GOPAL

1)Block this part of .afl as follow:

//Richu
//Buy= nwbull=slope1 > 0 AND slope2 > 0 AND Haup ; 
//Sell=nwbear=slope1 < 0 AND slope2 < 0 ;
//Buy = ExRem( Buy, Sell );
//Sell = ExRem( Sell, Buy );
//PlotShapes(IIf(Buy,shapeUpTriangle,Null),colorAqua,0,0,-10); 
//PlotShapes(IIf(Sell,shapeDownTriangle,Null),colorOrange,0,0,-10); 

2)Add at the end of .afl as follow:

//FORMULE
stochup= StochK()>StochD() ;
stochup80= StochK()>80 ;
MACDup= MACD()>Signal() ;
MACDnew= (MACD()>Signal() OR MACD()>0 AND CCI()>0) ;
Hist= MACD()-Signal() ;
Histup= Hist>Ref(Hist,-1) ;
MFIupema7= MFI()>EMA(MFI(),7) ;
MFI30= MFI()>30 ;
MFI80= MFI()<80 ;
Cupo= C>O ;
MA10up= MA(C,10)>=Ref(MA(C,10),-1) ;
MA20up= MA(C,20)>=Ref(MA(C,20),-1) ;
EMA50up= EMA(C,50)>=Ref(EMA(C,50),-1) ;
CupEMA50= C>EMA(C,50) ;
Cupma20= C>MA(C,20) ;
PDIupmdi= PDI()>MDI() ;
ADXupmdi= ADX()>MDI() ;
ADX50= ADX()<50 ;
CCIup0= CCI()>0 ;
top2up= BBandTop(C,20,2)>=Ref(BBandTop(C,20,2),-1) ;
top1up= BBandTop(C,20,1)>=Ref(BBandTop(C,20,1),-1) ;
Cuptop1= C>BBandTop(C,20,1) ;
Lim= (ADX()<50 AND MFI()>30) ;
RSIupema7= RSI()>EMA(RSI(),7) ;
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Buy= nwbull=slope1 > 0 AND slope2 > 0 AND macdup AND stochup  AND Cupo AND MFIupema7 ; 
Sell=nwbear=slope1 < 0 AND slope2 < 0 ;

Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );

PlotShapes(IIf(Buy,shapeUpTriangle,Null),colorBrightGreen,0,0,-10);
PlotShapes(IIf(Sell,shapeDownTriangle,Null),colorOrange,0,0,-10); 
10. arian
over 13 years ago

very nice indicator. thanks

p.s.: any relation with behgozin broker of IR?

11. Ayuraveda
over 13 years ago

To Correct unstable signal:

// pls. put -1 after C


_SECTION_BEGIN("Behgozin Slope Finder");
 
Tr2 = Ref(C-1,1);
Tr3=Ref(C-1,7);
Trend2 = MA(Tr2,7);
Trend3=MA(Tr3,7);
Slope1=((Trend3-Trend2)/Trend3)*100;

Tr4 = Ref(C-1,7);
Tr5=Ref(C-1,15);
Trend3 = MA(Tr4,15);
Trend4=MA(Tr5,15);
Slope2=((Trend4-Trend3)/Trend4)*100;
12. samapada
over 13 years ago

Its not working in mine……Showing Blank Chart….Pls Help me… any pulgins I need or wt….. Hope of getting help frm any1

13. hotaro3
over 13 years ago

Thank you very much all friends, the first, mr Arian I am iranian but not related to behgozin broker. you van find me on facebook as behgozin Ahmad- 2- as I said it was one of my first indicators that has some deficiency that my friends such as Anandnst recognized and mention it in original indicator. thanks for richuw and kv maligi for trying make a better and more effective indicator. I am working on another indicator that is under the test but this indicator can be used very well. please do not consider its variation. If you want decrease the effect of variation change the constant in Trend 2 and 3 to biger one such as 10 and in Trend 4 ad 5 from 15 to 20. It produce more reliable signals but somewhat later. enjoy it and be rich
Behgozin (hotaro)

14. arian
over 13 years ago

Dear Hotaro,

congratulations on your very nice work!

q: i have noticed that in many shares, the trend is strongly upward but in your AFL, the slope is down warding. how it could be explained?

thnx and rgrds!
Arian

15. hotaro3
over 13 years ago

Mr Arian- I think the difference is inside the method of calculation for future prices by Amibroker. otherwise there is not any unususl lines in my program with respect to others

17. Kabir
over 13 years ago

It would be more helpful is u can plot the parameter of Day range…….

over 13 years ago

yes, that’s right!
“The arrow is still changing” because of it using future values. If you do a back testing, this system give a fantastic result.

But take care to use this in a live market If you don’t want to broke

over 13 years ago

This afl gives signal when crosses zero line. Can any expert help me to make it gives buy signal when both lines are minimum 4 points above zero ( it may be 5, 6, 7, or 8 or above and each line may have different values as well). I want to use it for exploration or scanner.
Regards

23. ssdas0172
almost 12 years ago

mr. Morgen
1st of all thanks. bt still it changes buy sell signal.

26. mrdzenli
about 11 years ago

ну да, на истории работает (идиоты)

27. davidalan
about 11 years ago

line161 “q” should be “p”
line 162 “p” should be “q” gets triagles pointing in the right direction

30. vkb29
over 9 years ago

any one correct and then full code of this afl paste plzzzzzz

Leave Comment

Please login here to leave a comment.