إضافة رد
قديم 30-11-2019, 11:46 PM
  المشاركه #31

عضو هوامير المميز

تاريخ التسجيل: Mar 2007
المشاركات: 2,797
alnoor99 غير متواجد حالياً  

رد: إستراتيجيه الدخول مع المضارب


اقتباس:
المشاركة الأصلية كتبت بواسطة معشوقتي مشاهدة المشاركة


.

وش طريقتها ؟

وهل هي يومية والا لحظية والا اسبوعيه والا ايش بالضبط ؟


وهل استفدت منها للامانه ؟


وشكراً
حاولت والله أفتح الملف ولكن ما فتح معي الي في الصفحة الأولى ما أدري وش المشكلة ؟
الاستراتيجية مبنية على ...
1/ متوسط 7 اسي .
2/ الماكد ايجابي .
3/ الكميات اعلى من ثلاثة كميات سابقة ...
ومن وجهة نظي فاصل الساعة يعطي نتائج طيبة.
أما مدى أستفادتي منها فلم ابرمجها على الشارت لدي إلا هذه الايام وكما تعلم المؤشر في ترند هابط هذه الأيام ومزوبعة ارامكو ...
حاول تفتح الرابط حق الاستراتيجية وتقرأها أكثر من مره وستعرف أنها ممتازة جدا ...



رد مع اقتباس
 
 

قديم 27-12-2019, 11:51 AM
  المشاركه #32

عضو هوامير المميز

تاريخ التسجيل: Dec 2010
المشاركات: 8,576
معشوقتي غير متواجد حالياً  

رد: إستراتيجيه الدخول مع المضارب


اقتباس:
المشاركة الأصلية كتبت بواسطة alnoor99 مشاهدة المشاركة
حاولت والله أفتح الملف ولكن ما فتح معي الي في الصفحة الأولى ما أدري وش المشكلة ؟
الاستراتيجية مبنية على ...
1/ متوسط 7 اسي .
2/ الماكد ايجابي .
3/ الكميات اعلى من ثلاثة كميات سابقة ...
ومن وجهة نظي فاصل الساعة يعطي نتائج طيبة.
أما مدى أستفادتي منها فلم ابرمجها على الشارت لدي إلا هذه الايام وكما تعلم المؤشر في ترند هابط هذه الأيام ومزوبعة ارامكو ...
حاول تفتح الرابط حق الاستراتيجية وتقرأها أكثر من مره وستعرف أنها ممتازة جدا ...
.

مشكور عزيزي

فتحت الرابط متعطل !!!
لكن كيف الماكد ايجابي ؟ والكميات اعلى من 3 كميات سابقه؟ ممكن شرح بالصورة لو تكرمت ؟



رد مع اقتباس
قديم 29-12-2019, 11:37 PM
  المشاركه #33

عضو هوامير المميز

تاريخ التسجيل: Mar 2007
المشاركات: 2,797
alnoor99 غير متواجد حالياً  

رد: إستراتيجيه الدخول مع المضارب


اقتباس:
المشاركة الأصلية كتبت بواسطة معشوقتي مشاهدة المشاركة


.

مشكور عزيزي

فتحت الرابط متعطل !!!
لكن كيف الماكد ايجابي ؟ والكميات اعلى من 3 كميات سابقه؟ ممكن شرح بالصورة لو تكرمت ؟
http://cdn.tickerchart.com/m/ssf/0313bdefe3

هذا تقريبا صورة الأستراتيجية ...



رد مع اقتباس
قديم 25-03-2020, 02:56 AM
  المشاركه #34

محلل المؤشر الأمريكي داو جونز

تاريخ التسجيل: Nov 2005
المشاركات: 2,777
القناااص 2005 غير متواجد حالياً  

رد: إستراتيجيه الدخول مع المضارب


اقتباس:
المشاركة الأصلية كتبت بواسطة alnoor99 مشاهدة المشاركة
أفضل استراتيجية من وجهة نظري ..
جزاه الله خير من عملها ...

