3 ema vượt qua EA
Results 1 to 5 of 5

Thread: 3 ema vượt qua EA

  1. #1
    tôi sử dụng 3 ema 5 200 và 300. muốn có một ea với lô martingale mở và dừng lỗ là ma chéo trước. có nghĩa là nó mở vị trí 5 và 300 sau đó dừng lỗ là 5 và 200
    .

  2. #2

    Quote Originally Posted by ;
    {quote} Sử dụng thẻ mã thì sao? trân trọng {image}
    ví dụ: Mã đã chèn/ ------------------------------------------- ----------------------- /| CrossEMA.mq4 |/| Amine Ahsous |/| # 91; url # 93; https:/www.mql5.com/en/users/simpletradeea#91;url # 93; |/ ----------------------------------------------- ------------------- #property bản quyền Amine Ahsous #property link https://www.mql5.com/en/users/simpletradeea #property phiên bản 1.00 #property nghiêm ngặt extern int MagicNumber = 0; extern đôi LotSize = 0,01; extern int StopLoss = 0; extern int TakeProfit = 0; extern bool AutoClose = true; extern bool UseTrailingStop = false; extern int TrailingStop = 0; extern bool EmailAlert = true; chuỗi extern Mode1 ====== CHẾ ĐỘ ĐẦU TIÊN =====; extern int FirstMA = 5; extern ENUM_MA_METHOD FirstMAmode = MODE_EMA; extern int SecondMA = 100; extern ENUM_MA_METHOD SecondMAmode = MODE_EMA; điểm kép; chữ số int, Q; SL kép, TP, bán, mua, đóng, di chuyển; int ThisBarTrade = 0; bool NewBar;/ ----------------------------------------------- ------------------- /| Hàm khởi tạo chuyên gia |/ ----------------------------------------------- ------------------- int OnInit () {//--- if (Digits == 5 || Digits == 3) Q = 10; khác Q = 1; if (Digitslt; 4) {point = 0,01; các chữ số = 2; } else {point = 0,0001; các chữ số = 4; }/--- return (INIT_SUCCEEDED); }/ ---------------------------------------------- -------------------- /| Chuyên gia deinitialization chức năng |/ ----------------------------------------------- ------------------- void OnDeinit (const int reason) {//---}/ ------------- -------------------------------------------------- --- /| Chức năng đánh dấu chuyên gia |/ ----------------------------------------------- ------------------- void OnTick () {//--- if (Bars! = thisBarTrade) {NewBar = true; ThisBarTrade = Thanh; NewBar = true; } double FirstEMA2 = iMA (Symbol (), 0, FirstMA, 0, FirstMAmode, PRICE_CLOSE, 2); double FirstEMA1 = iMA (Symbol (), 0, FirstMA, 0, FirstMAmode, PRICE_CLOSE, 1); double SecondEMA2 = iMA (Symbol (), 0, SecondMA, 0, SecondMAmode, PRICE_CLOSE, 2); double SecondEMA1 = iMA (Symbol (), 0, SecondMA, 0, SecondMAmode, PRICE_CLOSE, 1); if (NewBar) {if (FirstEMA1gt; SecondEMA1FirstEMA2lt; = SecondEMA2) {if (StopLoss == 0) {SL = 0;} else {SL = Ask-StopLoss * point;} if (TakeProfit == 0) {TP = 0 ;} else {TP = Ask TakeProfit * point;} buy = OrderSend (Symbol (), OP_BUY, LotSize, Ask, 3 * Q, SL, TP, Buy Market, MagicNumber, 0, clrBlue); if (EmailAlert) SendMail (Symbol (), Đơn hàng Đã mở Mua); if (AutoClose) CloseOrders (OP_SELL); } if (FirstEMA1lt; SecondEMA1FirstEMA2gt; = SecondEMA2) {if (StopLoss == 0) {SL = 0;} else {SL = Bid ​​ StopLoss * point;} if (TakeProfit == 0) {TP = 0;} else { TP = Bid-TakeProfit * point;} sell = OrderSend (Symbol (), OP_SELL, LotSize, Bid, 3 * Q, SL, TP, Sell Market, MagicNumber, 0, clrRed); if (EmailAlert) SendMail (Symbol (), Lệnh đã Mở Bán); if (AutoClose) CloseOrders (OP_BUY); } NewBar = false; }}/ --------------------------------------------- --------------------- int ordercnt () {int cnt = 0; for (int i = 0; ilt; OrderTotal (); i ) {if (OrderSelect (i, SELECT_BY_POS, MODE_TRADES)) if (OrderSymbol () == Symbol () MagicNumber == OrderMagicNumber ()) {cnt ; }} return (cnt); }// /int CloseOrders (kiểu int) {int cnt = OrderTotal (); for (int i = cnt-1; igt; = 0; i--) {if (OrderSelect (i, SELECT_BY_POS, MODE_TRADES) == true) if (OrderSymbol () == Symbol () OrderMagicNumber () == MagicNumberOrderType ( ) == type) {close = OrderClose (OrderTicket (), OrderLots (), OrderClosePrice (), 3 * Q, clrWhite); }} return (0); }/********* void ModifyStopLoss (double ldStop) {bool fm; double ldOpen = OrderOpenPrice (); double ldTake = OrderTakeProfit (); fm = OrderModify (OrderTicket (), ldOpen, ldStop, ldTake, 0, Pink); } void sub_tranticl () {for (int i = 0; ilt; OrderTotal (); i ) {if (OrderSelect (i, SELECT_BY_POS, MODE_TRADES)) {if (OrderSymbol () == Symbol () OrderMagicNumber () == MagicNumber ) {if (OrderType () == OP_SELL) {if (OrderOpenPrice () - Askgt; = TrailingStop * point (OrderStopLoss () == 0 || OrderStopLoss () gt; = OrderOpenPrice ()) OrderStopLoss ()! = NormalizeDouble ( Ask TrailingStop * point, các chữ số)) {ModifyStopLoss (NormalizeDouble (Ask TrailingStop * point, các chữ số)); } if (OrderStopLoss ()! = 0OrderStopLoss ()! = NormalizeDouble (Ask TrailingStop * point, các chữ số) OrderStopLoss () lt; OrderOpenPrice () OrderStopLoss () - Askgt; TrailingStop * point) {ModifyStopLoss (NormalizeDouble (Ask TrailingStop) điểm, chữ số)); }} if (OrderType () == OP_BUY) {if (Bid-OrderOpenPrice () gt; = TrailingStop * point (OrderStopLoss () == 0 || OrderStopLoss () lt; = OrderOpenPrice ()) OrderStopLoss ()! = NormalizeDouble (Bid-TrailingStop * point, các chữ số)) {ModifyStopLoss (NormalizeDouble (Bid-TrailingStop * point, các chữ số)); } if (OrderStopLoss ()! = 0OrderStopLoss ()! = NormalizeDouble (Bid-TrailingStop * point, các chữ số) OrderStopLoss () gt; OrderOpenPrice () Bid-OrderStopLoss () gt; (TrailingStop * point)) {ModifyStopLoss (NormalizeDouble (Giá thầu -TrailingStop * điểm, chữ số)); }}}}}}/========== # 91; list # 93; # 91; * # 93; # 91;list # 93;

  3. #3
    // ----------------------------------------------- ------------------- /| CrossEMA.mq4 |/| Amine Ahsous |/|
    https://www.mql5.com/en/users/simpletradeea|/ ----------------------------------------------- ------------------- #property bản quyền Amine Ahsous #property link https://www.mql5.com/en/users/simpletradeea #property phiên bản 1.00 #property nghiêm ngặt extern int MagicNumber = 0; extern đôi LotSize = 0,01; extern int StopLoss = 0; extern int TakeProfit = 0; extern bool AutoClose = true; extern bool UseTrailingStop = false; extern int TrailingStop = 0; extern bool EmailAlert = true; chuỗi extern Mode1 ====== CHẾ ĐỘ ĐẦU TIÊN =====; extern int FirstMA = 5; extern ENUM_MA_METHOD FirstMAmode = MODE_EMA; extern int SecondMA = 100; extern ENUM_MA_METHOD SecondMAmode = MODE_EMA; điểm kép; chữ số int, Q; SL kép, TP, bán, mua, đóng, di chuyển; int ThisBarTrade = 0; bool NewBar;/ ----------------------------------------------- ------------------- /| Hàm khởi tạo chuyên gia |/ ----------------------------------------------- ------------------- int OnInit () {//--- if (Digits == 5 || Digits == 3) Q = 10; khác Q = 1; if (Digitslt; 4) {point = 0,01; các chữ số = 2; } else {point = 0,0001; các chữ số = 4; }/--- return (INIT_SUCCEEDED); }/ ---------------------------------------------- -------------------- /| Chuyên gia deinitialization chức năng |/ ----------------------------------------------- ------------------- void OnDeinit (const int reason) {//---}/ ------------- -------------------------------------------------- --- /| Chức năng đánh dấu chuyên gia |/ ----------------------------------------------- ------------------- void OnTick () {//--- if (Bars! = thisBarTrade) {NewBar = true; ThisBarTrade = Thanh; NewBar = true; } double FirstEMA2 = iMA (Symbol (), 0, FirstMA, 0, FirstMAmode, PRICE_CLOSE, 2); double FirstEMA1 = iMA (Symbol (), 0, FirstMA, 0, FirstMAmode, PRICE_CLOSE, 1); double SecondEMA2 = iMA (Symbol (), 0, SecondMA, 0, SecondMAmode, PRICE_CLOSE, 2); double SecondEMA1 = iMA (Symbol (), 0, SecondMA, 0, SecondMAmode, PRICE_CLOSE, 1); if (NewBar) {if (FirstEMA1gt; SecondEMA1FirstEMA2lt; = SecondEMA2) {if (StopLoss == 0) {SL = 0;} else {SL = Ask-StopLoss * point;} if (TakeProfit == 0) {TP = 0 ;} else {TP = Ask TakeProfit * point;} buy = OrderSend (Symbol (), OP_BUY, LotSize, Ask, 3 * Q, SL, TP, Buy Market, MagicNumber, 0, clrBlue); if (EmailAlert) SendMail (Symbol (), Đơn hàng Đã mở Mua); if (AutoClose) CloseOrders (OP_SELL); } if (FirstEMA1lt; SecondEMA1FirstEMA2gt; = SecondEMA2) {if (StopLoss == 0) {SL = 0;} else {SL = Bid ​​ StopLoss * point;} if (TakeProfit == 0) {TP = 0;} else { TP = Bid-TakeProfit * point;} sell = OrderSend (Symbol (), OP_SELL, LotSize, Bid, 3 * Q, SL, TP, Sell Market, MagicNumber, 0, clrRed); if (EmailAlert) SendMail (Symbol (), Lệnh đã Mở Bán); if (AutoClose) CloseOrders (OP_BUY); } NewBar = false; }}/ --------------------------------------------- --------------------- int ordercnt () {int cnt = 0; for (int i = 0; ilt; OrderTotal (); i ) {if (OrderSelect (i, SELECT_BY_POS, MODE_TRADES)) if (OrderSymbol () == Symbol () MagicNumber == OrderMagicNumber ()) {cnt ; }} return (cnt); }/ /int CloseOrders (kiểu int) {int cnt = OrderTotal (); for (int i = cnt-1; igt; = 0; i--) {if (OrderSelect (i, SELECT_BY_POS, MODE_TRADES) == true) if (OrderSymbol () == Symbol () OrderMagicNumber () == MagicNumberOrderType ( ) == type) {close = OrderClose (OrderTicket (), OrderLots (), OrderClosePrice (), 3 * Q, clrWhite); }} return (0); }/********* void ModifyStopLoss (double ldStop) {bool fm; double ldOpen = OrderOpenPrice (); double ldTake = OrderTakeProfit (); fm = OrderModify (OrderTicket (), ldOpen, ldStop, ldTake, 0, Pink); } void sub_tranticl () {for (int i = 0; ilt; OrderTotal (); i ) {if (OrderSelect (i, SELECT_BY_POS, MODE_TRADES)) {if (OrderSymbol () == Symbol () OrderMagicNumber () == MagicNumber ) {if (OrderType () == OP_SELL) {if (OrderOpenPrice () - Askgt; = TrailingStop * point (OrderStopLoss () == 0 || OrderStopLoss () gt; = OrderOpenPrice ()) OrderStopLoss ()! = NormalizeDouble ( Ask TrailingStop * point, các chữ số)) {ModifyStopLoss (NormalizeDouble (Ask TrailingStop * point, các chữ số)); } if (OrderStopLoss ()! = 0OrderStopLoss ()! = NormalizeDouble (Ask TrailingStop * point, các chữ số) OrderStopLoss () lt; OrderOpenPrice () OrderStopLoss () - Askgt; TrailingStop * point) {ModifyStopLoss (NormalizeDouble (Ask TrailingStop) điểm, chữ số)); }} if (OrderType () == OP_BUY) {if (Bid-OrderOpenPrice () gt; = TrailingStop * point (OrderStopLoss () == 0 || OrderStopLoss () lt; = OrderOpenPrice ()) OrderStopLoss ()! = NormalizeDouble (Bid-TrailingStop * point, các chữ số)) {ModifyStopLoss (NormalizeDouble (Bid-TrailingStop * point, các chữ số)); } if (OrderStopLoss ()! = 0OrderStopLoss ()! = NormalizeDouble (Bid-TrailingStop * point, các chữ số) OrderStopLoss () gt; OrderOpenPrice () Bid-OrderStopLoss () gt; (TrailingStop * point)) {ModifyStopLoss (NormalizeDouble (Giá thầu -TrailingStop * điểm, chữ số)); }}}}}}/==========

  4. #4
    1 (các) tệp đính kèm
    Quote Originally Posted by ;
    // ----------------------------------------------- ------------------- /| CrossEMA.mq4 |/| Amine Ahsous |/|
    https://www.mql5.com/en/users/simpletradeea|/ ----------------------------------------------- ------------------- #property bản quyền Amine Ahsous #property link https://www.mql5.com/en/users/simpletradeea #property phiên bản 1.00 #property nghiêm ngặt extern int MagicNumber = 0; extern đôi LotSize = 0,01; extern int StopLoss = 0; extern int TakeProfit = 0; extern bool AutoClose = true; extern bool UseTrailingStop = false; ngoài ...
    Điều gì về sử dụng thẻ mã? Trân trọng

  5. #5
    Nó có mã avave mở một đơn đặt hàng nhưng không đóng với dấu chéo ema khác nhau

Quyền đăng bài

  • Bạn không thể đăng bài viết mới
  • Bạn không thể đăng trả lời
  • Bạn không thể đăng tệp đính kèm
  • Bạn không thể chỉnh sửa bài đăng của bạn
  •  
Chính sách Cookie
Chính sách Cookie: Website forexibroker sử dụng cookies và khi tiếp tục sử dụng website bạn chấp thuận với điều này. Để có thêm thông tin, vui lòng đọc 'Thông tin Cookie'.