私は3ema5200と300を使用します。マルチンゲールロットが開いているEAが必要で、ストップロスは前のmacrossです。ポジション5と300を開き、ストップロスが5と200であることを意味します
。
私は3ema5200と300を使用します。マルチンゲールロットが開いているEAが必要で、ストップロスは前のmacrossです。ポジション5と300を開き、ストップロスが5と200であることを意味します
。
たとえば、挿入されたコード// ------------------------------------------- ----------------------- /| CrossEMA.mq4 |/|アミンAhsous|/| #91; url#93; https://www.mql5.com/en/users/simpletradeea#91;url#93; |/ ----------------------------------------------- ------------------- #property copyright Amine Ahsous #property link https://www.mql5.com/en/users/simpletradeea #property version 1.00 #property strict extern int MagicNumber = 0; extern double 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; extern string Mode1 ====== FIRST MODE =====; extern int FirstMA = 5; extern ENUM_MA_METHOD FirstMAmode = MODE_EMA; extern int SecondMA = 100; extern ENUM_MA_METHOD SecondMAmode = MODE_EMA;ダブルポイント; int桁、Q;ダブルSL、TP、販売、購入、クローズ、移動; int ThisBarTrade = 0; bool NewBar;/ ----------------------------------------------- ------------------- /|エキスパート初期化機能|/ ----------------------------------------------- ------------------- int OnInit(){//--- if(Digits == 5 || Digits == 3)Q = 10;そうでなければQ=1; if(Digitslt; 4){ポイント= 0.01;桁=2; }else{ポイント=0.0001;数字=4; }/--- return(INIT_SUCCEEDED); }/ ---------------------------------------------- -------------------- /|エキスパートの初期化解除機能|/ ----------------------------------------------- ------------------- void OnDeinit(const int reason){//---}/ ------------- -------------------------------------------------- --- /|エキスパートティック機能|/ ----------------------------------------------- ------------------- void OnTick(){//--- if(Bars!= ThisBarTrade){NewBar = true; ThisBarTrade=バー; 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()、Order Opened Buy); 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()、Order Opened Sell); if(AutoClose)CloseOrders(OP_BUY); } NewBar = false; }}/ --------------------------------------------- --------------------- intorderscnt(){int cnt = 0; for(int i = 0; ilt; OrdersTotal(); i ){if(OrderSelect(i、SELECT_BY_POS、MODE_TRADES))if(OrderSymbol()== Symbol()MagicNumber == OrderMagicNumber()){cnt ; }} return(cnt); }// /int CloseOrders(int type){int cnt = OrdersTotal(); 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 ModifiedStopLoss(double ldStop){bool fm; double ldOpen = OrderOpenPrice(); double ldTake = OrderTakeProfit(); fm = OrderModify(OrderTicket()、ldOpen、ldStop、ldTake、0、Pink); } void sub_trailingsl(){for(int i = 0; ilt; OrdersTotal(); 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、digits)){ModifyStopLoss(NormalizeDouble(Ask TrailingStop * point、digits)); } if(OrderStopLoss()!= 0OrderStopLoss()!= NormalizeDouble(Ask TrailingStop * point、digits)OrderStopLoss()lt; OrderOpenPrice()OrderStopLoss()-Askgt; TrailingStop * point){ModifyStopLoss(NormalizeDouble(Ask TrailingStop *ポイント、桁)); }} if(OrderType()== OP_BUY){if(Bid-OrderOpenPrice()gt; = TrailingStop * point(OrderStopLoss()== 0 || OrderStopLoss()lt; = OrderOpenPrice())OrderStopLoss()!= NormalizeDouble (Bid-TrailingStop * point、digits)){ModifyStopLoss(NormalizeDouble(Bid-TrailingStop * point、digits)); } if(OrderStopLoss()!= 0OrderStopLoss()!= NormalizeDouble(Bid-TrailingStop * point、digits)OrderStopLoss()gt; OrderOpenPrice()Bid-OrderStopLoss()gt;(TrailingStop * point)){ModifyStopLoss(NormalizeDouble(Bid) -TrailingStop * point、digits)); }}}}}}}/==========#91; list#93;#91; *#93;#91;list#93;Originally Posted by ;
// ----------------------------------------------- ------------------- /| CrossEMA.mq4 |/|アミンAhsous|/|
https://www.mql5.com/en/users/simpletradeea|/ ----------------------------------------------- ------------------- #property copyright Amine Ahsous #property link https://www.mql5.com/en/users/simpletradeea #property version 1.00 #property strict extern int MagicNumber = 0; extern double 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; extern string Mode1 ====== FIRST MODE =====; extern int FirstMA = 5; extern ENUM_MA_METHOD FirstMAmode = MODE_EMA; extern int SecondMA = 100; extern ENUM_MA_METHOD SecondMAmode = MODE_EMA;ダブルポイント; int桁、Q;ダブルSL、TP、販売、購入、クローズ、移動; int ThisBarTrade = 0; bool NewBar;/ ----------------------------------------------- ------------------- /|エキスパート初期化機能|/ ----------------------------------------------- ------------------- int OnInit(){//--- if(Digits == 5 || Digits == 3)Q = 10;そうでなければQ=1; if(Digitslt; 4){ポイント= 0.01;桁=2; }else{ポイント=0.0001;数字=4; }/--- return(INIT_SUCCEEDED); }/ ---------------------------------------------- -------------------- /|エキスパートの初期化解除機能|/ ----------------------------------------------- ------------------- void OnDeinit(const int reason){//---}/ ------------- -------------------------------------------------- --- /|エキスパートティック機能|/ ----------------------------------------------- ------------------- void OnTick(){//--- if(Bars!= ThisBarTrade){NewBar = true; ThisBarTrade=バー; 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()、Order Opened Buy); 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()、Order Opened Sell); if(AutoClose)CloseOrders(OP_BUY); } NewBar = false; }}/ --------------------------------------------- --------------------- intorderscnt(){int cnt = 0; for(int i = 0; ilt; OrdersTotal(); i ){if(OrderSelect(i、SELECT_BY_POS、MODE_TRADES))if(OrderSymbol()== Symbol()MagicNumber == OrderMagicNumber()){cnt ; }} return(cnt); }/ /int CloseOrders(int type){int cnt = OrdersTotal(); 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 ModifiedStopLoss(double ldStop){bool fm; double ldOpen = OrderOpenPrice(); double ldTake = OrderTakeProfit(); fm = OrderModify(OrderTicket()、ldOpen、ldStop、ldTake、0、Pink); } void sub_trailingsl(){for(int i = 0; ilt; OrdersTotal(); 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、digits)){ModifyStopLoss(NormalizeDouble(Ask TrailingStop * point、digits)); } if(OrderStopLoss()!= 0OrderStopLoss()!= NormalizeDouble(Ask TrailingStop * point、digits)OrderStopLoss()lt; OrderOpenPrice()OrderStopLoss()-Askgt; TrailingStop * point){ModifyStopLoss(NormalizeDouble(Ask TrailingStop *ポイント、桁)); }} if(OrderType()== OP_BUY){if(Bid-OrderOpenPrice()gt; = TrailingStop * point(OrderStopLoss()== 0 || OrderStopLoss()lt; = OrderOpenPrice())OrderStopLoss()!= NormalizeDouble (Bid-TrailingStop * point、digits)){ModifyStopLoss(NormalizeDouble(Bid-TrailingStop * point、digits)); } if(OrderStopLoss()!= 0OrderStopLoss()!= NormalizeDouble(Bid-TrailingStop * point、digits)OrderStopLoss()gt; OrderOpenPrice()Bid-OrderStopLoss()gt;(TrailingStop * point)){ModifyStopLoss(NormalizeDouble(Bid) -TrailingStop * point、digits)); }}}}}}}/==========