(volume > ref(volume, -3
and macdh(26, 12, 9) > ref(macdh(26, 12, 9), -1)
and macdh(26, 12, 9) < 0
(and close > ema(close, 7

السلام عليكم
هل ممكن احد يحول لنا الاستراتيجيه علي الامي بروكر



رد مع اقتباس
قديم 26-03-2020, 03:14 AM
  المشاركه #35

عضو هوامير المميز

تاريخ التسجيل: Jan 2017
المشاركات: 52
bohaneen11 غير متواجد حالياً  

رد: إستراتيجيه الدخول مع المضارب


تفضل اخوي المتوسط المتحرك المستخدم في المعادله البسيط



_SECTION_BEGIN("MACD");r1 = Param( "Fast avg", 12, 2, 200, 1 );r2 = Param( "Slow avg", 26, 2, 200, 1 );r3 = Param( "Signal avg", 9, 2, 200, 1 ); ml = MACD(r1, r2);sl = Signal(r1,r2,r3);MACDH = ml-sl; Buy = ( Volume > Ref( HHV( Volume , 5 ) , -1 )AND MACDH > Ref( MACDH , -1 )AND Open > MA( Open , 7 ) );Sell = ( Open < MA( Open , 7 ) AND MACDH < Ref( MACDH , -1 ));Buy= (ExRem(Buy, Sell));Sell=(ExRem(Sell, Buy));Short = 0;Cover = 0;



رد مع اقتباس
قديم 13-05-2020, 02:16 PM
  المشاركه #36

عضو هوامير المؤسس

تاريخ التسجيل: Apr 2005
المشاركات: 1,252
AL_BADR غير متواجد حالياً  

رد: إستراتيجيه الدخول مع المضارب


اقتباس:
المشاركة الأصلية كتبت بواسطة القناااص 2005 مشاهدة المشاركة
السلام عليكم
هل ممكن احد يحول لنا الاستراتيجيه علي الامي بروكر
ابشر بعزك
هذا طلبك

_SECTION_BEGIN("MACD");
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
Plot( ml = MACD(r1, r2),"MACD" ,4 );
Plot( sl = Signal(r1,r2,r3), "Signal" , ParamColor("Signal color", colorBlue ) );
Buy = ( Volume > Ref( Volume , -3 ))
AND MACD() > Ref( MACD() ,-1 )
AND Open > MA(Open , 7 )
AND MACD() < 0 ;
Sell = ( Open < MA( Open , 7 )
AND MACD() < Ref( MACD() , -1 ));
Buy= (ExRem(Buy, Sell));
Sell=(ExRem(Sell, Buy));
Filter = Buy OR Sell;

_SECTION_BEGIN("AuthorName");
k = (GetPerformanceCounter()/100)%100;
printf("GetPerformance Counter %g",k);
GfxSelectFont("jokerman", 14,800);
GfxSetBkMode(1);
GfxSetTextColor(colorGold);
GfxTextOut("AL_BADR-S",-10+k,20);
RequestTimedRefresh(10);
_SECTION_END();
AddTextColumn( FullName(), "Company Name" );
AddColumn( Buy, "Buy", 1 );
AddColumn( Sell, "Sell", 1 );
AddColumn( C, "Close", 1.3 );
AddColumn( H, "High", 1.3 );


وأي خدمة حاضرين
اللهم بلغنا تمام الصيام
اللهم بلغنا ليلة القدر



رد مع اقتباس
قديم 13-05-2020, 10:47 PM
  المشاركه #37

عضو هوامير المميز

تاريخ التسجيل: Mar 2014
المشاركات: 2,548
صعنون1 غير متواجد حالياً  

رد: إستراتيجيه الدخول مع المضارب


جرب هذا

_SECTION_BEGIN("MACD");
r= MACD(10, 22);
W1=ValueWhen(HHV(r,14),r,2);
dd= Signal(10,22,5);
mycolor = IIf(r<0 AND r>dd, colorBrightGreen,IIf(r>0 AND r>dd, colorGreen,IIf(r>0 AND r<dd,colorRed,colorRed)));
Plot(r,"MACD(10,22,5)",mycolor,styleDots);
Plot(dd,"Signal ",colorWhite,styleThick);
histcolor = IIf((r-dd)-Ref((r-dd),-1)> 0, colorBrightGreen, colorRed);
Hist=r-dd;


numbars = SelectedValue(Cum(Status("barvisible")));
fraction= IIf(StrRight(Name(),3) == "",3.2,3.2);
hts = Param ("Text Shift", -50,-100,100,10);
PlotText(">>>" + WriteVal(r,fraction),
SelectedValue(BarIndex())-(numbars/hts),SelectedValue(r),2);
Buy= Cross(MACD(10,22),Signal(10,22,5));
Sell = Cross( Signal(10, 22, 5), MACD(10,22) );

PlotShapes(IIf(Buy,shapeSmallSquare,shapeNone),colorGreen,0,r,Offset=-30);
PlotShapes(IIf(Buy,shapeSmallSquare,shapeNone),colorLime,0,r,Offset=-40);
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorWhite,0,r,Offset=-35);
PlotShapes(IIf(Sell,shapeSmallSquare,shapeNone),colorRed,0,r,Offset=30);
PlotShapes(IIf(Sell,shapeSmallSquare,shapeNone),colorOrange,0,r,Offset=40);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorWhite,0,r,Offset=-35);


_SECTION_END();

_SECTION_BEGIN("Gartley");
GBmin = Param("Swing B Min.",0.55,0.3,1,0.01);
GBmax = Param("Swing B Max.",0.72,0.4,1,0.01);
GCmin = Param("Swing C Min.",0.38,0.3,1.27,0.01);
GCmax = Param("Swing C Max.",1.0,0.4,1.27,0.01);
GDmin = Param("Swing D Min.(XA)",0.55,0.3,1,0.01);
GDmax = Param("Swing D Max.(XA)",1.0,0.4,1.0,0.01);

_SECTION_END();

_SECTION_BEGIN("Bat");

BatBmin = Param("Swing B Min.",0.38,0.3,1,0.01);
BatBmax = Param("Swing B Max.",0.55,0.4,1,0.01);
BatCmin = Param("Swing C Min.",0.38,0.3,1.62,0.01);
BatCmax = Param("Swing C Max.",1.27,0.4,1.62,0.01);
BatDmin = Param("Swing D Min.(XA)",0.5,0.3,1,0.01);
BatDmax = Param("Swing D Max.(XA)",1.0,0.4,1.0,0.01);

_SECTION_END();

_SECTION_BEGIN("Butterfly");
ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
BtBmin = Param("Swing B Min.",0.55,0.3,1,0.01);
BtBmax = Param("Swing B Max.",0.9,0.4,1,0.01);
BtCmin = Param("Swing C Min.",0.38,0.3,1.62,0.01);
BtCmax = Param("Swing C Max.",1.27,0.4,1.62,0.01);
BtDmin = Param("Swing D Min.(XA)",1,1,1.8,0.01);
BtDmax = Param("Swing D Max.(XA)",1.38,1,1.8,0.01);

_SECTION_END();

_SECTION_BEGIN("Crab");

CBmin = Param("Swing B Min.",0.38,0.3,1,0.01);
CBmax = Param("Swing B Max.",0.65,0.4,1,0.01);
CCmin = Param("Swing C Min.",0.38,0.3,1.62,0.01);
CCmax = Param("Swing C Max.",1.270,0.4,1.62,0.01);
CDmin = Param("Swing D Min.(XA)",1.25,1,1.8,0.01);
CDmax = Param("Swing D Max.(XA)",1.8,1,2,0.01);

_SECTION_END();

_SECTION_BEGIN("Patterns");

strength = Param("Strength",9,2,15,1);
bu = ParamToggle("Bullish Pattern","Off|On",1);
be = ParamToggle("Bearish Pattern","Off|On",1);

bi = Cum(1)-1;

function GetTop(bars)
{
Top =r== HHV(r,2*bars) AND Ref(HHV(r,bars),bars) < r;
Top = Top AND LastValue(bi)-ValueWhen(Top,bi) > bars;
return Top;
}

function GetValley(bars)
{
Valley = W1== LLV(W1,2*bars) AND Ref(LLV(W1,bars),bars) >W1;
Valley = Valley AND LastValue(bi)-ValueWhen(Valley,bi) > bars;
return Valley;
}


// Build fractals array

P1 = GetTop(strength);
V1 = GetValley(Strength);

P1 = IIf(P1,IIf(ValueWhen(P1,bi,2) < ValueWhen(V1,bi),P1,IIf(ValueWhen(P1,r,2) >r,False,P1)),P1);
//P1 = IIf(P1 AND ValueWhen(P1,bi,0) > bi,IIf(ValueWhen(P1,bi,0) < ValueWhen(V1,bi,0),IIf(ValueWhen(P1,r,0) >=r,False,P1),P1),P1);
P1 = IIf(P1 AND ValueWhen(P1,bi,0) > bi AND NOT(ValueWhen(V1,bi,0) > 0 AND ValueWhen(V1,bi,0)<ValueWhen(P1,bi,0)),IIf(ValueWhen(P1,r)<=ValueWhen(P1,r,0), False,P1),P1);


V1 = IIf(V1,IIf(ValueWhen(V1,bi,2) < ValueWhen(P1,bi),V1,IIf(ValueWhen(V1,W1,2)<W1,False,V1)),V1);
//V1 = IIf(V1 AND ValueWhen(V1,bi,0) > bi ,IIf(ValueWhen(V1,bi,0) < ValueWhen(P1,bi,0),IIf(ValueWhen(V1,W1,0) <= W1, False,V1),V1),V1);
V1 = IIf(V1 AND ValueWhen(V1,bi,0) > bi AND NOT(ValueWhen(P1,bi,0) > bi AND ValueWhen(P1,bi,0)<ValueWhen(V1,bi,0)) , IIf(ValueWhen(V1,W1)>=ValueWhen(V1,W1,0),False,V1),V1);


P1H1 = ValueWhen(P1,r);
P1Bar1 = ValueWhen(P1,bi);
P1H2 = ValueWhen(P1,r,2);
P1Bar2 = ValueWhen(P1,bi,2);
V1L1 = ValueWhen(V1,W1);
V1Bar1 = ValueWhen(V1,bi);
V1L2 = ValueWhen(V1,W1,2);
V1Bar2 = ValueWhen(V1,bi,2);


//Bullish Patterns

PTvalid = (P1Bar1 > V1Bar1 AND V1Bar1 > P1Bar2 AND P1bar2 > V1Bar2) AND P1; // Peaks and troughs are in order

// 4 swings of developing Gartley/Bat etc.

BullGartley4 = PTvalid AND (P1H2-V1L1)/(P1H2-V1L2) > GBmin AND (P1H2-V1L1)/(P1H2-V1L2) < GBmax
AND (P1H1-V1L1)/(P1H2-V1L1) > GCMin AND (P1H1-V1L1)/(P1H2-V1L1) < GCMax;

BullBat4 = PTvalid AND (P1H2-V1L1)/(P1H2-V1L2) > BatBmin AND (P1H2-V1L1)/(P1H2-V1L2) < BatBmax
AND (P1H1-V1L1)/(P1H2-V1L1) > BatCMin AND (P1H1-V1L1)/(P1H2-V1L1) < BatCMax;

BullButterfly4 = PTvalid AND (P1H2-V1L1)/(P1H2-V1L2) > BtBmin AND (P1H2-V1L1)/(P1H2-V1L2) < BtBMax
AND (P1H1-V1L1)/(P1H2-V1L1) > BtCmin AND (P1H1-V1L1)/(P1H2-V1L1) < BtCmax;

BullCrab4 = PTvalid AND (P1H2-V1L1)/(P1H2-V1L2) >CBmin AND (P1H2-V1L1)/(P1H2-V1L2) < CBmax
AND (P1H1-V1L1)/(P1H2-V1L1) > CCmin AND (P1H1-V1L1)/(P1H2-V1L1) < CCmax;


// Bullish Gartley/Bat found. D retacement level is not evaluated

BullGartley = IIf(LowestSince(BullGartley4,W1) < ValueWhen(BullGartley4,P1H2)-(ValueWhen(BullGartley4,P1H2)-ValueWhen(BullGartley4,V1L2))*GDmin AND
LowestSince(bullGartley4,W1) > ValueWhen(BullGartley4,P1H2)-(ValueWhen(BullGartley4,P1H2)-ValueWhen(BullGartley4,V1L2))*GDmax AND
HighestSince(BullGartley4,r) <= ValueWhen(BullGartley4,P1H1 ) AND
LowestSince(bullGartley4,W1)==W1, True,False);
BullGartley = BullGartley AND LowestSince(BullGartley4,W1) < ValueWhen(BullGartley4,V1L1);

BullBat = IIf(LowestSince(BullBat4,W1) < ValueWhen(BullBat4,P1H2)-(ValueWhen(BullBat4,P1H2)-ValueWhen(BullBat4,V1L2))*BatDmin AND
LowestSince(BullBat4,W1) > ValueWhen(BullBat4,P1H2)-(ValueWhen(BullBat4,P1H2)-ValueWhen(BullBat4,V1L2))*BatDmax AND
HighestSince(BullBat4,r) <= ValueWhen(BullBat4,P1H1 ) AND
LowestSince(BullBat4,W1)==W1, True,False);
BullBat = BullBat AND LowestSince(BullCrab4,W1) < ValueWhen(BullCrab4,V1L1);


BullCrab = IIf(LowestSince(BullCrab4,W1) < ValueWhen(BullCrab4,P1H2)-(ValueWhen(BullCrab4,P1H2)-ValueWhen(BullCrab4,V1L2))*CDmin AND
LowestSince(BullCrab4,W1) > ValueWhen(BullCrab4,P1H2)-(ValueWhen(BullCrab4,P1H2)-ValueWhen(BullCrab4,V1L2))*CDmax AND
HighestSince(BullCrab4,r) <= ValueWhen(BullCrab4,P1H1 ) AND
LowestSince(bullGartley4,W1)==W1, True,False);
BullCrab = BullCrab AND LowestSince(BullCrab4,W1) < ValueWhen(BullCrab4,V1L2);


BullButterfly = IIf(LowestSince(BullButterfly4,W1) < ValueWhen(BullButterfly4,P1H2)-(ValueWhen(BullButterfly4,P1H2)-ValueWhen(BullButterfly4,V1L2))*BtDMin AND
LowestSince(BullButterfly4,W1) > ValueWhen(BullButterfly4,P1H2)-(ValueWhen(BullButterfly4,P1H2)-ValueWhen(BullButterfly4,V1L2))*BtDmax AND
HighestSince(BullButterfly4,r) <= ValueWhen(BullButterfly4,P1H1 ) AND
LowestSince(bullButterfly4,W1)==W1, True,False);
BullButterfly = BullButterfly AND LowestSince(BullButterfly4,W1) < ValueWhen(BullButterfly4,V1L2);



// to remove redumbdent lines

BullHar4 = BullGartley4 OR BullButterfly4 OR BullBat4 OR BullCrab4 ;
BullHar = BullGartley OR BullButterfly OR BullBat OR BullCrab ;

Point4 = IIf(BullHar,ValueWhen(BullHar4,bi),Null);
BullHar = IIf(BullHar, IIf(Point4 == ValueWhen(BullHar,point4,0) AND ValueWhen(BullHar,bi,0) > bi ,False,BullHar),BullHar);

X = ValueWhen(BullHar4,V1L2);
Xbar = ValueWhen(BullHar4,V1Bar2);
A = ValueWhen(BullHar4,P1H2);
Abar = ValueWhen(BullHar4,P1bar2);
B = ValueWhen(BullHar4,V1L1);
Bbar = ValueWhen(BullHar4,V1bar1);
C1 = ValueWhen(BullHar4,P1H1);
C1bar = ValueWhen(BullHar4,P1bar1);
D = ValueWhen(BullHar,W1);
Dbar = ValueWhen(BullHar,bi);
ABdXA = (A-B)/(A-X);
BCdAB = (C1-B)/(A-B);
ADdXA = (A-D)/(A-X);
BCdCD = (C1-D)/(C1-B);

PlotPattern = Dbar > C1bar;
if(LastValue(PlotPattern) AND bu)
{
Plot( LineArray(LastValue(Xbar),LastValue(X),LastValue(Abar),LastValue(A)),"",colorD arkBlue,styleThick);
Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(Bbar),LastValue(B)),"",c olorDarkBlue,styleThick);
Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(C1bar),LastValue(C1)),"" ,colorDarkBlue,styleThick);
Plot(LineArray(LastValue(C1bar),LastValue(C1),LastValue(Dbar),LastValue(D)),"" ,colorDarkBlue,styleThick);
Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Bbar),LastValue(B)),"",c olorDarkBlue,styleDashed);
Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Abar),LastValue(A)),"",c olorDarkBlue,styleThick);
Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(C1bar),LastValue(C1)),"" ,colorDarkBlue,styleDashed);
Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(Dbar),LastValue(D)),"",c olorDarkBlue,styleDashed);
Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Dbar),LastValue(D)),"",c olorDarkBlue,styleDashed);

