تحية للجميع،



حتى يمكن لأي شخص من فضلك قل لي أي جزء أحتاج لتعديل؟

شكر

Inserted Code #import stdlib.ex4 string ErrorDescription (int e)؛ #import #include lt؛ stdlib.mqhgt؛ #include lt؛ WinUser32.mqhgt؛/- الطلبات المراد فتحها #define PendingOrders 1/عدد الأوامر المعلقة التي ستتم إضافتها/- إدارة الأموال # تعريف MoneyManagement 1/استخدم إدارة المال #define LotSize 0.1إذا لم يكن الأمر كذلك ، استخدم هذا # lotsize #define RiskPercent 0.5/Risk for initial trade #define RiskDecrease 0.25/Risk reduction for the next trade/- ATR and multiples #define ATRPeriod 30/ATR Period to use #define ATRStopMultiplier 2/Multiplier for the stop stop loss #define ATROrderMultiplier 0.5/المضاعف لمزيد من الأوامر المعلقة/- لا تغير لي # تعريف اسم قصير شراء # إيقاف تعريف MagicNumber 5001 # تعريف Slippage 6 # تعريف 1/- مزدوج داخلي LastOrderLots = EMPTY_VALUE؛ مضاعفة LastOrderPrice؛ مضاعفة DecimalPip؛/ ----------------------------------------------- ------------------- /| وظيفة بدء البرنامج النصي المخصص/ ------------------------------------------- ----------------------- int start () {/Confirm if (MessageBox (ShortName - Do you really want to place (PendingOrders 1 ) BUYSTOP orders ؟، Script، MB_YESNO | MB_ICONQUESTION)! = IDYES) return (1)؛/Pip value DecimalPip = GetDecimalPip ()؛/Bars double CLOSE = iClose (Symbol ()، 0، Shift)؛ double HIGH = iHigh (الرمز () ، 0 ، Shift) ؛ ضعف LOW = iLow (الرمز () ، 0 ، Shift) ؛/-/- ضع الطلبية الأولى/- if (Bid gt؛ HIGH) {PlaceOrder (OP_BUY، GetLotSize ())؛ } آخر {PlaceOrder (OP_BUYSTOP، GetLotSize ()، HIGH)؛ }/-/- وضع الأوامر المعلقة/- لـ (int it = 0؛ it lt؛ PendingOrders؛ إنها ) PlaceOrder (OP_BUYSTOP، GetLotSize ()، LastOrderPrice iATR (الرمز ()، 0، ATRPeriod، التحول) * ATROrderMultiplier)؛/مرحبا! تعليق (حقوق التأليف والنشر http://www.pointzero-trading.com) ؛/وداعا العودة (0) ؛ }/ ---------------------------------------------- -------------------- /| وظائفي/ --------------------------------------------- --------------------- ** * يحسب حجم اللوت وفقا للمخاطرة * @ عوائق مزدوجة *مزدوجة GetLotSize () {//Lots double l_lotz = LotSize ./Lotsize والقيود double l_minlot = MarketInfo (الرمز () ، MODE_MINLOT) ؛ double l_maxlot = MarketInfo (Symbol ()، MODE_MAXLOT)؛ double l_lotstep = MarketInfo (Symbol ()، MODE_LOTSTEP)؛ int vp = 0؛ if (l_lotstep == 0.01) vp = 2؛ آخر vp = 1؛/تطبيق إدارة الأموال إذا (MoneyManagement == true) l_lotz = MathFloor (AccountBalance () * RiskPercent100.0)1000.0؛/انتظر! تحقق مما إذا كنت هرميًا إذا (LastOrderLots! = EMPTY_VALUELastOrderLots gt؛ 0) l_lotz = LastOrderLots * RiskDecrease؛/Normalize to lotstep l_lotz = NormalizeDouble (l_lotz، vp)؛/حدد maxminlot هنا إذا كان (l_lotz lt؛ l_minlot) l_lotz = l_minlot؛ if (l_lotz gt؛ l_maxlot) l_lotz = l_maxlot؛/وداعا! return (l_lotz)؛ }** * يضع طلبًا *param int نوع *param double Lotz *param double PendingPrice *void PlaceOrder (int type، double Lotz، double PendingPrice = 0) {//Local int err؛ لون l_color؛ double l_stoploss، l_price، l_sprice = 0؛ double stoplevel = getStopLevelInPips ()؛ RefreshRates ()؛/السعر واللون لنوع التداول إذا (Type == OP_BUY) {l_price = Ask؛ l_color = أزرق } if (Type == OP_SELL) {l_price = Bid؛ l_color = أحمر } if (Type == OP_BUYSTOP) {l_price = PendingPrice؛ إذا (l_price lt؛ = Ask stoplevel * DecimalPip) l_price = Ask stoplevel * DecimalPip؛ l_color = LightBlue ، } if (اكتب == OP_SELLSTOP) {l_price = PendingPrice؛ if (l_price gt؛ = Bid-stoplevel * DecimalPip) l_price = Bid ​​- stoplevel * DecimalPip؛ l_color = سمك السلمون///تجنب حالات التمزق أثناء النوم (IsTradeContextBusy ()) (1000)؛ int l_datetime = TimeCurrent ()؛/send order int l_ticket = OrderSend (Symbol ()، Type، Lotz، MyNormalizeDouble (l_price)، Slippage، 0، 0،، MagicNumber، 0، l_color)؛/Rety if failure if (l_ticket == -1) {while (l_ticket == -1 TimeCurrent () - l_datetime lt؛ 5! IsTesting ()) {err = GetLastError ()؛ إذا عاد (err == 148) ؛ النوم (1000)؛ while (IsTradeContextBusy ()) Sleep (1000)؛ RefreshRates ()؛ l_ticket = OrderSend (Symbol ()، Type، Lotz، MyNormalizeDouble (l_price)، Slippage، 0، 0،، MagicNumber، 0، l_color)؛ } إذا (l_ticket == -1) طباعة (ShortName (خطأ OrderSend) ErrorDescription (GetLastError ()))؛ } if (l_ticket! = -1) {LastOrderLots = Lotz؛ LastOrderPrice = l_price؛ if (OrderSelect (l_ticket، SELECT_BY_TICKET، MODE_TRADES)) {l_stoploss = MyNormalizeDouble (GetStopLoss (Type، PendingPrice))؛ إذا (! OrderModify (l_ticket، OrderOpenPrice ()، l_stoploss، 0، 0، Green)) طباعة (ShortName (OrderModify Error) ErrorDescription (GetLastError ()))؛ }}}** * إرجاع stoploss الأولي *param int Type *param double ForcedPrice *return double *double GetStopLoss (int type، double ForcedPrice = 0) {double l_sl = 0؛ if (Type == OP_BUY) l_sl = Ask - iATR (Symbol ()، 0، ATRPeriod، Shift) * ATRStopMultiplier - (Ask - Bid)؛ if (Type == OP_SELL) l_sl = Bid ​​ iATR (Symbol ()، 0، ATRPeriod، Shift) * ATRStopMultiplier (Ask - Bid)؛ if (Type == OP_BUYSTOP) l_sl = ForcedPrice - iATR (Symbol ()، 0، ATRPeriod، Shift) * ATRStopMultiplier - (Ask - Bid)؛ if (Type == OP_SELLSTOP) l_sl = ForcedPrice iATR (Symbol ()، 0، ATRPeriod، Shift) * ATRStopMultiplier (Ask - Bid)؛ return (l_sl)؛ }** * تعيد قيمة النقطة العشرية *return double*double GetDecimalPip () {switch (Digits) {case 5: return (0.0001)؛ الحالة 4: الإرجاع (0.0001) ؛ الحالة 3: الرجوع (0.001) ؛ الافتراضي: return (0.01)؛ }}** * Normalizes price *param double price *return double *double MyNormalizeDouble (double price) {return (NormalizeDouble (price، Digits))؛ }** * الحصول على خط الأساس بالإضافة إلى الانحراف * @ عائق مزدوج *double getStopLevelInPips () {double s = MarketInfo (الرمز () ، MODE_STOPLEVEL) 1.0؛ if (Digits == 5) s = s10؛ عائدات)؛ }