النتائج 6,361 إلى 6,375 من 10285
الموضوع: موضوع مخصص للأسئلة البرمجية
- 16-03-2015, 08:30 PM #6361
تم الاختبار بنجاح
شكرا جزيلا أستاذ جميل
- 17-03-2015, 01:33 AM #6362
- 17-03-2015, 10:48 AM #6363
- 18-03-2015, 10:56 AM #6364
السلام عليكم
استاذ اسامه الداله AvTP لحساب متوسط السعر ولكن عند استخدامها تعطيني اخر صفقه واحيانا اخر صفقتين
الكود التالي هو لاكسبيرت يفتح صفقات وكل صفقه بمضاعفاتها لوحدها
اريد داله لحساب عدد الاوردرات لكل صفقه بمضاعفاتها
عند عمل باك تيست على فريم العشر دقائق يفتح الصفقات بدقه على الموفينج ولكن واجهت مشكله مع rsi فهو يفتح الصفقات صحيحه ولكن يفوت بعض الصفقات لايفتحها هل عندك تفسير لهذا .
شكرا جزيلا ويعطيك العافيه
كود://+------------------------------------------------------------------+ //| | //| | //| www.arabictrader.com/vb | //| | //| [email protected] | //+------------------------------------------------------------------+ #property copyright "MR.dollar " #property link "[email protected]" extern int MaxTrades = 1; extern bool ALLTYPE=false; extern bool BUY_SELL=false; extern bool BUY_SELL_TOGETHER=false; extern bool EnableTimeFilter = false; extern string Start_Hour ="00:00"; extern string End_Hour = "23:00"; extern string gf654="ma setting "; extern bool usema=false; input ENUM_TIMEFRAMES ma1tf=0; extern int ma1period=5; input ENUM_MA_METHOD ma1mode=0; input ENUM_TIMEFRAMES ma2tf=0; extern int ma2period=30; input ENUM_MA_METHOD ma2mode=0; extern string S694="Money Management"; extern double Lots = 0.1; extern bool MoneyManagement = false; extern double Risk=10; extern string S0="Multiplier Settings"; extern bool EnableMultiplier=false; extern bool EnableMultiplierdown=false; extern bool x_Multiplier=false; extern int Step=50; extern double Multiplier=2; extern bool UseAverageTP=false; extern int ordercount=0; extern int avarege=10; extern bool usd_profit=false; extern double ProfitTotal=100; extern double LOSSTotal=-1000; extern string M=" Multiplier Settings"; extern bool UseMultiplier1=false; extern double Multiplier1=2; extern string S5875="normal tp-sl"; extern bool HideStopLoss=false; extern int StopLoss=0; extern bool HideTakeProfit=false; extern int TakeProfit=0; extern int TrailingStop=0; extern int BreakEven=0; extern int BreakEvenPips=1; extern int MagicNumber=2055; datetime Time0,Date; datetime Timee; double point; static string LastOrder; int P; int digits,Q; int Lot_Decimal=1; int OnInit() { if(MarketInfo(Symbol(),MODE_MINLOT)<0.1)Lot_Decimal=2; else Lot_Decimal=1; if(_Digits==5||_Digits==3)P=10; else P=1; if(_Digits<4) { point=0.01; } else { point=0.0001; } return(0); } //+------------------------------------------------------------------+ //| FUNCTION DEFINITIONS deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { } int TotalOrders(int type) { int cnt=0; for(int i =0;i<OrdersTotal();i++){ if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){ if(OrderSymbol()==Symbol() && MagicNumber==OrderMagicNumber()&&OrderType()==type){ cnt++; } } } return(cnt); } //////////////////////////////////////////////// ////////////////////////////////////////////////////////////// //+------------------------------------------------------------------+ //| FUNCTION DEFINITIONS Start function | //+------------------------------------------------------------------+ bool TimeFilter(string StartH,string EndH) { datetime Start= StrToTime(TimeToStr(TimeCurrent(), TIME_DATE) + " " + StartH); datetime End= StrToTime(TimeToStr(TimeCurrent(), TIME_DATE) + " " + EndH); if(!(Time[0]>=Start && Time[0]<=End)) { return(false); } return(true); } void OnTick() { //////////////////////////////////////////////////////////////////////////////////////////////////////////// double ma1=iMA(NULL,ma1tf,ma1period,0,ma1mode,PRICE_CLOSE,1); double ma11=iMA(NULL,ma1tf,ma1period,0,ma1mode,PRICE_CLOSE,2); double ma2=iMA(NULL,ma2tf,ma2period,0,ma2mode,PRICE_CLOSE,1); double ma22=iMA(NULL,ma2tf,ma2period,0,ma2mode,PRICE_CLOSE,2); double SL,TP; int ticket; double Price,lots,NewLot; int type,step,step1,hh; if(EnableMultiplier) { for(int i=OrdersTotal()-1;i>=0;i--) { bool select=OrderSelect(i,SELECT_BY_POS,MODE_TRADES); string comment=OrderComment(); double OrderSL=OrderStopLoss(); double profit=OrderProfit(); double OrderTP=OrderTakeProfit(); int Order_ticket=OrderTicket(); double Order_Price=OrderOpenPrice(); Price=OrderOpenPrice(); lots=OrderLots(); type=OrderType(); step=Step; hh=(Order_Price*lots)/lots; string TimeOrder=StringSubstr(comment,4); if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber&&StringSubstr(comment,0,4)=="Main") { if(usd_profit&&CalculateProfit(TimeOrder)+profit>=ProfitTotal) { CloseOrders(TimeOrder); continue; } /////////////////////// if(usd_profit&&CalculateProfit(TimeOrder)+profit<=LOSSTotal) { CloseOrders(TimeOrder); continue; } ////////////////////// if(UseAverageTP&&AvTP(TimeOrder)+avarege*point<=Bid) { CloseOrders(TimeOrder); continue; } //////////////////////////////// if(LastOrderInfo("Price",TimeOrder)!=0) { Price=LastOrderInfo("Price",TimeOrder); lots=LastOrderInfo("Lots",TimeOrder); type=LastOrderInfo("Type",TimeOrder); step=Step; } ///////////////////////////////////////////////////// buy multiper //////////////////////////////////////////////////////// if(type==OP_BUY&&Price-Ask>=step*point&&EnableMultiplierdown) { if(OrderTP!=0)TP=OrderTP;else TP=0; if(OrderSL!=0)SL=OrderSL;else SL=0; if (x_Multiplier) NewLot=lots*Multiplier;else NewLot=lots+Multiplier; ticket=OrderSend(Symbol(),OP_BUY,NormalizeDouble(NewLot,Lot_Decimal),NormalizeDouble(Ask,Digits),3*P,SL,TP,TimeOrder,MagicNumber,0,Red); if(ticket<0)Print("Send Order Error "+GetLastError() +" Lots: "+NewLot+" Price: "+Ask+" SL: "+SL); } //////////////////////////////////////////////////////// sell multiper ////////////////////////////////////////////////////////////// if(type==OP_SELL&&Bid-Price>=step*point&&EnableMultiplierdown) { if(OrderTP!=0)TP=OrderTP;else TP=0; if(OrderSL!=0)SL=OrderSL;else SL=0; if (x_Multiplier) NewLot=lots*Multiplier;else NewLot=lots+Multiplier; ticket=OrderSend(Symbol(),OP_SELL,NormalizeDouble(NewLot,Lot_Decimal),NormalizeDouble(Bid,Digits),3*P,SL,TP,TimeOrder,MagicNumber,0,Blue); if(ticket<0)Print("Send Order Error "+GetLastError() +" Lots: "+NewLot+" Price: "+Ask+" SL: "+SL); } } } } /////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (EnableTimeFilter&&TimeFilter(Start_Hour,End_Hour)==false)return; if(MoneyManagement) NewLot = LotManage(); else NewLot=Lots; ////////////////buy order//////////////////////// if ((ma1>ma2&&ma11<ma22||!usema)&&Time0!=Time[0] ) ///////////////////////////////// { if((ALLTYPE&&TotalOrders(OP_BUY)+TotalOrders(OP_SELL)<MaxTrades||MaxTrades==0) ||(BUY_SELL&&(LastOrder!=1)&&TotalOrders(OP_BUY)+TotalOrders(OP_SELL)<MaxTrades||MaxTrades==0) ||(BUY_SELL_TOGETHER&&TotalOrders(OP_BUY)<MaxTrades||MaxTrades==0)) { //////////////////////////////////////////////////////////// if(StopLoss==0){SL=0;}else{SL=Ask-StopLoss*point;} if(TakeProfit==0){TP=0;}else{TP=Ask+TakeProfit*point;} if(UseMultiplier1&&!LP())NewLot=LastLot()*Multiplier1; if(NewLot<MarketInfo(Symbol(),MODE_MINLOT))NewLot=MarketInfo(Symbol(),MODE_MINLOT); ///////////////////////////////////////////////////////////// ticket=OrderSend(Symbol(),OP_BUY,NormalizeDouble(NewLot,Lot_Decimal),NormalizeDouble(Ask,Digits),3*P,SL,TP,"Main"+Time[0],MagicNumber,0,White); PlaySound("Alert.wav"); Time0=Time[0] ; LastOrder=1; } } ////////////////////////////////////sell order/////////////////////// if ((ma1<ma2&&ma11>ma22||!usema)&& Time0!=Time[0] ) ///////////////////////////////////////////////////////////////////// { if((ALLTYPE&&TotalOrders(OP_SELL)+TotalOrders(OP_BUY)<MaxTrades||MaxTrades==0) ||(BUY_SELL&&(LastOrder!=-1)&&TotalOrders(OP_BUY)+TotalOrders(OP_SELL)<MaxTrades||MaxTrades==0) ||(BUY_SELL_TOGETHER&&TotalOrders(OP_SELL)<MaxTrades||MaxTrades==0)) { ////////////////////////////////////////////////////////////////// if(StopLoss==0){SL=0;}else{SL=Bid+StopLoss*point;} if(TakeProfit==0){TP=0;}else{TP=Bid-TakeProfit*point;} if(UseMultiplier1&&!LP())NewLot=LastLot()*Multiplier1; if(NewLot<MarketInfo(Symbol(),MODE_MINLOT))NewLot=MarketInfo(Symbol(),MODE_MINLOT); //////////////////////////////////////////////////////////// ticket=OrderSend(Symbol(),OP_SELL,NormalizeDouble(NewLot,Lot_Decimal),NormalizeDouble(Bid,Digits),3*P,SL,TP,"Main"+Time[0],MagicNumber,0,White); PlaySound("Alert.wav"); Time0=Time[0] ; LastOrder=-1; } } } //+------------------------------------------------------------------+ double CalculateProfit(string comment) { double profit; for(int i=OrdersTotal()-1;i>=0;i--) { bool select=OrderSelect(i,SELECT_BY_POS,MODE_TRADES); if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber&&OrderComment()==comment) { profit+=OrderProfit(); } } return(profit); } ////////////// double AvTP(string comment){ double oPrice;double oLots; for(int i=OrdersTotal()-1;i>=0;i--){ bool select=OrderSelect(i,SELECT_BY_POS,MODE_TRADES); if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber&&OrderComment()==comment){ oPrice+=OrderOpenPrice()*OrderLots(); oLots+=OrderLots(); } } if(oLots!=0) return(oPrice/oLots); } ///////////////////////// double LastOrderInfo(string index,string comment) { for(int i=OrdersTotal()-1;i>=0;i--) { bool select=OrderSelect(i,SELECT_BY_POS,MODE_TRADES); if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber&&OrderComment()==comment) { if(index=="Type")return(OrderType()); if(index=="Lots")return(OrderLots()); if(index=="Price")return(OrderOpenPrice()); } } return(0); } //////////////////////////////////////////////// void CloseOrders(string comment) { for (int i=OrdersTotal()-1;i>=0;i--) { bool select=OrderSelect(i,SELECT_BY_POS,MODE_TRADES); int ticket=OrderTicket(); double lots=OrderLots(); int Otype=OrderType(); string OrderCom=OrderComment(); if (OrderMagicNumber() == MagicNumber && OrderSymbol()==Symbol()&&(OrderComment()==comment||StringSubstr(OrderComment(),4)==comment)) { if (Otype==OP_BUY) { bool close= OrderClose(ticket,lots,NormalizeDouble(Bid,Digits),3*P); } if (Otype==OP_SELL) { close=OrderClose(ticket,lots,NormalizeDouble(Ask,Digits),3*P); } } } } ////////////////////////////////// //////////////////////////////////////////////////////////// double LotManage() { double lot = MathCeil(AccountFreeMargin() * Risk / 1000) / 100; if(lot<MarketInfo(Symbol(),MODE_MINLOT))lot=MarketInfo(Symbol(),MODE_MINLOT); if(lot>MarketInfo(Symbol(),MODE_MAXLOT))lot=MarketInfo(Symbol(),MODE_MAXLOT); return (NormalizeDouble(lot,Lot_Decimal)); } ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////// bool LP(){ for(int i=OrdersHistoryTotal();i>0;i--){ OrderSelect(i,SELECT_BY_POS,MODE_HISTORY); if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber){ if(OrderProfit()>=0)return(true); else return(false); } } return(true); } ///////////////////////////////// double LastLot(){ double k; for(int i=0;i<OrdersHistoryTotal();i++){ OrderSelect(i,SELECT_BY_POS,MODE_HISTORY); if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber){ k=OrderLots(); } } return(k); } //////////////////////////////////////////////
- 19-03-2015, 01:50 PM #6365
- 19-03-2015, 05:59 PM #6366
السلام عليكم ورحمة الله وبركاته
ممكن من فظلكم كيفية ضبط أعدادات مؤشر تقاطع الموفينج
أريد ضبط الإعدادات على تقاطع موفينج 360 اكسبونشل مع موفينج 200 اكسبونشل
2MA CrossoverWithPrice.mq4
- 19-03-2015, 09:34 PM #6367
وعليكم السلام ورحمة الله وبركاته
في هذا الكود الداله AvTP تحسب متوسط السعر للصفقات التي لها كومنت محدد فقط وبعض الصفقات في الإكسبرت يكون لها كومنت مختلف ( طريقة عمل الإكسبرت )
بالتالي سوف تستخدم نفس طريقة دالة AvTP بأن تحسب الصفقه الرئيسيه والمضاعفات الخاصه بها لنفس مجموع الصفقات على حسب الكومنت
بالنسبه لمؤشر RSI أرفق الكود للشرط الذي قمت بعمله وسوف أوضح لك ما قد يكون السبب
- 19-03-2015, 09:48 PM #6368
- 19-03-2015, 09:56 PM #6369
- 19-03-2015, 10:36 PM #6370
- 22-03-2015, 03:10 AM #6371
- 23-03-2015, 04:02 PM #6372
السلام عليكم
إخواني هذا المؤشر المرفق به مشكلة لم أستطع حلها ، المفترض أنه عندما يحقق جسم شمعة معينة شروط معينة يضع وجه مبتسم فوقها أو تحتها ، هذا يحدث مع الفريمات الأكبر من النصف ساعة ، أما على الخمس دقائق والدقيقة فلابد أن أقوم بتغيير الفريم والعودة مرة أخرى حتى يظهر الوجه ... هل من مساعدة ؟
كود://+------------------------------------------------------------------+ //| PriceAction AHA 0.2.mq4 | //| Copyright ?2006, Hua Ai (aha) | //| | //+------------------------------------------------------------------+ #property copyright "Copyright ?2006, Hua Ai (aha)" #property link "" // Version 0.2 adds the cross timeframe alerts to v0.1. #property indicator_chart_window #property indicator_buffers 6 #property indicator_color1 Yellow #property indicator_color2 Yellow #property indicator_color3 Magenta #property indicator_color4 Magenta #property indicator_color5 Yellow #property indicator_color6 Yellow #property indicator_width1 0.5 #property indicator_width2 0.5 #property indicator_width3 1.0 #property indicator_width4 1.0 #property indicator_width5 0.5 #property indicator_width6 0.5 //---- input parameters extern bool Alerts=true; extern bool History=true; extern bool CheckPinBars=true; extern int Min_Nose_Ratio=60; extern int Max_Body_Ratio=40; extern bool CheckDoubleBarHighLows=true; extern bool CheckOutsideBars=true; extern bool CheckI4Bars=true; extern bool SearchM15=false; extern bool SearchM30=false; extern bool SearchH1=true; extern bool SearchH4=true; extern bool SearchD1=true; extern bool SearchW1=true; extern bool SearchMN1=true; //---- buffers double PPB[]; //Positive Pin Bar double NPB[]; //Negative Pin Bar double I4BTop[]; double I4BBottom[]; double BullB[]; double BearB[]; bool startup; bool upalert,downalert; int SignalLabeled, DangerLabeled; // 0: initial state; 1: up; 2: down. int highlowoffset; string timeframe; // for cross timeframe alert bool M15PBChecked, M15DBHLChecked, M15OBChecked; bool M30PBChecked, M30DBHLChecked, M30OBChecked; bool H1PBChecked, H1DBHLChecked, H1OBChecked; bool H4PBChecked, H4DBHLChecked, H4OBChecked, H4I4BChecked; bool D1PBChecked, D1DBHLChecked, D1OBChecked, D1I4BChecked; bool W1PBChecked, W1DBHLChecked, W1OBChecked, W1I4BChecked; bool MN1PBChecked, MN1DBHLChecked, MN1OBChecked, MN1I4BChecked; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,74); SetIndexBuffer(0,NPB); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,74); SetIndexBuffer(1,PPB); SetIndexEmptyValue(1,0.0); SetIndexStyle(2,DRAW_ARROW); SetIndexArrow(2,249); SetIndexBuffer(2,I4BTop); SetIndexEmptyValue(2,0.0); SetIndexStyle(3,DRAW_ARROW); SetIndexArrow(3,249); SetIndexBuffer(3,I4BBottom); SetIndexEmptyValue(3,0.0); SetIndexStyle(4,DRAW_ARROW); SetIndexArrow(4,217); SetIndexBuffer(4,BullB); SetIndexEmptyValue(4,0.0); SetIndexStyle(5,DRAW_ARROW); SetIndexArrow(5,218); SetIndexBuffer(5,BearB); SetIndexEmptyValue(5,0.0); //---- startup=true; clearmarks(PPB, NPB, I4BTop, I4BBottom, BullB, BearB); switch (Period()) { case PERIOD_MN1: timeframe="MN1"; break; case PERIOD_W1: timeframe="W1"; break; case PERIOD_D1: timeframe="D1"; break; case PERIOD_H4: timeframe="H4"; break; case PERIOD_H1: timeframe="H1"; break; case PERIOD_M30: timeframe="M30"; break; case PERIOD_M15: timeframe="M15"; break; case PERIOD_M5: timeframe="M5"; break; case PERIOD_M1: timeframe="M1"; break; default: return(0); } M15PBChecked=false; M15DBHLChecked=false; M15OBChecked=false; M30PBChecked=false; M30DBHLChecked=false; M30OBChecked=false; H1PBChecked=false; H1DBHLChecked=false; H1OBChecked=false; H4PBChecked=false; H4DBHLChecked=false; H4OBChecked=false; H4I4BChecked=false; D1PBChecked=false; D1DBHLChecked=false; D1OBChecked=false; D1I4BChecked=false; W1PBChecked=false; W1DBHLChecked=false; W1OBChecked=false; W1I4BChecked=false; MN1PBChecked=false; MN1DBHLChecked=false; MN1OBChecked=false; MN1I4BChecked=false; return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- startup=false; clearmarks(PPB, NPB, I4BTop, I4BBottom, BullB, BearB); //---- return(0); } // Determine the check time based on the chart period void CheckTime(bool& check, bool& verify, int& highlowoffset) { switch (Period()) { case PERIOD_M1: case PERIOD_M5: case PERIOD_M15: highlowoffset=0; break; case PERIOD_M30: if ((Minute()>28 && Seconds()>50) || startup) check=true; else check=false; if ((Minute()<5 && Seconds()<10) || startup) verify=true; else verify=false; highlowoffset=0; break; case PERIOD_H1: //Print("I am in H1!"); if ((Minute()>58 && Seconds()>50) || startup) check=true; else check=false; if ((Minute()<10 && Seconds()<10) || startup) verify=true; else verify=false; //Print("check=", check); highlowoffset=1; break; case PERIOD_H4: if ((MathMod(Hour(),4)==3 && Minute()>58 && Seconds()>50) || startup) check=true; else check=false; if ((MathMod(Hour(),4)==0 && Minute()<10 && Seconds()<10) || startup) verify=true; else verify=false; highlowoffset=2; break; case PERIOD_D1: if ((Hour()==23 && Minute()>58 && Seconds()>50) || startup) check=true; else check=false; if ((Hour()==0 && Minute()<10 && Seconds()<10) || startup) verify=true; else verify=false; highlowoffset=3; break; case PERIOD_W1: if ((DayOfWeek()==5 && Hour()==19 && Minute()>58 && Seconds()>50) || startup) check=true; else check=false; if ((DayOfWeek()==0 && Hour()==20 && Minute()<10 && Seconds()<10) || startup) verify=true; else verify=false; highlowoffset=4; break; case PERIOD_MN1: if ((Day()>=28 && Hour()==23 && Minute()>58 && Seconds()>50) || startup) check=true; else check=false; if ((Day()==0 && Hour()==0 && Minute()<10 && Seconds()<10) || startup) verify=true; else verify=false; highlowoffset=5; break; default: //Print("I am in default!"); check=false; verify=false; highlowoffset=0; break; } //Print("check=", check); return; } double CalRange(int bar_num, bool verify=false) { int counter, n=0; double Range, AvgRange; if (verify) n=1; AvgRange=0; for (counter=bar_num-n; counter<=bar_num+1;counter++) { AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]); } Range=AvgRange/2; return(Range); } void clearmarks(double& PPB[], double& NPB[], double& I4BTop[], double& I4BBottom[], double& BullB[], double& BearB[]) { for (int i=0; i<= Bars-1; i++) { PPB[i]=0; NPB[i]=0; I4BTop[i]=0; I4BBottom[i]=0; BullB[i]=0; BearB[i]=0; } return; } void CheckNPB(int bar_num, double& NPB[], bool& downalert, bool verify=false) { double bar_length, nose_length, body_length, eye_pos; if(CheckPinBars) { bar_length = High[bar_num]-Low[bar_num]; if (bar_length==0) bar_length=0.0001; nose_length = High[bar_num]-MathMax(Open[bar_num], Close[bar_num]); body_length = MathAbs(Open[bar_num]-Close[bar_num]); if( nose_length/bar_length > Min_Nose_Ratio/100.0 && body_length/bar_length < Max_Body_Ratio/100.0 && (High[bar_num]-High[bar_num+1]>=bar_length/3.0 || (High[bar_num]-High[bar_num+1]>=bar_length/4.0&&body_length/bar_length<0.2)) && Low[bar_num]>Low[bar_num+1]) { if(History) NPB[bar_num]=High[bar_num]+0.1*CalRange(bar_num, verify); if(Alerts && !downalert && !startup && !verify) { Alert ("PriceAction AHA on ", Symbol()," "+timeframe+": Negative Pin Bar!! "); SendMail("PriceAction AHA: Pin Bar on "+Symbol()+" "+timeframe+"!!", "PriceAction AHA: Negative Pin bar found on "+Symbol()+" "+timeframe+"!!"); //upalert=true; downalert=true; } //Print("Got a negative pin!"); } if(verify&&(!(nose_length/bar_length > Min_Nose_Ratio/100.0 && body_length/bar_length < Max_Body_Ratio/100.0 && (High[bar_num]-High[bar_num+1]>=bar_length/3.0 || (High[bar_num]-High[bar_num+1]>=bar_length/4.0&&body_length/bar_length<0.2)) && Low[bar_num]>Low[bar_num+1]) || High[bar_num]<High[bar_num-1])) NPB[bar_num]=0; if(verify) { //upalert=false; downalert=false; } } return; } void CheckPPB(int bar_num, double& PPB[], bool& upalert, bool verify=false) { double bar_length, nose_length, body_length, eye_pos; if(CheckPinBars) { bar_length = High[bar_num]-Low[bar_num]; if (bar_length==0) bar_length=0.00001; nose_length = MathMin(Open[bar_num], Close[bar_num])-Low[bar_num]; body_length = MathAbs(Open[bar_num]-Close[bar_num]); if( nose_length/bar_length > Min_Nose_Ratio/100.0 && body_length/bar_length < Max_Body_Ratio/100.0 && (Low[bar_num+1]-Low[bar_num]>=bar_length/3.0 || (Low[bar_num+1]-Low[bar_num]>=bar_length/4.0&&body_length/bar_length<0.2)) && High[bar_num]<High[bar_num+1]) { if(History) PPB[bar_num]=Low[bar_num]-0.1*CalRange(bar_num, verify); if(Alerts && !upalert && !startup && !verify) { Alert ("PriceAction AHA on ", Symbol()," "+timeframe+": Positive Pin Bar!! "); SendMail("PriceAction AHA: Pin Bar on "+Symbol()+" "+timeframe+"!!", "PriceAction AHA: Positive Pin bar found on "+Symbol()+" "+timeframe+"!!"); upalert=true; //downalert=false; } } if(verify&&(!(nose_length/bar_length > Min_Nose_Ratio/100.0 && body_length/bar_length < Max_Body_Ratio/100.0 && (Low[bar_num+1]-Low[bar_num]>=bar_length/3.0 || (Low[bar_num+1]-Low[bar_num]>=bar_length/4.0&&body_length/bar_length<0.2)) && High[bar_num]<High[bar_num+1])|| Low[bar_num]>Low[bar_num-1])) PPB[bar_num]=0; if(verify) { upalert=false; //downalert=false; } } return; } void CheckBullB(int bar_num, double& BullB[], bool& upalert, bool verify=false) { if (CheckDoubleBarHighLows) { // check DBLHC if (MathAbs(Low[bar_num]-Low[bar_num+1])<=highlowoffset*Point&&Close[bar_num]>High[bar_num+1]) { if(History) BullB[bar_num]=Low[bar_num]-0.1*CalRange(bar_num, verify); if(Alerts && !upalert && !startup && !verify) { Alert ("PriceAction AHA on ", Symbol()," "+timeframe+": DBLHC!! "); SendMail("PriceAction AHA: DBLHC on "+Symbol()+" "+timeframe+"!!", "PriceAction AHA: DBLHC found on "+Symbol()+" "+timeframe+"!!"); upalert=true; } } if(verify&&!(MathAbs(Low[bar_num]-Low[bar_num+1])<=highlowoffset*Point&&Close[bar_num]>High[bar_num+1])) BullB[bar_num]=0; if(verify) { upalert=false; } } if (CheckOutsideBars) { // check BUOB if (Low[bar_num]<Low[bar_num+1]&&Close[bar_num]>High[bar_num+1]) { if(History) BullB[bar_num]=Low[bar_num]-0.1*CalRange(bar_num, verify); if(Alerts && !upalert && !startup && !verify) { Alert ("PriceAction AHA on ", Symbol()," "+timeframe+": BUOB!! "); SendMail("PriceAction AHA: BUOB on "+Symbol()+" "+timeframe+"!!", "PriceAction AHA: BUOB found on "+Symbol()+" "+timeframe+"!!"); upalert=true; } } if(verify&&!(Low[bar_num]<Low[bar_num+1]&&Close[bar_num]>High[bar_num+1])) BullB[bar_num]=0; if(verify) { upalert=false; } } return; } void CheckBearB(int bar_num, double& BearB[], bool& downalert, bool verify=false) { if (CheckDoubleBarHighLows) { // check DBHLC if (MathAbs(High[bar_num]-High[bar_num+1])<=highlowoffset*Point&&Close[bar_num]<Low[bar_num+1]) { if(History) BearB[bar_num]=High[bar_num]+0.1*CalRange(bar_num, verify); if(Alerts && !downalert && !startup && !verify) { Alert ("PriceAction AHA on ", Symbol()," "+timeframe+": DBHLC!! "); SendMail("PriceAction AHA: DBHLC on "+Symbol()+" "+timeframe+"!!", "PriceAction AHA: DBHLC found on "+Symbol()+" "+timeframe+"!!"); downalert=true; } } if(verify&&!(MathAbs(High[bar_num]-High[bar_num+1])<=highlowoffset*Point&&Close[bar_num]<Low[bar_num+1])) BearB[bar_num]=0; if(verify) { downalert=false; } } if (CheckOutsideBars) { // check BEOB if (Close[bar_num]<Low[bar_num+1]&&High[bar_num]>High[bar_num+1]) { if(History) BearB[bar_num]=High[bar_num]+0.1*CalRange(bar_num, verify); if(Alerts && !downalert && !startup && !verify) { Alert ("PriceAction AHA on ", Symbol()," "+timeframe+": BEOB!! "); SendMail("PriceAction AHA: BEOB on "+Symbol()+" "+timeframe+"!!", "PriceAction AHA: BEOB found on "+Symbol()+" "+timeframe+"!!"); downalert=true; } } if(verify&&!(Close[bar_num]<Low[bar_num+1]&&High[bar_num]>High[bar_num+1])) BearB[bar_num]=0; if(verify) { downalert=false; } } return; } void CheckI4B(int bar_num, double& I4BTop[], double& I4BBottom[], bool verify=false) { int dayintheweek=TimeDayOfWeek(iTime(NULL, 0, bar_num)); int bar_0, bar_1, bar_2, bar_3; double bar_length_0, bar_length_1, bar_length_2, bar_length_3; if(CheckI4Bars) { if (Period()==PERIOD_D1) { switch(dayintheweek) { case 4: case 5: bar_0 = bar_num; bar_1 = bar_num+1; bar_2 = bar_num+2; bar_3 = bar_num+3; break; case 3: bar_0 = bar_num; bar_1 = bar_num+1; bar_2 = bar_num+2; bar_3 = bar_num+4; break; case 2: bar_0 = bar_num; bar_1 = bar_num+1; bar_2 = bar_num+3; bar_3 = bar_num+4; break; case 1: bar_0 = bar_num; bar_1 = bar_num+2; bar_2 = bar_num+3; bar_3 = bar_num+4; break; default: bar_0 = bar_num; bar_1 = bar_num; bar_2 = bar_num; bar_3 = bar_num; break; } } else { bar_0 = bar_num; bar_1 = bar_num+1; bar_2 = bar_num+2; bar_3 = bar_num+3; } bar_length_0 = High[bar_0]-Low[bar_0]; bar_length_1 = High[bar_1]-Low[bar_1]; bar_length_2 = High[bar_2]-Low[bar_2]; bar_length_3 = High[bar_3]-Low[bar_3]; if( bar_length_0<bar_length_1 && bar_length_0<bar_length_2 && bar_length_0<bar_length_3 && High[bar_0]<High[bar_1] && Low[bar_0]>Low[bar_1] && (Period()==PERIOD_D1||Period()==PERIOD_H4)) { I4BTop[bar_num]=High[bar_num]+0.1*CalRange(bar_num, verify); I4BBottom[bar_num]=Low[bar_num]-0.1*CalRange(bar_num, verify); //Print("Got a I4B bar!"); //Print("dayintheweek=", dayintheweek); } } return; } void CheckM15(bool& M15PBChecked, bool& M15DBHLChecked, bool& M15OBChecked) { if(Period()==PERIOD_M15) return; if(MathMod(Minute(),15)<2) {M15PBChecked=false; M15DBHLChecked=false; M15OBChecked=false; return;} if(MathMod(Minute(),15)>=2&&MathMod(Minute(),15)<13) return; int tf=PERIOD_M15; string checkingtimeframe="M15"; double high0=iHigh(NULL,tf,0); double high1=iHigh(NULL,tf,1); double low0=iLow(NULL,tf,0); double low1=iLow(NULL,tf,1); double open0=iOpen(NULL,tf,0); double open1=iOpen(NULL,tf,1); double close0=iClose(NULL,tf,0); double close1=iClose(NULL,tf,1); double bar_length, body_length, nose_length; if(CheckPinBars&&!M15PBChecked) { bar_length = high0-low0; if (bar_length==0) bar_length=0.0001; body_length = MathAbs(open0-close0); double nose1, nose2; nose1=high0-MathMax(open0, close0); nose2=MathMin(open0, close0)-low0; if (nose1>=nose2) { nose_length=nose1; if( nose_length/bar_length > Min_Nose_Ratio/100.0 && body_length/bar_length < Max_Body_Ratio/100.0 && (high0-high1>=bar_length/3.0||(high0-high1>=bar_length/4.0&&body_length/bar_length<0.2))&& low0>low1 ) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": Negative Pin Bar!! "); SendMail("PriceAction AHA: Pin Bar on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: Negative Pin bar found on "+Symbol()+" "+checkingtimeframe+"!!"); } //Print("Got a negative pin!"); M15PBChecked=true; } } else if (nose1<=nose2) { nose_length=nose2; if( nose_length/bar_length > Min_Nose_Ratio/100.0 && body_length/bar_length < Max_Body_Ratio/100.0 && (low1-low0>=bar_length/3.0||(low1-low0>=bar_length/4.0&&body_length/bar_length<0.2))&& high0<high1 ) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": Positive Pin Bar!! "); SendMail("PriceAction AHA: Pin Bar on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: Positive Pin bar found on "+Symbol()+" "+checkingtimeframe+"!!"); } //Print("Got a negative pin!"); M15PBChecked=true; } } } if (CheckDoubleBarHighLows&&!M15DBHLChecked) { if (MathAbs(low0-low1)<=0&&close0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": DBLHC!! "); SendMail("PriceAction AHA: DBLHC on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: DBLHC found on "+Symbol()+" "+checkingtimeframe+"!!"); } M15DBHLChecked=true; } else if (MathAbs(high0-high1)<=0&&close0<low1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": DBHLC!! "); SendMail("PriceAction AHA: DBHLC on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: DBHLC found on "+Symbol()+" "+checkingtimeframe+"!!"); } M15DBHLChecked=true; } } if (CheckOutsideBars&&!M15OBChecked) { if (low0<low1&&close0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": BUOB!! "); SendMail("PriceAction AHA: BUOB on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: BUOB found on "+Symbol()+" "+checkingtimeframe+"!!"); } M15OBChecked=true; } else if (close0<low1&&high0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": BEOB!! "); SendMail("PriceAction AHA: BEOB on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: BEOB found on "+Symbol()+" "+checkingtimeframe+"!!"); } M15OBChecked=true; } } return; } void CheckM30(bool& M30PBChecked, bool& M30DBHLChecked, bool& M30OBChecked) { if(Period()==PERIOD_M30) return; if(MathMod(Minute(),30)<2) {M30PBChecked=false; M30DBHLChecked=false; M30OBChecked=false; return;} if(MathMod(Minute(),30)>=2&&MathMod(Minute(),30)<28) return; int tf=PERIOD_M30; string checkingtimeframe="M30"; double high0=iHigh(NULL,tf,0); double high1=iHigh(NULL,tf,1); double low0=iLow(NULL,tf,0); double low1=iLow(NULL,tf,1); double open0=iOpen(NULL,tf,0); double open1=iOpen(NULL,tf,1); double close0=iClose(NULL,tf,0); double close1=iClose(NULL,tf,1); double bar_length, body_length, nose_length; if(CheckPinBars&&!M30PBChecked) { bar_length = high0-low0; if (bar_length==0) bar_length=0.0001; body_length = MathAbs(open0-close0); double nose1, nose2; nose1=high0-MathMax(open0, close0); nose2=MathMin(open0, close0)-low0; if (nose1>=nose2) { nose_length=nose1; if( nose_length/bar_length > Min_Nose_Ratio/100.0 && body_length/bar_length < Max_Body_Ratio/100.0 && (high0-high1>=bar_length/3.0||(high0-high1>=bar_length/4.0&&body_length/bar_length<0.2))&& low0>low1 ) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": Negative Pin Bar!! "); SendMail("PriceAction AHA: Pin Bar on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: Negative Pin bar found on "+Symbol()+" "+checkingtimeframe+"!!"); } //Print("Got a negative pin!"); M30PBChecked=true; } } else if (nose1<=nose2) { nose_length=nose2; if( nose_length/bar_length > Min_Nose_Ratio/100.0 && body_length/bar_length < Max_Body_Ratio/100.0 && (low1-low0>=bar_length/3.0||(low1-low0>=bar_length/4.0&&body_length/bar_length<0.2))&& high0<high1 ) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": Positive Pin Bar!! "); SendMail("PriceAction AHA: Pin Bar on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: Positive Pin bar found on "+Symbol()+" "+checkingtimeframe+"!!"); } //Print("Got a negative pin!"); M30PBChecked=true; } } } if (CheckDoubleBarHighLows&&!M30DBHLChecked) { if (MathAbs(low0-low1)<=0&&close0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": DBLHC!! "); SendMail("PriceAction AHA: DBLHC on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: DBLHC found on "+Symbol()+" "+checkingtimeframe+"!!"); } M30DBHLChecked=true; } else if (MathAbs(high0-high1)<=0&&close0<low1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": DBHLC!! "); SendMail("PriceAction AHA: DBHLC on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: DBHLC found on "+Symbol()+" "+checkingtimeframe+"!!"); } M30DBHLChecked=true; } } if (CheckOutsideBars&&!M30OBChecked) { if (low0<low1&&close0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": BUOB!! "); SendMail("PriceAction AHA: BUOB on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: BUOB found on "+Symbol()+" "+checkingtimeframe+"!!"); } M30OBChecked=true; } else if (close0<low1&&high0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": BEOB!! "); SendMail("PriceAction AHA: BEOB on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: BEOB found on "+Symbol()+" "+checkingtimeframe+"!!"); } M30OBChecked=true; } } return; } void CheckH1(bool& H1PBChecked, bool& H1DBHLChecked, bool& H1OBChecked) { if(Period()==PERIOD_H1) return; if(Minute()<2) {H1PBChecked=false; H1DBHLChecked=false; H1OBChecked=false; return;} if(Minute()>=2&&Minute()<55) return; int tf=PERIOD_H1; string checkingtimeframe="H1"; double high0=iHigh(NULL,tf,0); double high1=iHigh(NULL,tf,1); double low0=iLow(NULL,tf,0); double low1=iLow(NULL,tf,1); double open0=iOpen(NULL,tf,0); double open1=iOpen(NULL,tf,1); double close0=iClose(NULL,tf,0); double close1=iClose(NULL,tf,1); double bar_length, body_length, nose_length; if(CheckPinBars&&!H1PBChecked) { bar_length = high0-low0; if (bar_length==0) bar_length=0.0001; body_length = MathAbs(open0-close0); double nose1, nose2; nose1=high0-MathMax(open0, close0); nose2=MathMin(open0, close0)-low0; if (nose1>=nose2) { nose_length=nose1; if( nose_length/bar_length > Min_Nose_Ratio/100.0 && body_length/bar_length < Max_Body_Ratio/100.0 && (high0-high1>=bar_length/3.0||(high0-high1>=bar_length/4.0&&body_length/bar_length<0.2))&& low0>low1 ) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": Negative Pin Bar!! "); SendMail("PriceAction AHA: Pin Bar on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: Negative Pin bar found on "+Symbol()+" "+checkingtimeframe+"!!"); } //Print("Got a negative pin!"); H1PBChecked=true; } } else if (nose1<=nose2) { nose_length=nose2; if( nose_length/bar_length > Min_Nose_Ratio/100.0 && body_length/bar_length < Max_Body_Ratio/100.0 && (low1-low0>=bar_length/3.0||(low1-low0>=bar_length/4.0&&body_length/bar_length<0.2))&& high0<high1 ) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": Positive Pin Bar!! "); SendMail("PriceAction AHA: Pin Bar on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: Positive Pin bar found on "+Symbol()+" "+checkingtimeframe+"!!"); } //Print("Got a negative pin!"); H1PBChecked=true; } } } if (CheckDoubleBarHighLows&&!H1DBHLChecked) { if (MathAbs(low0-low1)<=0&&close0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": DBLHC!! "); SendMail("PriceAction AHA: DBLHC on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: DBLHC found on "+Symbol()+" "+checkingtimeframe+"!!"); } H1DBHLChecked=true; } else if (MathAbs(high0-high1)<=0&&close0<low1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": DBHLC!! "); SendMail("PriceAction AHA: DBHLC on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: DBHLC found on "+Symbol()+" "+checkingtimeframe+"!!"); } H1DBHLChecked=true; } } if (CheckOutsideBars&&!H1OBChecked) { if (low0<low1&&close0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": BUOB!! "); SendMail("PriceAction AHA: BUOB on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: BUOB found on "+Symbol()+" "+checkingtimeframe+"!!"); } H1OBChecked=true; } else if (close0<low1&&high0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": BEOB!! "); SendMail("PriceAction AHA: BEOB on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: BEOB found on "+Symbol()+" "+checkingtimeframe+"!!"); } H1OBChecked=true; } } return; } void CheckH4(bool& H4PBChecked, bool& H4DBHLChecked, bool& H4OBChecked, bool& H4I4BChecked) { if(Period()==PERIOD_H4) return; if(MathMod(Hour(),4)==0&&Minute()<2) {H4PBChecked=false; H4DBHLChecked=false; H4OBChecked=false; H4I4BChecked=false; return;} if(MathMod(Hour(),4)<3||(MathMod(Hour(),4)==3&&Minute()<50)) return; int tf=PERIOD_H4; string checkingtimeframe="H4"; double high0=iHigh(NULL,tf,0); double high1=iHigh(NULL,tf,1); double low0=iLow(NULL,tf,0); double low1=iLow(NULL,tf,1); double open0=iOpen(NULL,tf,0); double open1=iOpen(NULL,tf,1); double close0=iClose(NULL,tf,0); double close1=iClose(NULL,tf,1); double bar_length, body_length, nose_length; if(CheckPinBars&&!H4PBChecked) { bar_length = high0-low0; if (bar_length==0) bar_length=0.0001; body_length = MathAbs(open0-close0); double nose1, nose2; nose1=high0-MathMax(open0, close0); nose2=MathMin(open0, close0)-low0; if (nose1>=nose2) { nose_length=nose1; if( nose_length/bar_length > Min_Nose_Ratio/100.0 && body_length/bar_length < Max_Body_Ratio/100.0 && (high0-high1>=bar_length/3.0||(high0-high1>=bar_length/4.0&&body_length/bar_length<0.2))&& low0>low1 ) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": Negative Pin Bar!! "); SendMail("PriceAction AHA: Pin Bar on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: Negative Pin bar found on "+Symbol()+" "+checkingtimeframe+"!!"); } //Print("Got a negative pin!"); H4PBChecked=true; } } else if (nose1<=nose2) { nose_length=nose2; if( nose_length/bar_length > Min_Nose_Ratio/100.0 && body_length/bar_length < Max_Body_Ratio/100.0 && (low1-low0>=bar_length/3.0||(low1-low0>=bar_length/4.0&&body_length/bar_length<0.2))&& high0<high1 ) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": Positive Pin Bar!! "); SendMail("PriceAction AHA: Pin Bar on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: Positive Pin bar found on "+Symbol()+" "+checkingtimeframe+"!!"); } //Print("Got a negative pin!"); H4PBChecked=true; } } } if (CheckDoubleBarHighLows&&!H4DBHLChecked) { if (MathAbs(low0-low1)<=0&&close0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": DBLHC!! "); SendMail("PriceAction AHA: DBLHC on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: DBLHC found on "+Symbol()+" "+checkingtimeframe+"!!"); } H4DBHLChecked=true; } else if (MathAbs(high0-high1)<=0&&close0<low1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": DBHLC!! "); SendMail("PriceAction AHA: DBHLC on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: DBHLC found on "+Symbol()+" "+checkingtimeframe+"!!"); } H4DBHLChecked=true; } } if (CheckOutsideBars&&!H4OBChecked) { if (low0<low1&&close0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": BUOB!! "); SendMail("PriceAction AHA: BUOB on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: BUOB found on "+Symbol()+" "+checkingtimeframe+"!!"); } H4OBChecked=true; } else if (close0<low1&&high0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": BEOB!! "); SendMail("PriceAction AHA: BEOB on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: BEOB found on "+Symbol()+" "+checkingtimeframe+"!!"); } H4OBChecked=true; } } if(CheckI4Bars&&!H4I4BChecked) { double bar_length_0 = high0-low0; double bar_length_1 = high1-low1; double bar_length_2 = iHigh(NULL,tf,2)-iLow(NULL,tf,2); double bar_length_3 = iHigh(NULL,tf,3)-iLow(NULL,tf,3); if( bar_length_0<bar_length_1 && bar_length_0<bar_length_2 && bar_length_0<bar_length_3 && high0<high1 && low0>low1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": I4B!! "); SendMail("PriceAction AHA: I4B on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: I4B found on "+Symbol()+" "+checkingtimeframe+"!!"); } H4I4BChecked=true; } } return; } void CheckD1(bool& D1PBChecked, bool& D1DBHLChecked, bool& D1OBChecked, bool& D1I4BChecked) { if(Period()==PERIOD_D1) return; int tf=PERIOD_D1; string checkingtimeframe="D1"; int dayintheweek=TimeDayOfWeek(iTime(NULL, tf, 0)); if(dayintheweek==0||(Hour()==0&&Minute()<10)) {D1PBChecked=false; D1DBHLChecked=false; D1OBChecked=false; D1I4BChecked=false; return;} if(dayintheweek!=5&&(Hour()<23||(Hour()==23&&Minute()<50))|| dayintheweek==5&&(Hour()<19||(Hour()==19&&Minute()<50))) return; int bar_0, bar_1, bar_2, bar_3; double bar_length_0, bar_length_1, bar_length_2, bar_length_3; switch(dayintheweek) { case 4: case 5: bar_0 = 0; bar_1 = 1; bar_2 = 2; bar_3 = 3; break; case 3: bar_0 = 0; bar_1 = 1; bar_2 = 2; bar_3 = 4; break; case 2: bar_0 = 0; bar_1 = 1; bar_2 = 3; bar_3 = 4; break; case 1: bar_0 = 0; bar_1 = 2; bar_2 = 3; bar_3 = 4; break; default: return; } double high0=iHigh(NULL,tf,bar_0); double high1=iHigh(NULL,tf,bar_1); double low0=iLow(NULL,tf,bar_0); double low1=iLow(NULL,tf,bar_1); double open0=iOpen(NULL,tf,bar_0); double open1=iOpen(NULL,tf,bar_1); double close0=iClose(NULL,tf,bar_0); double close1=iClose(NULL,tf,bar_1); double bar_length, body_length, nose_length; if(CheckPinBars&&!D1PBChecked) { bar_length = high0-low0; if (bar_length==0) bar_length=0.0001; body_length = MathAbs(open0-close0); double nose1, nose2; nose1=high0-MathMax(open0, close0); nose2=MathMin(open0, close0)-low0; if (nose1>=nose2) { nose_length=nose1; if( nose_length/bar_length > Min_Nose_Ratio/100.0 && body_length/bar_length < Max_Body_Ratio/100.0 && (high0-high1>=bar_length/3.0||(high0-high1>=bar_length/4.0&&body_length/bar_length<0.2))&& low0>low1 ) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": Negative Pin Bar!! "); SendMail("PriceAction AHA: Pin Bar on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: Negative Pin bar found on "+Symbol()+" "+checkingtimeframe+"!!"); } //Print("Got a negative pin!"); D1PBChecked=true; } } else if (nose1<=nose2) { nose_length=nose2; if( nose_length/bar_length > Min_Nose_Ratio/100.0 && body_length/bar_length < Max_Body_Ratio/100.0 && (low1-low0>=bar_length/3.0||(low1-low0>=bar_length/4.0&&body_length/bar_length<0.2))&& high0<high1 ) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": Positive Pin Bar!! "); SendMail("PriceAction AHA: Pin Bar on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: Positive Pin bar found on "+Symbol()+" "+checkingtimeframe+"!!"); } //Print("Got a negative pin!"); D1PBChecked=true; } } } if (CheckDoubleBarHighLows&&!D1DBHLChecked) { if (MathAbs(low0-low1)<=0&&close0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": DBLHC!! "); SendMail("PriceAction AHA: DBLHC on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: DBLHC found on "+Symbol()+" "+checkingtimeframe+"!!"); } D1DBHLChecked=true; } else if (MathAbs(high0-high1)<=0&&close0<low1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": DBHLC!! "); SendMail("PriceAction AHA: DBHLC on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: DBHLC found on "+Symbol()+" "+checkingtimeframe+"!!"); } D1DBHLChecked=true; } } if (CheckOutsideBars&&!D1OBChecked) { if (low0<low1&&close0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": BUOB!! "); SendMail("PriceAction AHA: BUOB on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: BUOB found on "+Symbol()+" "+checkingtimeframe+"!!"); } D1OBChecked=true; } else if (close0<low1&&high0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": BEOB!! "); SendMail("PriceAction AHA: BEOB on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: BEOB found on "+Symbol()+" "+checkingtimeframe+"!!"); } D1OBChecked=true; } } if(CheckI4Bars&&!D1I4BChecked) { bar_length_0 = high0-low0; bar_length_1 = high1-low1; bar_length_2 = iHigh(NULL,tf,bar_2)-iLow(NULL,tf,bar_2); bar_length_3 = iHigh(NULL,tf,bar_3)-iLow(NULL,tf,bar_3); if( bar_length_0<bar_length_1 && bar_length_0<bar_length_2 && bar_length_0<bar_length_3 && high0<high1 && low0>low1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": I4B!! "); SendMail("PriceAction AHA: I4B on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: I4B found on "+Symbol()+" "+checkingtimeframe+"!!"); } D1I4BChecked=true; } } return; } void CheckW1(bool& W1PBChecked, bool& W1DBHLChecked, bool& W1OBChecked, bool& W1I4BChecked) { if(Period()==PERIOD_W1) return; int tf=PERIOD_W1; string checkingtimeframe="W1"; int dayintheweek=TimeDayOfWeek(iTime(NULL, PERIOD_D1, 0)); if(dayintheweek==0&&Hour()<=23&&Minute()<2) {W1PBChecked=false; W1DBHLChecked=false; W1OBChecked=false; W1I4BChecked=false; return;} if(!(dayintheweek==5&&Hour()==19&&Minute()<50)) return; double high0=iHigh(NULL,tf,0); double high1=iHigh(NULL,tf,1); double low0=iLow(NULL,tf,0); double low1=iLow(NULL,tf,1); double open0=iOpen(NULL,tf,0); double open1=iOpen(NULL,tf,1); double close0=iClose(NULL,tf,0); double close1=iClose(NULL,tf,1); double bar_length, body_length, nose_length; if(CheckPinBars&&!W1PBChecked) { bar_length = high0-low0; if (bar_length==0) bar_length=0.0001; body_length = MathAbs(open0-close0); double nose1, nose2; nose1=high0-MathMax(open0, close0); nose2=MathMin(open0, close0)-low0; if (nose1>=nose2) { nose_length=nose1; if( nose_length/bar_length > Min_Nose_Ratio/100.0 && body_length/bar_length < Max_Body_Ratio/100.0 && (high0-high1>=bar_length/3.0||(high0-high1>=bar_length/4.0&&body_length/bar_length<0.2))&& low0>low1 ) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": Negative Pin Bar!! "); SendMail("PriceAction AHA: Pin Bar on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: Negative Pin bar found on "+Symbol()+" "+checkingtimeframe+"!!"); } //Print("Got a negative pin!"); W1PBChecked=true; } } else if (nose1<=nose2) { nose_length=nose2; if( nose_length/bar_length > Min_Nose_Ratio/100.0 && body_length/bar_length < Max_Body_Ratio/100.0 && (low1-low0>=bar_length/3.0||(low1-low0>=bar_length/4.0&&body_length/bar_length<0.2))&& high0<high1 ) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": Positive Pin Bar!! "); SendMail("PriceAction AHA: Pin Bar on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: Positive Pin bar found on "+Symbol()+" "+checkingtimeframe+"!!"); } //Print("Got a negative pin!"); W1PBChecked=true; } } } if (CheckDoubleBarHighLows&&!W1DBHLChecked) { if (MathAbs(low0-low1)<=0&&close0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": DBLHC!! "); SendMail("PriceAction AHA: DBLHC on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: DBLHC found on "+Symbol()+" "+checkingtimeframe+"!!"); } W1DBHLChecked=true; } else if (MathAbs(high0-high1)<=0&&close0<low1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": DBHLC!! "); SendMail("PriceAction AHA: DBHLC on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: DBHLC found on "+Symbol()+" "+checkingtimeframe+"!!"); } W1DBHLChecked=true; } } if (CheckOutsideBars&&!W1OBChecked) { if (low0<low1&&close0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": BUOB!! "); SendMail("PriceAction AHA: BUOB on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: BUOB found on "+Symbol()+" "+checkingtimeframe+"!!"); } W1OBChecked=true; } else if (close0<low1&&high0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": BEOB!! "); SendMail("PriceAction AHA: BEOB on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: BEOB found on "+Symbol()+" "+checkingtimeframe+"!!"); } W1OBChecked=true; } } if(CheckI4Bars&&!W1I4BChecked) { double bar_length_0 = high0-low0; double bar_length_1 = high1-low1; double bar_length_2 = iHigh(NULL,tf,2)-iLow(NULL,tf,2); double bar_length_3 = iHigh(NULL,tf,3)-iLow(NULL,tf,3); if( bar_length_0<bar_length_1 && bar_length_0<bar_length_2 && bar_length_0<bar_length_3 && high0<high1 && low0>low1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": I4B!! "); SendMail("PriceAction AHA: I4B on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: I4B found on "+Symbol()+" "+checkingtimeframe+"!!"); } W1I4BChecked=true; } } return; } void CheckMN1(bool& MN1PBChecked, bool& MN1DBHLChecked, bool& MN1OBChecked, bool& MN1I4BChecked) { if(Period()==PERIOD_MN1) return; int tf=PERIOD_MN1; string checkingtimeframe="MN1"; int dayinthemonth=TimeDay(iTime(NULL, PERIOD_D1, 0)); if((dayinthemonth==0||dayinthemonth>=28)&&Hour()==0&&Minute()<2) {MN1PBChecked=false; MN1DBHLChecked=false; MN1OBChecked=false; MN1I4BChecked=false; return;} if(!(dayinthemonth>=28&&Hour()==23&& Minute()>50)) return; double high0=iHigh(NULL,tf,0); double high1=iHigh(NULL,tf,1); double low0=iLow(NULL,tf,0); double low1=iLow(NULL,tf,1); double open0=iOpen(NULL,tf,0); double open1=iOpen(NULL,tf,1); double close0=iClose(NULL,tf,0); double close1=iClose(NULL,tf,1); double bar_length, body_length, nose_length; if(CheckPinBars&&!MN1PBChecked) { bar_length = high0-low0; if (bar_length==0) bar_length=0.0001; body_length = MathAbs(open0-close0); double nose1, nose2; nose1=high0-MathMax(open0, close0); nose2=MathMin(open0, close0)-low0; if (nose1>=nose2) { nose_length=nose1; if( nose_length/bar_length > Min_Nose_Ratio/100.0 && body_length/bar_length < Max_Body_Ratio/100.0 && (high0-high1>=bar_length/3.0||(high0-high1>=bar_length/4.0&&body_length/bar_length<0.2))&& low0>low1 ) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": Negative Pin Bar!! "); SendMail("PriceAction AHA: Pin Bar on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: Negative Pin bar found on "+Symbol()+" "+checkingtimeframe+"!!"); } //Print("Got a negative pin!"); MN1PBChecked=true; } } else if (nose1<=nose2) { nose_length=nose2; if( nose_length/bar_length > Min_Nose_Ratio/100.0 && body_length/bar_length < Max_Body_Ratio/100.0 && (low1-low0>=bar_length/3.0||(low1-low0>=bar_length/4.0&&body_length/bar_length<0.2))&& high0<high1 ) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": Positive Pin Bar!! "); SendMail("PriceAction AHA: Pin Bar on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: Positive Pin bar found on "+Symbol()+" "+checkingtimeframe+"!!"); } //Print("Got a negative pin!"); MN1PBChecked=true; } } } if (CheckDoubleBarHighLows&&!MN1DBHLChecked) { if (MathAbs(low0-low1)<=0&&close0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": DBLHC!! "); SendMail("PriceAction AHA: DBLHC on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: DBLHC found on "+Symbol()+" "+checkingtimeframe+"!!"); } MN1DBHLChecked=true; } else if (MathAbs(high0-high1)<=0&&close0<low1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": DBHLC!! "); SendMail("PriceAction AHA: DBHLC on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: DBHLC found on "+Symbol()+" "+checkingtimeframe+"!!"); } MN1DBHLChecked=true; } } if (CheckOutsideBars&&!MN1OBChecked) { if (low0<low1&&close0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": BUOB!! "); SendMail("PriceAction AHA: BUOB on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: BUOB found on "+Symbol()+" "+checkingtimeframe+"!!"); } MN1OBChecked=true; } else if (close0<low1&&high0>high1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": BEOB!! "); SendMail("PriceAction AHA: BEOB on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: BEOB found on "+Symbol()+" "+checkingtimeframe+"!!"); } MN1OBChecked=true; } } if(CheckI4Bars&&!MN1I4BChecked) { double bar_length_0 = high0-low0; double bar_length_1 = high1-low1; double bar_length_2 = iHigh(NULL,tf,2)-iLow(NULL,tf,2); double bar_length_3 = iHigh(NULL,tf,3)-iLow(NULL,tf,3); if( bar_length_0<bar_length_1 && bar_length_0<bar_length_2 && bar_length_0<bar_length_3 && high0<high1 && low0>low1) { if(Alerts) { Alert ("PriceAction AHA on ", Symbol()," "+checkingtimeframe+": I4B!! "); SendMail("PriceAction AHA: I4B on "+Symbol()+" "+checkingtimeframe+"!!", "PriceAction AHA: I4B found on "+Symbol()+" "+checkingtimeframe+"!!"); } MN1I4BChecked=true; } } return; } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //---- int i; bool timetocheck=false; bool timetoverify=false; //Print("dayintheweek=", DayOfWeek()); CheckTime(timetocheck, timetoverify, highlowoffset); if (startup&&History) { //Print("I am in startup!"); for(i=Bars-1; i>=1; i--) { CheckPPB(i, PPB, upalert, true); CheckNPB(i, NPB, downalert, true); CheckI4B(i, I4BTop, I4BBottom, true); CheckBullB(i, BullB, upalert, true); CheckBearB(i, BearB, downalert, true); } } if (timetocheck) { CheckPPB(0, PPB, upalert); CheckNPB(0, NPB, downalert); CheckI4B(0, I4BTop, I4BBottom); CheckBullB(0, BullB, upalert); CheckBearB(0, BearB, downalert); } if (timetoverify) { CheckPPB(1, PPB, upalert, true); CheckNPB(1, NPB, downalert, true); CheckI4B(1, I4BTop, I4BBottom, true); CheckBullB(1, BullB, upalert, true); CheckBearB(1, BearB, downalert,true); } if(SearchM15) CheckM15(M15PBChecked, M15DBHLChecked, M30OBChecked); if(SearchM30) CheckM30(M30PBChecked, M30DBHLChecked, M30OBChecked); if(SearchH1) CheckH1(H1PBChecked, H1DBHLChecked, H1OBChecked); if(SearchH4) CheckH4(H4PBChecked, H4DBHLChecked, H4OBChecked, H4I4BChecked); if(SearchD1) CheckD1(D1PBChecked, D1DBHLChecked, D1OBChecked, D1I4BChecked); if(SearchW1) CheckW1(W1PBChecked, W1DBHLChecked, W1OBChecked, W1I4BChecked); if(SearchMN1) CheckMN1(MN1PBChecked, MN1DBHLChecked, MN1OBChecked, MN1I4BChecked); startup=false; //---- return(0); } //+------------------------------------------------------------------+
- 23-03-2015, 11:46 PM #6373
- 24-03-2015, 05:35 AM #6374
اريد كتابة هذا الشرط من استاذى الكريم جميل او من مشرفنا الغالى اسامه
الشرط كالتالى
انا اشتغل بأكسبيرت اوامر معلقة
اريد ان اضع حد اقصى لوضع الاوامر المعلقة اذا وصل اليها يتوقف لحين تحرك السعر عدد من النقاط سواء للاعلى او للاسفل ( وطبعا عدد النقاط هذه هتكون فى متغير خارجى ) ...
سوف اوضح الطلب اكثر ...
انا عندى متغيريين اسمهما
MaxLot
Step
اريد ان اقول للاكسبيرت اذا وصل عدد الاوامر المعلقة كلها سواء بيع او شراء مثلا 20 امر معلقة يتوقف الاكسبيرت عن وضع اوامر جديده لحين تحرك السعر عدد نقاط مثلا وليكن 50 نقطة سواء للالى او للاسفل
بعدها يعود فى اعادة وضع الاوامر المعلقة عادى جدا بناء على الشروط الموجودة فى الاكسبيرت
أرجوا ان تكون وصلت فكرة طلبى
وجزاكم الله تعالى خيرا مقدما اخوانا المبرمجيين
- 24-03-2015, 02:19 PM #6375
توضيح بسيط
انا اقصد MaxPendings ولا اقصد MaxLot
يعنى وضع حد اقصى للاوامر المعلقة كعدد فقط ولا اقصد كمية اللوتات المفتوحة
ويكون افضل لو يعنى حسب النوع سواء بيع او شراء
يعنى يكون هناك متغيريين خارجيين
Max_Buy_Pendings
و
Max_Sell_Pendings
أرجوا ان تكون فكرتى وصلت
واسف لو بتعبك معى اخى جميل
وجزاك الله تعالى مقدما
المواضيع المتشابهه
-
موضوع مخصص للاكسبيرتات اللتي يستخدمها الاعضاء على الحقيقي,,عندك اكسبيرت ممتاز ضعه هنا
By محمد معمو in forum برمجة المؤشرات واكسبرتات التداول - Experts Advisor EAمشاركات: 11آخر مشاركة: 15-12-2023, 02:03 PM -
عااااااااااااجل ( موضوع مخصص للفرص الفورية)!!!
By عاشق الذبذبـة in forum توقعات وتوصيات سوق العملاتمشاركات: 280آخر مشاركة: 27-08-2009, 10:30 PM