PlotText(NumToStr(LastValue(ABdXA),1.2),(LastValue(Bbar)+LastValue(Xbar))/2,(LastValue(B)+LastValue(X))/2,colorDarkBlue);
PlotText(NumToStr(LastValue(BCdAB),1.2),(LastValue(C1bar)+LastValue(Abar))/2,(LastValue(C1)+LastValue(A))/2,colorDarkBlue);
PlotText(NumToStr(LastValue(ADdXA),1.2) ,(LastValue(Dbar)+LastValue(Xbar))/2,(LastValue(D)+LastValue(X))/2,colorDarkBlue);
PlotText(NumToStr(LastValue(BCdCD),1.2),(LastValue(Bbar)+LastValue(Dbar))/2,(LastValue(B)+LastValue(D))/2,colorDarkBlue);
}

// Bearish Patterns

PTvalid = (V1Bar1 > P1Bar1 AND P1Bar1 > V1Bar2 AND V1Bar2 > P1Bar2) AND V1;

// Swing 4

BearGartley4 = PTvalid AND (P1H1-V1L2)/(P1H2-V1L2) > GBmin AND (P1H1-V1L2)/(P1H2-V1L2) < GBmax AND
(P1H1-V1L1)/(P1H1-V1L2) > GCmin AND (P1H1-V1L1)/(P1H1-V1L2) < GCmax;

BearBat4 = PTvalid AND (P1H1-V1L2)/(P1H2-V1L2) > BatBmin AND (P1H1-V1L2)/(P1H2-V1L2) < BatBmax AND
(P1H1-V1L1)/(P1H1-V1L2) > BatCmin AND (P1H1-V1L1)/(P1H1-V1L2) < BatCmax;

BearButterfly4 = PTvalid AND (P1H1-V1L2)/(P1H2-V1L2) > BtBmin AND (P1H1-V1L2)/(P1H2-V1L2) < BtBmax AND
(P1H1-V1L1)/(P1H1-V1L2) > BtCmin AND (P1H1-V1L1)/(P1H1-V1L2) < BtCmax;

BearCrab4 = PTvalid AND (P1H1-V1L2)/(P1H2-V1L2) > CBmin AND (P1H1-V1L2)/(P1H2-V1L2) < CBmax AND
(P1H1-V1L1)/(P1H1-V1L2) > CCmin AND (P1H1-V1L1)/(P1H1-V1L2) < CCmax;

// Poin D

BearGartley = IIf(HighestSince(bearGartley4,r) > ValueWhen(BearGartley4,V1L2) + (ValueWhen(BearGartley4,P1H2) - ValueWhen(BearGartley4,V1L2))*GDmin AND
HighestSince(bearGartley4,r) < ValueWhen(BearGartley4,V1L2) + (ValueWhen(BearGartley4,P1H2) - ValueWhen(BearGartley4,V1L2))*GDMax AND
LowestSince(BearGartley4,W1) >= ValueWhen(BearGartley4,V1L1 ) AND
HighestSince(BearGartley4,r) ==r, True, False);
BearGartley = BearGartley AND HighestSince(BearGartley4,r) > ValueWhen(BearGartley4,P1H1);

BearBat = IIf((HighestSince(BearBat4,r) > ValueWhen(BearBat4,V1L2) + (ValueWhen(BearBat4,P1H2) - ValueWhen(BearBat4,V1L2))*BatDmin AND
HighestSince(BearBat4,r) < ValueWhen(BearBat4,V1L2) + (ValueWhen(BearBat4,P1H2) - ValueWhen(BearBat4,V1L2))*BatDMax AND
LowestSince(BearBat4,W1) >= ValueWhen(BearBat4,V1L1 ) AND
HighestSince(BearBat4,r) == r), True, False);
BearBat = BearBat AND HighestSince(BearBat4,r) > ValueWhen(BearBat4,P1H1);

BearButterfly = IIf(HighestSince(BearButterfly4,r) > ValueWhen(BearButterfly4,V1L2) + (ValueWhen(BearButterfly4,P1H2) - ValueWhen(BearButterfly4,V1L2))*BtDmin AND
HighestSince(BearButterfly4,r) < ValueWhen(BearButterfly4,V1L2) + (ValueWhen(BearButterfly4,P1H2) - ValueWhen(BearButterfly4,V1L2))*BtDMax AND
LowestSince(BearButterfly4,W1) >= ValueWhen(BearButterfly4,V1L1 ) AND
HighestSince(BearButterfly4,r) == r, True, False);
BearButterfly = BearButterfly AND HighestSince(BearButterfly4,r) > ValueWhen(BearButterfly4,P1H2);

BearCrab = IIf(HighestSince(BearCrab4,r) > ValueWhen(BearCrab4,V1L2) + (ValueWhen(BearCrab4,P1H2) - ValueWhen(BearCrab4,V1L2))*CDmin AND
HighestSince(BearCrab4,r) < ValueWhen(BearCrab4,V1L2) + (ValueWhen(BearCrab4,P1H2) - ValueWhen(BearCrab4,V1L2))*CDMax AND
LowestSince(BearCrab4,W1) >= ValueWhen(BearCrab4,V1L1 ) AND
HighestSince(BearCrab4,r) ==r, True, False);
BearCrab =BearCrab AND HighestSince(BearCrab4,r) > ValueWhen(BearCrab4,P1H2);


BearHar4 = BearGartley4 OR BearButterfly4 OR BearBat4 OR BearCrab4 ;
BearHar = BearGartley OR BearButterfly OR BearBat OR BearCrab ;

Point4 = IIf(BearHar,ValueWhen(BearHar4,bi),Null);
BearHar = IIf(BearHar, IIf(Point4 == ValueWhen(BearHar,point4,0) AND ValueWhen(BearHar,bi,0) > bi ,False,BearHar),BearHar);

X = ValueWhen(BearHar4,P1H2);
Xbar = ValueWhen(BearHar4,P1Bar2);
A = ValueWhen(BearHar4,V1L2);
Abar = ValueWhen( BearHar4,V1bar2);
B = ValueWhen(BearHar4,P1H1);
Bbar = ValueWhen(BearHar4,P1bar1);
C1 = ValueWhen(BearHar4,V1L1);
C1bar = ValueWhen(BearHar4,V1bar1);
D = ValueWhen(BearHar,r);
Dbar = ValueWhen(BearHar,bi);

ABdXA = (B-A)/(X-A);
BCdAB = (B-C1)/(B-A);
ADdXA = (D-A)/(X-A);
BCdCD = (D-C1)/(B-C1);

PlotPattern = Dbar > C1bar;

if(LastValue(Plotpattern) AND be)

{
Plot( LineArray(LastValue(Xbar),LastValue(X),LastValue(Abar),LastValue(A)),"",colorD arkRed,styleThick);
Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(Bbar),LastValue(B)),"",c olorDarkRed,styleThick);
Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(C1bar),LastValue(C1)),"" ,colorDarkRed,styleThick);
Plot(LineArray(LastValue(C1bar),LastValue(C1),LastValue(Dbar),LastValue(D)),"" ,colorDarkRed,styleThick);
Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Bbar),LastValue(B)),"",c olorDarkRed,styleDashed);
Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Abar),LastValue(A)),"",c olorDarkRed,styleThick);
Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(C1bar),LastValue(C1)),"" ,colorDarkRed,styleDashed);
Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(Dbar),LastValue(D)),"",c olorDarkRed,styleDashed);
Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Dbar),LastValue(D)),"",c olorDarkRed,styleDashed);

PlotText(NumToStr(LastValue(ABdXA),1.2),(LastValue(Bbar)+LastValue(Xbar))/2,(LastValue(B)+LastValue(X))/2,colorDarkRed);
PlotText(NumToStr(LastValue(BCdAB),1.2),(LastValue(C1bar)+LastValue(Abar))/2,(LastValue(C1)+LastValue(A))/2,colorDarkRed);
PlotText(NumToStr(LastValue(BCdCD),1.2) ,(LastValue(Dbar)+LastValue(Bbar))/2,(LastValue(D)+LastValue(B))/2,colorDarkRed);
PlotText(NumToStr(LastValue(ADdXA),1.2) ,(LastValue(Dbar)+LastValue(Xbar))/2,(LastValue(D)+LastValue(X))/2,colorDarkRed);

}

LatPattern = bullHar OR bearHar;
Lastpattern = LastValue(ValueWhen(LatPattern,IIf(BullGartley,1,IIf(BearGartley,-1,IIf(BullBat,2,IIf(BearBat,-2,
IIf(BullButterfly,3,IIf(BearButterfly,-3,IIf(BullCrab,4,IIf(BearCrab,-4,Null))))))))));
PatternName = WriteIf(LastPattern == 1,"Bullish Gartley",WriteIf(LastPattern == -1,"Bearish Gartley",WriteIf(LastPattern == 2,"Bullish Bat",
WriteIf(LastPattern == -2,"Bearish Bat",WriteIf(LastPattern == 3,"Bullish Butterfly",WriteIf(LastPattern == -3,"Bearish Butterfly",
WriteIf(LastPattern == 4,"Bullish Crab",WriteIf(LastPattern == -4,"Bearish Crab","None"))))))));


plotFractals = ParamToggle("Plot Fractals","Off|On",0);
if(PlotFractals)
{
PlotShapes(shapeSmallCircle*P1,colorRed,0,r,10);
PlotShapes(shapeSmallCircle*V1,colorBlue,O,W1,-10);
}
RF=ValueWhen(P1,r);
SF=ValueWhen(V1,W1);
cbar = Param("cbar",4,2,50,1);
RF1 = IIf(RF AND BarsSince(P1) <=cbar,RF,Null);
SF1 = IIf(SF AND BarsSince(V1) <=cbar,SF,Null);
Plot(RF1,"",colorWhite,styleDots | styleNoLine);
Plot(SF1,"",colorWhite,styleDots | styleNoLine);
Plot(RF,"",colorBlack,40+16);
Plot(SF,"",colorBlack,40+16);
PlotShapes(IIf(P1, shapeSmallSquare,shapeNone),colorYellow,0,r,10);
PlotShapes(shapeSmallCircle*P1,colorBlack,0,r,10);
PlotShapes(IIf(V1, shapeSmallSquare,shapeNone),colorYellow,0,W1,-10);
PlotShapes(shapeSmallCircle*V1,colorBlack,0,W1,-10);
numbars = SelectedValue(Cum(Status("barvisible")));
fraction= IIf(StrRight(Name(),3) == "",3.2,3.2);
hts = Param ("Text Shift", -50,-100,100,10);
PlotText(">>>" + WriteVal(r,fraction),
SelectedValue(BarIndex())-(numbars/hts),SelectedValue(C),2);
PlotText("" + WriteVal(RF,fraction),
SelectedValue(BarIndex()+2)-(numbars/hts),SelectedValue(RF),colorWhite,colorBlue);
PlotText("" + WriteVal(SF,fraction),
SelectedValue(BarIndex()+2)-(numbars/hts),SelectedValue(SF),colorBlack,colorYellow);
GfxSetTextColor(IIf(LastPattern > 0, colorGreen,colorRed));
GfxTextOut("Last Pattern : " + PatternName,0,20);

_SECTION_BEGIN("MACD Divergence");


// Parameters
PeriodEMA = 13;
MACDIndicatorRange = 50;

// Volume filter
VolumeFilter = Param( "Volume MA filter", 100000, 50000, 500000, 100000 );
Timeframe = Interval(2);

// Adjust for weekly if necessary
if( Timeframe == "5-day" || Timeframe == "Weekly" ) {
VolumeFilter = VolumeFilter * 5;
}
else if( Timeframe == "Monthly") {
VolumeFilter = VolumeFilter * 20;
}
else if( Timeframe != "Daily" ) {
VolumeFilter = 0;
}

// Minimum number of bars required to form a divergence pattern. For a
// positive divergence, this is the number of falling bars in the context
// of a rising MACD or MACD-H pattern. Vice versa for negative divergence
MACDDivMinWidth = Param("Divergence min width", 4, 1, 10, 1 );

// Minimum width of negative projecting wave between two positive MACD-H waves,
// otherwise two positive waves will be considered as one single wave. This
// minimises invalid divergences, to ensure that "back of bears is broken".
// The same applies for a positive wave between two negative waves.
HistMinWidth = Param("Histogram min width", 4, 1, 10, 1 );


PeriodEMA = Optimize( "PeriodEMA ", 13, 5, 23, 1 );

// Other parameters
OpenPositions = 10;
ATRPeriod = 5;
InitialCapital = 100000;

PeriodFast = Param( "Fast EMA", 12, 2, 200, 1 );
PeriodSlow = Param( "Slow EMA", 26, 2, 200, 1 );
PeriodSignal = Param( "Signal EMA", 9, 2, 200, 1 );
MACDInd = MACD(PeriodFast, PeriodSlow );
SigInd = Signal(PeriodFast, PeriodSlow , PeriodSignal );
HistInd = MACDInd - SigInd ;
_N( macdStr = WriteVal( PeriodFast, 1.0 )+","+WriteVal( PeriodSlow , 1.0 ) );
_N( sigStr = macdStr + ","+WriteVal( PeriodSignal , 1.0 ) );

// Get displayed min and max value of MACD and MACD-H, to rescale it for better visibility
scMACDMax = LastValue(HHV(Max(MACDInd, sigInd),
BarsSince( Status("barvisible") AND NOT Ref(Status("barvisible"),-1) )));
scMACDMin = LastValue(LLV(Min(MACDInd, sigInd),
BarsSince( Status("barvisible") AND NOT Ref(Status("barvisible"),-1) )));
scaleMACD = Max( abs(scMACDMax), abs(scMACDMin) );

scHistMax = LastValue(HHV(HistInd,
BarsSince( Status("barvisible") AND NOT Ref(Status("barvisible"),-1) )));
scHistMin = LastValue(LLV(HistInd,
BarsSince( Status("barvisible") AND NOT Ref(Status("barvisible"),-1) )));
scaleHist = Max( abs(scHistMax), abs(scHistMin) );

;



// If current symbol is NOT an index, compare volume MA to filter limit
VolumeMA = MA( V, 50 );
if( IsIndex() ) {
VolumeMABool = True;
}
else {
VolumeMABool = IsTrue( VolumeMA > VolumeFilter );
}

// Get MACD-H, EMA, Stochastics and RSI arrays
DayHist = MACD( PeriodFast, PeriodSlow ) -
Signal( PeriodFast, PeriodSlow, PeriodSignal );
DayEMA = EMA( Close, PeriodEMA );
DaySTO = StochK( 14 );
DayRSI = RSI( 14 );
DayBuyBool = IsTrue(
( // DayEMA > Ref(DayEMA,-1) // EMA rising
DaySTO < 70 // STO not overbought
// AND DayRSI > Ref(DayRSI,-1) // RSI rising
AND MACD( PeriodFast, PeriodSlow ) < 0 )
OR Timeframe == "5-day" OR Timeframe == "Weekly"
);
DaySellBool = IsTrue(
( // DayEMA < Ref(DayEMA,-1) // EMA falling
DaySTO > 30 // STO not oversold
// AND DayRSI < Ref(DayRSI,-1) // RSI falling
AND MACD( PeriodFast, PeriodSlow ) > 0 )
OR Timeframe == "5-day" OR Timeframe == "Weekly"
);


//--------------------------
// Positive MACD divergences
//--------------------------

// Get array containing for each , when the MACD's lowest
// value occur, within the specified number of bars
MACDLowBars = LLVBars( MACDInd, MACDDivMinWidth );

// Get array defining if the MACD's previous bar was the
// minimum, AND if that MACD value < 0
MACDMinCond = MACDLowBars > 0 AND
Ref(MACDLowBars,-1) == 0 AND
Ref(MACDInd,-1) < 0;

// Get array containing MACD low bar values where lows
// occured, all other bars filled with 0
MACDLowVal = IIf( MACDMinCond , Ref(MACDInd,-1), 0 );

// Get array containing MACD low bar value at bar where MACD
// low occured, all other bars filled with preceding MACD
// low value (chandelier)
MACDLowSteps = ValueWhen( Ref(MACDMinCond,0),
Ref(MACDInd,-1), 1 );

// Get array containing price low bar values where lows
// occured, all other bars filled with huge number
PriceMACDLowVal = IIf( MACDMinCond,
Ref(LLV(L,MACDDivMinWidth ),-1),
2000000 );

// Get array containing local price low bar value at bar
// where MACD low occured, all other bars filled with preceding
// price low value (chandelier)
PriceMACDLowSteps = ValueWhen( Ref(MACDMinCond ,0),
LLV(L,MACDDivMinWidth ) );

// Get array containing differences in MACD low bar values
MACDLowDiffs = MACDLowSteps - Ref(MACDLowSteps,-1);

// Get array containing differences in price low bar values
PriceMACDLowDiffs = PriceMACDLowSteps - Ref(PriceMACDLowSteps,-1);

// Get array defining positive divergences
MACDLowBarDiffs = Ref( BarsSince(MACDMinCond ), -1 );

// Divergence signal
MACDPosDivergence = // MACDLowDiffs > 0 AND
MACDLowVal < 0
AND MACDLowVal > LLV(MACDLowVal, MACDIndicatorRange )
AND PriceMACDLowVal < LLV(Ref(PriceMACDLowVal,-1), MACDIndicatorRange )
AND PriceMACDLowDiffs < 0
AND MACDLowBarDiffs < MACDIndicatorRange
AND VolumeMABool
AND C > 1.0
// AND WeekBuyBool
;


//--------------------------
// Negative MACD divergences
//--------------------------

// Get array containing for each , when the MACD's highest
// value occur, within the specified number of bars
MACDHighBars = HHVBars( MACDInd, MACDDivMinWidth );

// Get array defining if the MACD's previous bar was the
// maximum, AND if that MACD value > 0
MACDMaxCond = MACDHighBars > 0 AND
Ref(MACDHighBars,-1) == 0 AND
Ref(MACDInd,-1) > 0;

// Get array containing MACD high bar values where highs
// occured, all other bars filled with 0
MACDHighVal = IIf( MACDMaxCond,
Ref(MACDInd,-1), 0);

// Get array containing MACD high bar value at bar where MACD
// high occured, all other bars filled with preceding MACD
// high value (chandelier)
MACDHighSteps = ValueWhen( Ref(MACDMaxCond,0),
Ref(MACDInd,-1), 1 );

// Get array containing MACD high bar values where highs
// occured, all other bars filled with 0
PriceMACDHighVal = IIf( MACDMaxCond,
Ref(HHV(H,MACDDivMinWidth),-1),
0);

// Get array containing local price high bar value at bar
// where MACD high occured, all other bars filled with preceeding
// price high value (chandelier)
PriceMACDHighSteps = ValueWhen( Ref(MACDMaxCond,0),
HHV(H,MACDDivMinWidth) );

// Get array containing differences in MACD high bar values
MACDHighDiffs = MACDHighSteps - Ref(MACDHighSteps,-1);

// Get array containing differences in price high bar values
PriceMACDHighDiffs = PriceMACDHighSteps - Ref(PriceMACDHighSteps,-1);

// Get array defining negative divergences
MACDHighBarDiffs = Ref( BarsSince(MACDMaxCond), -1 );

// Divergence signal
MACDNegDivergence = // MACDHighDiffs < 0 AND
MACDHighVal > 0
AND PriceMACDHighVal > HHV( Ref(PriceMACDHighVal,-1), MACDIndicatorRange )
AND MACDHighVal < HHV( MACDHighVal, MACDIndicatorRange )
AND PriceMACDHighDiffs > 0
AND MACDHighBarDiffs < MACDIndicatorRange
AND VolumeMABool
AND C > 1.0
// AND WeekBuyBool
;


//------------------------------------
// Positive MACD Histogram divergences
//------------------------------------

// Get array containing when positive and negative and positive
// crossovers occured
HistPosCrossover = Cross( HistInd, 0 ) ;
HistNegCrossover = Cross( 0, HistInd ) ;
BarsSinceNegCross = BarsSince( HistNegCrossover );
BarsSincePosCross = BarsSince( HistPosCrossover );

// Get arrays containing for each , when the MACD-H lowest
// values occur, within the specified number of bars
HistLowBars = LLVBars( HistInd, MACDDivMinWidth );

// Get array defining if the MACD-H previous bar was the minimum
// AND if that MACD-H value was < 0 or > 0
HistMinCond = HistLowBars > 0 AND
BarsSinceNegCross >= HistLowBars AND
Ref(HistLowBars,-1) == 0 AND
Ref(HistInd,-1) < 0;

// Get array containing MACD-H low bar values where lows
// occured, all other bars filled with 0
HistLowVal = IIf( HistMinCond , Ref(HistInd,-1), 0 );

// Get array containing MACD-H low bar value at bar where MACD-H
// low occured, all other bars filled with preceding MACD-H
// low value (chandelier)
HistLowSteps = ValueWhen( Ref(HistMinCond,0), Ref(HistInd,-1), 1 );

// Get array containing differences between MACD-H low bar value and the value
// at previous MACD-H zero positive crossing
// HistLowDiffs = HistLowSteps - ValueWhen( HistPosCrossover, HistLowSteps, 1 );
HistLowDiffs = HistLowSteps - Ref(HistLowSteps,-1);

// Get array containing MACD-H min value when MACD-H < 0, all other
// bars filled with 0
BarsSincePrevNegCross = ValueWhen( HistNegCrossover,
Ref(BarsSinceNegCross ,-1), 1 );
BarsSinceWideNegCross = IIf( HistInd < 0 AND
BarsSincePosCross - BarsSinceNegCross <
HistMinWidth,
BarsSincePrevNegCross + BarsSinceNegCross + 1,
BarsSinceNegCross );
HistMinSteps = IIf( !BarsSinceWideNegCross,
HistInd,
LLV( HistInd , BarsSinceWideNegCross + 1) );

// Get array containing differences in MACD-H max bar values
HistMinDiffs = IIf( HistInd < 0,
HistMinSteps - Ref(HistMinSteps,-1),
0);

// Get minumum from previous MACD-H negative wave
// Plot( ValueWhen( HistNegCrossover, Ref(HistMinSteps,-1), 1 ),"PrevHistMinSteps-1", colorGreen );
// Plot( ValueWhen( HistNegCrossover, Ref(HistMinSteps,-1), 2 ),"PrevHistMinSteps-1", colorGreen );
PrevHistMinSteps = IIf( HistInd < 0 AND
BarsSincePosCross - BarsSinceNegCross <
HistMinWidth,
ValueWhen( HistNegCrossover,
Ref(HistMinSteps,-1), 2 ),
ValueWhen( HistNegCrossover,
Ref(HistMinSteps,-1), 1 ) );

// Get array containing price low bar values where lows
// occured, all other bars filled with huge number
PriceHistLowVal = IIf( HistMinCond,
Ref(LLV(L,MACDDivMinWidth),-1),
2000000 );

// Get array containing local price low bar value at bar
// where MACD-H low occured, all other bars filled with preceding
// price low value (chandelier)
PriceHistLowSteps = ValueWhen( Ref(HistMinCond ,0),
LLV(L,MACDDivMinWidth) );

// Get array containing differences in price low bar values
PriceHistLowDiffs = PriceHistLowSteps - Ref(PriceHistLowSteps,-1);

// Get array containing price low minimum value when MACD-H < 0,
// all other bars filled with 0
PriceHistMinSteps = IIf( !BarsSinceNegCross,
L,
LLV( L , BarsSinceNegCross) );

// Get minimum from previous MACD-H negative wave
PrevPriceHistMinSteps = IIf( BarsSincePosCross - BarsSinceNegCross <
HistMinWidth,
ValueWhen( HistNegCrossover,
Ref(PriceHistMinSteps,-1), 2 ),
ValueWhen( HistNegCrossover,
Ref(PriceHistMinSteps,-1), 1 ) );

// Divergence signal
HistPosDivergence = // HistLowDiffs > 0 AND
// AND PriceHistLowDiffs < 0
HistMinSteps > PrevHistMinSteps
AND PriceHistMinSteps < PrevPriceHistMinSteps
AND HistLowVal < 0
AND VolumeMABool
AND C > 1.0
;


//------------------------------------
// Negative MACD Histogram divergences
//------------------------------------

// Get arrays containing for each , when the MACD-H highest values
// occur, within the specified number of bars
HistHighBars = HHVBars( HistInd, MACDDivMinWidth );

// Get array defining if the MACD-H previous bar was the maximum,
// AND if that MACD-H value was < 0 OR > 0
HistMaxCond = HistHighBars > 0
AND BarsSincePosCross >= HistHighBars
AND Ref(HistHighBars,-1) == 0
AND Ref(HistInd,-1) > 0
;

// Get array containing MACD-H high bar values where highs
// occured, all other bars filled with 0
HistHighVal = IIf( HistMaxCond, Ref(HistInd,-1), 0);

// Get array containing MACD-H high bar value at bar where MACD-H
// high occured, all other bars filled with preceding MACD-H
// high value (chandelier)
HistHighSteps = ValueWhen( Ref(HistMaxCond,0),
Ref(HistInd,-1), 1 );

// Get array containing differences in MACD-H high bar values
HistHighDiffs = HistHighSteps - Ref(HistHighSteps,-1);

// Get array containing MACD-H max value when MACD-H > 0, all other
// bars filled with 0
BarsSincePrevPosCross = ValueWhen( HistPosCrossover,
Ref(BarsSincePosCross ,-1), 1 );
BarsSincePrevNegCross = ValueWhen( HistNegCrossover,
Ref(BarsSinceNegCross ,-1), 1 );
BarsSinceWidePosCross = IIf( HistInd > 0 AND
BarsSinceNegCross - BarsSincePosCross <
HistMinWidth,
BarsSincePrevPosCross + BarsSincePosCross + 1,
BarsSincePosCross );
HistMaxSteps = IIf( !BarsSinceWidePosCross,
HistInd,
HHV( HistInd , BarsSinceWidePosCross + 1) );

// Get array containing differences in MACD-H max bar values
HistMaxDiffs = IIf( HistInd > 0,
HistMaxSteps - Ref(HistMaxSteps,-1),
0);

// Get high from pevious MACD-H positive wave
PrevHistMaxSteps = IIf( HistInd > 0 AND
BarsSinceNegCross - BarsSincePosCross <
HistMinWidth,
ValueWhen( HistPosCrossover,
Ref(HistMaxSteps,-1), 2 ),
ValueWhen( HistPosCrossover,
Ref(HistMaxSteps,-1), 1 ) );

// Get array containing MACD-H high bar values where highs
// occured, all other bars filled with 0
PriceHistHighVal = IIf( HistMaxCond,
Ref(HHV(H,MACDDivMinWidth),-1),
0);

// Get array containing local price high bar value at bar
// where MACD-H high occured, all other bars filled with preceeding
// price high value (chandelier)
PriceHistHighSteps = ValueWhen( Ref(HistMaxCond,0),
HHV(H,MACDDivMinWidth) );

// Get array containing differences in price high bar values
PriceHistHighDiffs = PriceHistHighSteps - Ref(PriceHistHighSteps,-1);

// Get array containing MACD-H max value when MACD-H > 0, all other
// bars filled with 0
PriceHistMaxSteps = IIf( !BarsSincePosCross,
H,
HHV( H , BarsSincePosCross) );

// Get high from pevious MACD-H positive wave
PrevPriceHistMaxSteps = IIf( BarsSinceNegCross - BarsSincePosCross <
HistMinWidth,
ValueWhen( HistPosCrossover,
Ref(PriceHistMaxSteps,-1), 2 ),
ValueWhen( HistPosCrossover,
Ref(PriceHistMaxSteps,-1), 1 ) );

// Divergence signal
HistNegDivergence = // HistHighDiffs < 0 AND
// AND PriceHistHighDiffs > 0
HistMaxSteps < PrevHistMaxSteps
AND PriceHistMaxSteps > PrevPriceHistMaxSteps
AND HistHighVal > 0
AND VolumeMABool
AND C > 1.0
;


//-----------------------
// MACD crossover signals
//-----------------------

PosCrossover = Cross( DayHist, 0 )
AND DayBuyBool
AND VolumeMABool
AND C > 1.0
;
NegCrossover = Cross( 0, DayHist )
AND DaySellBool
AND VolumeMABool
AND C > 1.0
;


// Plot signals
PlotShapes( IIf( HistPosDivergence , shapeSmallUpTriangle, shapeNone ),
colorYellow, 0, 0 , -12 );
PlotShapes( IIf( HistNegDivergence , shapeSmallDownTriangle, shapeNone ),
colorRed, 0, 0, -12 );



_SECTION_END();

_SECTION_BEGIN("MACD");
ml = MACD(6, 13);
dd= Signal(6,13,5);
Hist=ml-dd;
col_hist= IIf(Hist > BBandTop( Hist, 5, 0.5 ),colorLightBlue,IIf(Hist < BBandBot( Hist, 5, 0.5 ),colorBlue,colorRed));
pr=PeakBars(C,5)==0;
ps =TroughBars(C,5)==0;


PlotShapes(IIf(ps,shapeSmallUpTriangle,Null),colorCustom11,0,Min(0,0),-40);
PlotShapes(IIf(pr,shapeSmallDownTriangle,Null),colorCustom12,0,Min(0,0),-40);
Plot(ps,"",colorBrightGreen,styleHistogram|styleDashed|styleOwnScale|styleNoLa bel,0,1,0,0);
Plot(pr,"",colorRed,styleHistogram|styleDashed|styleOwnScale|styleNoLabel,0,1, 0,0);

_SECTION_BEGIN("Magnified Market Price");
FS=Param("Font Size",30,30,100,1);
GfxSelectFont("Arial", FS, 700, italic = False, underline = False, True );
GfxSetBkMode( colorGreen );
GfxSetTextColor( ParamColor("Color",colorGreen) );
Hor=Param("Horizontal Position",350,800,800,800);
Ver=Param("Vertical Position",50,27,27,27);
GfxTextOut(""+C,Hor , Ver );
YC=TimeFrameGetPrice("C",inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont("Arial", 12, 700, italic = False, underline = False, True );
GfxSetBkMode( colorGreen );
GfxSetTextColor(ParamColor("Color",colorGreen) );
GfxTextOut(""+DD+" ("+xx+"%)", Hor+5, Ver+45 );
_SECTION_END();



رد مع اقتباس
قديم 16-05-2020, 11:21 AM
  المشاركه #38

عضو هوامير المؤسس

تاريخ التسجيل: Dec 2005
المشاركات: 3,869
أبو لميس متواجد حالياً  

رد: إستراتيجيه الدخول مع المضارب


الرابط لاديعمل


رد مع اقتباس
قديم 20-05-2020, 12:58 AM
  المشاركه #39

عضو هوامير المؤسس

تاريخ التسجيل: Apr 2005
المشاركات: 165
ksa3016 غير متواجد حالياً  

رد: إستراتيجيه الدخول مع المضارب


جزاك الله خير


رد مع اقتباس
قديم 20-05-2020, 06:20 AM
  المشاركه #40

محلل المؤشر الأمريكي داو جونز

تاريخ التسجيل: Nov 2005
المشاركات: 2,777
القناااص 2005 غير متواجد حالياً  

رد: إستراتيجيه الدخول مع المضارب


اقتباس:
المشاركة الأصلية كتبت بواسطة al_badr مشاهدة المشاركة
ابشر بعزك
هذا طلبك

_section_begin("macd");
r1 = param( "fast avg", 12, 2, 200, 1 );
r2 = param( "slow avg", 26, 2, 200, 1 );
r3 = param( "signal avg", 9, 2, 200, 1 );
plot( ml = macd(r1, r2),"macd" ,4 );
plot( sl = signal(r1,r2,r3), "signal" , paramcolor("signal color", colorblue ) );
buy = ( volume > ref( volume , -3 ))
and macd() > ref( macd() ,-1 )
and open > ma(open , 7 )
and macd() < 0 ;
sell = ( open < ma( open , 7 )
and macd() < ref( macd() , -1 ));
buy= (exrem(buy, sell));
sell=(exrem(sell, buy));
filter = buy or sell;

_section_begin("authorname");
k = (getperformancecounter()/100)%100;
printf("getperformance counter %g",k);
gfxselectfont("jokerman", 14,800);
gfxsetbkmode(1);
gfxsettextcolor(colorgold);
gfxtextout("al_badr-s",-10+k,20);
requesttimedrefresh(10);
_section_end();
addtextcolumn( fullname(), "company name" );
addcolumn( buy, "buy", 1 );
addcolumn( sell, "sell", 1 );
addcolumn( c, "close", 1.3 );
addcolumn( h, "high", 1.3 );


وأي خدمة حاضرين
اللهم بلغنا تمام الصيام
اللهم بلغنا ليلة القدر

الله يبشرك بالخير ما قصرت
جزاكم الله خير
طلع لي خطوط الماكد فقط ... يعني نفس المؤشر اللي في البرنامج بس بدون الهستوقرام
هل هذي هي المعادله اللي طرحتها اخوي ؟



رد مع اقتباس
إضافة رد


الكلمات الدلالية (Tags)
مع, إستراتيجيه, المضارب, الدخول

أدوات الموضوع

تعليمات المشاركة
لا تستطيع إضافة مواضيع جديدة
لا تستطيع الرد على المواضيع
لا تستطيع إرفاق ملفات
لا تستطيع تعديل مشاركاتك

BB code is متاحة
كود [IMG] متاحة
كود HTML معطلة

الانتقال السريع



02:38 PM