Rejoindre la communauté
banner_forum
Devenez membre de la plus grande
communauté francophone sur le Forex
Partagez, échangez et apprenez en gagnant des crédits sur votre compte de trading

CHANDELIER GAPS BOOSTER [ Corrigé ]

  • lefeuvr3

    151402 figures détectées

    NOM FIGURE TYPE HAUSSE
    Etoile du matin Doji HAUSSE 80,8%
    Etoile du matin HAUSSE 77,2%
    Passant de ceinture haussier HAUSSE 73,7%
    Fenetre haussiere HAUSSE 69,7%
    Avalement haussier HAUSSE 68,6%
    Expulsion haussiere HAUSSE 68,5%
    Ejection haussiere HAUSSE 67,8%
    Pénétrante HAUSSE 66,9%
    Marteau HAUSSE 63,4%
    Harami haussier HAUSSE 61,3%
    Marteau Inversé HAUSSE 54,2%
    Avalement baissier ultime HAUSSE 54,0%
    Creux en pince HAUSSE 53,6%




    NOM FIGURE TYPE BAISSE
    Avalement haussier ultime BAISSE 59,6%
    Pendu BAISSE 63,7%
    Harami baissier BAISSE 67,8%
    Sommet en pince BAISSE 69,6%
    Ejection baissiere BAISSE 70,1%
    Etoile filante BAISSE 70,2%
    Fenetre baissiere BAISSE 71,3%
    Expulsion baissiere BAISSE 71,7%
    Etoile du soir Doji BAISSE 73,5%
    Avalement baissier BAISSE 73,7%
    Nuage Noir BAISSE 74,6%
    Etoile du soir BAISSE 79,4%
    Passant de ceinture baissier BAISSE 79,7%

    Code
    //+------------------------------------------------------------------+ // CHANDELIERS+GAPS+MTF // EURUSD 1MN //+------------------------------------------------------------------+ #property copyright "Copyright 2019, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| input parameters //| //+------------------------------------------------------------------+ extern int MagicNumber=20180708; extern double Lots =0.01; extern double StopLoss=130; extern double TakeProfit=50; extern int TrailingStop=18; extern int Slippage=3; double lot; extern double LotFactor=20; //+------------------------------------------------------------------+ //| //+------------------------------------------------------------------+ extern string ga="--GAPS--"; extern int min_gapsizePERIOD_M1 = 6; extern int min_gapsizePERIOD_M5 = 6; extern int min_gapsizePERIOD_M15 = 6; extern int min_gapsizePERIOD_M30 = 6; extern int min_gapsizePERIOD_H1 = 6; extern int min_gapsizePERIOD_H4 = 6; //---- extern bool PERIOD_M1=true; extern bool PERIOD_M5=true; extern bool PERIOD_M15=true; extern bool PERIOD_M30=true; extern bool PERIOD_H1=true; extern bool PERIOD_H4=true; // extern string ca="--CANDLES--"; extern bool min_gap_size=7;//Min gap size in points extern bool multiplierbody=3; extern bool Lowerwick =0.10; extern int adxperiod =14; extern int adxthreshold =27; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { double MyPoint=Point; if(Digits==3 || Digits==5) MyPoint=Point*10; double TheStopLoss=0; double TheTakeProfit=0; if( TotalOrdersCount()==0 ) { int result=0; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //HAMMER double bodyBottom = MathMin(iOpen(NULL,PERIOD_M1,1), iClose(NULL,PERIOD_M1,1)); double bodyTop = MathMax(iOpen(NULL,PERIOD_M1,1), iClose(NULL,PERIOD_M1,1)); double body = bodyTop - bodyBottom; double lowerWick = bodyBottom - Low[1]; double upperWick = High[1] - bodyTop; bool isHammer = lowerWick > multiplierbody*body && upperWick < lowerWick*Lowerwick; bool isHangingMan = lowerWick > multiplierbody*body && upperWick < lowerWick*Lowerwick; bool invertedHammer = upperWick > multiplierbody*body && lowerWick < upperWick*Lowerwick; bool isInvertedHangingMan = upperWick > multiplierbody*body && lowerWick < upperWick*Lowerwick; if(((iOpen(NULL,PERIOD_M1,0)>iClose(NULL,PERIOD_M1,0)&&iClose(NULL,PERIOD_M1,1) > iOpen(NULL,PERIOD_M1,1) && (isHammer)) ||(iClose(NULL,PERIOD_M1,1) < iOpen(NULL,PERIOD_M1,1) && (isHammer))//bullish ||(iOpen(NULL,PERIOD_M1,0)>iClose(NULL,PERIOD_M1,0)&&iClose(NULL,PERIOD_M1,1) > iOpen(NULL,PERIOD_M1,1) && (invertedHammer)) ||(iClose(NULL,PERIOD_M1,1) < iOpen(NULL,PERIOD_M1,1) && (invertedHammer))//bullish ||(iOpen(NULL,PERIOD_M15,0)>iClose(NULL,PERIOD_M15,0)&&iClose(NULL,PERIOD_M15,0)>iOpen(NULL,PERIOD_M15,1)&&iOpen(NULL,PERIOD_M15,0)>iClose(NULL,PERIOD_M15,1)&&iOpen(NULL,PERIOD_M15,2)<iOpen(NULL,PERIOD_M15 ,3)&&iOpen(NULL,PERIOD_M15 ,2)<iClose(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15,2)<iOpen(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15 ,2)<iClose(NULL,PERIOD_M15 ,3)&&iOpen(NULL,PERIOD_M15 ,3)<iClose(NULL,PERIOD_M15 ,3))//Star ||(iOpen(NULL,PERIOD_M15,0)>iClose(NULL,PERIOD_M15,0)&&iOpen(NULL,PERIOD_M15,0)>iOpen(NULL,PERIOD_M15,1)&&iClose(NULL,PERIOD_M15,0)>iOpen(NULL,PERIOD_M15,1)&&iClose(NULL,PERIOD_M15,0)>iClose(NULL,PERIOD_M15,1)-min_gap_size*Point&&iOpen(NULL,PERIOD_M15 ,2)<iOpen(NULL,PERIOD_M15 ,3)&&iOpen(NULL,PERIOD_M15 ,2)<iClose(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15 ,2)<iOpen(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15 ,2)<iClose(NULL,PERIOD_M15 ,3)&&iOpen(NULL,PERIOD_M15 ,3)<iClose(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15,1)<iOpen(NULL,PERIOD_M15,1))//Star ||(iClose(NULL,PERIOD_D1,1)>iOpen(NULL,PERIOD_D1,1)&&iOpen(NULL,PERIOD_D1,0)>iClose(NULL,PERIOD_D1,0)&& iClose(NULL,PERIOD_D1,0)<iClose(NULL,PERIOD_D1,1)&&iClose(NULL,PERIOD_D1,0)<iOpen(NULL,PERIOD_D1,1)&&iOpen(NULL,PERIOD_D1,0)>iOpen(NULL,PERIOD_D1,1)&&iOpen(NULL,PERIOD_D1,0)>iClose(NULL,PERIOD_D1,1))//Harami ||(iOpen(NULL,PERIOD_M1,1)<iClose(NULL,PERIOD_M1,1)&&iOpen(NULL,PERIOD_M1,0)<iClose(NULL,PERIOD_M1,1)&& iOpen(NULL,PERIOD_M1,0)>iOpen(NULL,PERIOD_M1,1)&&iClose(NULL,PERIOD_M1,0)<iClose(NULL,PERIOD_M1,1)&&iClose(NULL,PERIOD_M1,0)>iOpen(NULL,PERIOD_M1,1)&&iOpen(NULL,PERIOD_M1,0)<iClose(NULL,PERIOD_M1,1)&&iOpen(NULL,PERIOD_M1,0)>iOpen(NULL,PERIOD_M1,1)&&iClose(NULL,PERIOD_M1,0)<iClose(NULL,PERIOD_M1,1)&&iClose(NULL,PERIOD_M1,0)>iOpen(NULL,PERIOD_M1,1)))//engulfing ||(iOpen(NULL,PERIOD_M5,0)>iClose(NULL,PERIOD_M5,0)&&iClose(NULL,PERIOD_M5,0)>iOpen(NULL,PERIOD_M5 ,1)&&iOpen(NULL,PERIOD_M5 ,1)==iLow(NULL,PERIOD_M5 ,1)&&iClose(NULL,PERIOD_M5 ,1)>iOpen(NULL,PERIOD_M5 ,1)&&iOpen(NULL,PERIOD_M5 ,2)<iClose(NULL,PERIOD_M5 ,2)&&iClose(NULL,PERIOD_M5 ,1)<iClose(NULL,PERIOD_M5 ,2))) // Holding Belt // Here is your open Buy rule bearish gap { result=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,0,0,"EA Generator www.ForexEAdvisor.com",MagicNumber,0,Blue); if(result>0) { TheStopLoss=0; TheTakeProfit=0; if(TakeProfit>0) TheTakeProfit=Bid+TakeProfit*MyPoint; if(StopLoss>0) TheStopLoss=Bid-StopLoss*MyPoint; if(OrderSelect(result,SELECT_BY_TICKET)==true) bool modif2=OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(TheStopLoss,Digits),NormalizeDouble(TheTakeProfit,Digits),0,Green); } return(0); } if((iOpen(NULL,PERIOD_M1,0)<iClose(NULL,PERIOD_M1,0)&&iClose(NULL,PERIOD_M1,1) < iOpen(NULL,PERIOD_M1,1) && (isHangingMan)) ||(iClose(NULL,PERIOD_M1,1) > iOpen(NULL,PERIOD_M1,1) && (isHangingMan))//bearish ||(iOpen(NULL,PERIOD_M1,0)<iClose(NULL,PERIOD_M1,0)&&iClose(NULL,PERIOD_M1,1) > iOpen(NULL,PERIOD_M1,1) && (isInvertedHangingMan)) ||(iClose(NULL,PERIOD_M1,1) < iOpen(NULL,PERIOD_M1,1) && (isInvertedHangingMan))//bearish ||(iOpen(NULL,PERIOD_M15,0)<iClose(NULL,PERIOD_M15,0)&&iClose(NULL,PERIOD_M15,0)<iOpen(NULL,PERIOD_M15,1)&&iOpen(NULL,PERIOD_M15,0)<iClose(NULL,PERIOD_M15,1)&&iOpen(NULL,PERIOD_M15,2)>iOpen(NULL,PERIOD_M15 ,3)&&iOpen(NULL,PERIOD_M15 ,2)>iClose(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15 ,2)>iOpen(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15 ,2)>iClose(NULL,PERIOD_M15 ,3)&&iOpen(NULL,PERIOD_M15 ,3)>iClose(NULL,PERIOD_M15 ,3))//Star ||(iOpen(NULL,PERIOD_M15,0)<iClose(NULL,PERIOD_M15,0)&&iOpen(NULL,PERIOD_M15,0)<iOpen(NULL,PERIOD_M15,1)&&iClose(NULL,PERIOD_M15,0)<iOpen(NULL,PERIOD_M15,1)&&iClose(NULL,PERIOD_M15,0)<iClose(NULL,PERIOD_M15,1)+min_gap_size*Point&&iOpen(NULL,PERIOD_M15 ,2)>iOpen(NULL,PERIOD_M15 ,3)&&iOpen(NULL,PERIOD_M15 ,2)>iClose(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15 ,2)>iOpen(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15 ,2)>iClose(NULL,PERIOD_M15 ,3)&&iOpen(NULL,PERIOD_M15 ,3)>iClose(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15,1)>iOpen(NULL,PERIOD_M15,1))//Star ||(iClose(NULL,PERIOD_D1,1)<iOpen(NULL,PERIOD_D1,1)&&iOpen(NULL,PERIOD_D1,0)<iClose(NULL,PERIOD_D1,0)&& iClose(NULL,PERIOD_D1,0)>iClose(NULL,PERIOD_D1,1)&&iClose(NULL,PERIOD_D1,0)>iOpen(NULL,PERIOD_D1,1)&&iOpen(NULL,PERIOD_D1,0)<iOpen(NULL,PERIOD_D1,1)&&iOpen(NULL,PERIOD_D1,0)<iClose(NULL,PERIOD_D1,1)) //Harami ||(iOpen(NULL,PERIOD_M1,1)>iClose(NULL,PERIOD_M1,1)&&iOpen(NULL,PERIOD_M1,0)>iClose(NULL,PERIOD_M1,1)&& iOpen(NULL,PERIOD_M1,0)<iOpen(NULL,PERIOD_M1,1)&&iClose(NULL,PERIOD_M1,0)>iClose(NULL,PERIOD_M1,1)&&iClose(NULL,PERIOD_M1,0)<iOpen(NULL,PERIOD_M1,1)&&iOpen(NULL,PERIOD_M1,0)>iClose(NULL,PERIOD_M1,1)&&iOpen(NULL,PERIOD_M1,0)<iOpen(NULL,PERIOD_M1,1)&&iClose(NULL,PERIOD_M1,0)>iClose(NULL,PERIOD_M1,1)&&iClose(NULL,PERIOD_M1,0)<iOpen(NULL,PERIOD_M1,1))//Engulfing ||(iOpen(NULL,PERIOD_M5,0)<iClose(NULL,PERIOD_M5,0)&&iClose(NULL,PERIOD_M5,0)<iOpen(NULL,PERIOD_M5 ,1)&&iOpen(NULL,PERIOD_M5 ,1)==iHigh(NULL,PERIOD_M5 ,1)&&iClose(NULL,PERIOD_M5 ,1)<iOpen(NULL,PERIOD_M5 ,1)&&iOpen(NULL,PERIOD_M5,2)>iClose(NULL,PERIOD_M5,2)&&iClose(NULL,PERIOD_M5 ,1)>iClose(NULL,PERIOD_M5 ,2)/*&& (booster))*/))// Holding Belt // Here is your open Sell rule bullish gap { result=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,0,0,"EA Generator www.ForexEAdvisor.com",MagicNumber,0,Red); if(result>0) { TheStopLoss=0; TheTakeProfit=0; if(TakeProfit>0) TheTakeProfit=Ask-TakeProfit*MyPoint; if(StopLoss>0) TheStopLoss=Ask+StopLoss*MyPoint; if(OrderSelect(result,SELECT_BY_TICKET)==true) bool modif3=OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(TheStopLoss,Digits),NormalizeDouble(TheTakeProfit,Digits),0,Green); } return(0); } } //+------------------------------------------------------------------+ //| //+------------------------------------------------------------------+ static datetime order_time = 0; int ticket = 0; if(OrdersTotal()==0) order_time=0; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //Defining the variables to decide. //Print("order time", order_time); //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ // catching the gap on sell upper gap double booster = Volume[1]> Volume[0] &&(iADX(Symbol(),0,adxperiod,PRICE_CLOSE,MODE_MAIN,0)>adxthreshold ); // if(PERIOD_M1==True && (booster)&& iOpen(Symbol(), PERIOD_M1, 0) > (iHigh(Symbol(), PERIOD_M1, 1) + (min_gapsizePERIOD_M1 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_M1, 0) != order_time) { ticket = OrderSend(Symbol(), OP_SELL, NR(Lot_Volume()), Bid, 0, 0, iHigh(Symbol(), PERIOD_M1, 1) + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 4, 0, Red); order_time = iTime(Symbol(), PERIOD_M1, 0); Print("I am inside (sell) :-)", order_time); //---- //---- if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_M5==True && (booster) && iOpen(Symbol(), PERIOD_M5, 0) > (iHigh(Symbol(), PERIOD_M5, 1) + (min_gapsizePERIOD_M5 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_M5, 0) != order_time) { ticket = OrderSend(Symbol(), OP_SELL, NR(Lot_Volume()), Bid, 0, 0, iHigh(Symbol(), PERIOD_M5, 1) + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 4, 0, Red); order_time = iTime(Symbol(), PERIOD_M5, 0); Print("I am inside (sell) :-)", order_time); //---- if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_M15==True && (booster)&& iOpen(Symbol(), PERIOD_M15, 0) > (iHigh(Symbol(), PERIOD_M15, 1) + (min_gapsizePERIOD_M15 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_M15, 0) != order_time) { ticket = OrderSend(Symbol(), OP_SELL,NR(Lot_Volume()), Bid, 0, 0, iHigh(Symbol(), PERIOD_M15, 1) + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 4, 0, Red); order_time = iTime(Symbol(), PERIOD_M15, 0); Print("I am inside (sell) :-)", order_time); //---- if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_M30==True && (booster) && iOpen(Symbol(), PERIOD_M30, 0) > (iHigh(Symbol(), PERIOD_M30, 1) + (min_gapsizePERIOD_M30 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_M30, 0) != order_time) { ticket = OrderSend(Symbol(), OP_SELL,NR(Lot_Volume()), Bid, 0, 0, iHigh(Symbol(), PERIOD_M30, 1) + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 4, 0, Red); order_time = iTime(Symbol(), PERIOD_M30, 0); Print("I am inside (sell) :-)", order_time); //---- if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_H1==True && (booster)&& iOpen(Symbol(), PERIOD_H1 ,0) > (iHigh(Symbol(), PERIOD_H1, 1) + (min_gapsizePERIOD_H1 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_H1, 0) != order_time) { ticket = OrderSend(Symbol(), OP_SELL,NR(Lot_Volume()), Bid, 0, 0, iHigh(Symbol(), PERIOD_H1, 1) + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 4, 0, Red); order_time = iTime(Symbol(), PERIOD_H1, 0); Print("I am inside (sell) :-)", order_time); //---- if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_H4==True && (booster)&& iOpen(Symbol(), PERIOD_H4, 0) > (iHigh(Symbol(), PERIOD_H4, 1) + (min_gapsizePERIOD_H4 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_H4, 0) != order_time) { ticket = OrderSend(Symbol(), OP_SELL, NR(Lot_Volume()), Bid, 0, 0, iHigh(Symbol(), PERIOD_H4, 1) + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 4, 0, Red); order_time = iTime(Symbol(), PERIOD_H4, 0); Print("I am inside (sell) :-)", order_time); //---- if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } //catching the gap on buy down gap if(PERIOD_M1==True && (booster)&& iOpen(Symbol(), PERIOD_M1, 0) < (iLow(Symbol(), PERIOD_M1, 1) - (min_gapsizePERIOD_M1 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_M1, 0) != order_time) { ticket = OrderSend(Symbol(), OP_BUY, NR(Lot_Volume()), Ask, 0, 0, iLow(Symbol(), PERIOD_M1, 1) - MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 5, 0, Green); order_time = iTime(Symbol(), PERIOD_M1, 0); Print("I am inside (buy) :-)", order_time); if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_M5==True && (booster)&& iOpen(Symbol(), PERIOD_M5, 0) < (iLow(Symbol(), PERIOD_M5, 1) - (min_gapsizePERIOD_M5 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_M5, 0) != order_time) { ticket = OrderSend(Symbol(), OP_BUY, NR(Lot_Volume()), Ask, 0, 0, iLow(Symbol(), PERIOD_M5, 1) - MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 5, 0, Green); order_time = iTime(Symbol(), PERIOD_M5, 0); Print("I am inside (buy) :-)", order_time); if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_M15==True && (booster)&& iOpen(Symbol(), PERIOD_M15, 0) < (iLow(Symbol(), PERIOD_M15, 1) - (min_gapsizePERIOD_M15 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_M15, 0) != order_time) { ticket = OrderSend(Symbol(), OP_BUY, NR(Lot_Volume()), Ask, 0, 0, iLow(Symbol(), PERIOD_M15, 1) - MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 5, 0, Green); order_time = iTime(Symbol(), PERIOD_M15, 0); Print("I am inside (buy) :-)", order_time); if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_M30==True && (booster)&& iOpen(Symbol(), PERIOD_M30, 0) < (iLow(Symbol(), PERIOD_M30, 1) - (min_gapsizePERIOD_M30 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_M30, 0) != order_time) { ticket = OrderSend(Symbol(), OP_BUY,NR(Lot_Volume()) , Ask, 0, 0, iLow(Symbol(), PERIOD_M30, 1) - MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 5, 0, Green); order_time = iTime(Symbol(), PERIOD_M30, 0); Print("I am inside (buy) :-)", order_time); if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_H1==True && (booster)&& iOpen(Symbol(), PERIOD_H1, 0) < (iLow(Symbol(), PERIOD_H1, 1) - (min_gapsizePERIOD_H1 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_H1, 0) != order_time) { ticket = OrderSend(Symbol(), OP_BUY,NR(Lot_Volume()), Ask, 0, 0, iLow(Symbol(), PERIOD_H1, 1) - MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 5, 0, Green); order_time = iTime(Symbol(), PERIOD_H1, 0); Print("I am inside (buy) :-)", order_time); if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_H4==True && (booster)&& iOpen(Symbol(), PERIOD_H4, 0) < (iLow(Symbol(), PERIOD_H4, 1) - (min_gapsizePERIOD_H4 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_H4, 0) != order_time) { ticket = OrderSend(Symbol(), OP_BUY, NR(Lot_Volume()), Ask, 0, 0, iLow(Symbol(), PERIOD_H4, 1) - MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 5, 0, Green); order_time = iTime(Symbol(), PERIOD_H4, 0); Print("I am inside (buy) :-)", order_time); if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ for(int cnt=0;cnt<OrdersTotal();cnt++) { if(OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)==true) if(OrderType()<=OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber ) { if(OrderType()==OP_BUY) { if(TrailingStop>0) { if(Bid-OrderOpenPrice()>MyPoint*TrailingStop) { if(OrderStopLoss()<Bid-MyPoint*TrailingStop) { bool modif1=OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*MyPoint,OrderTakeProfit(),0,Green); return(0); } } } } else { if(TrailingStop>0) { if((OrderOpenPrice()-Ask)>(MyPoint*TrailingStop)) { if((OrderStopLoss()>(Ask+MyPoint*TrailingStop)) || (OrderStopLoss()==0)) { bool modif4=OrderModify(OrderTicket(),OrderOpenPrice(),Ask+MyPoint*TrailingStop,OrderTakeProfit(),0,Red); return(0); } } } } } } return(0); } int TotalOrdersCount() { int result=0; for(int i=0;i<OrdersTotal();i++) { if(OrderSelect(i,SELECT_BY_POS ,MODE_TRADES)==true) if (OrderMagicNumber()==MagicNumber) result++; } return (result); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //Calculates Lot Size based on balance and factor //+------------------------------------------------------------------+ double NR(double thelot) { double maxlots=MarketInfo(Symbol(),MODE_MAXLOT), minilot=MarketInfo(Symbol(),MODE_MINLOT), lstep=MarketInfo(Symbol(),MODE_LOTSTEP); double lots=lstep*NormalizeDouble(thelot/lstep,0); lots=MathMax(MathMin(maxlots,lots),minilot); return (lots); } //+------------------------------------------------------------------+ double Lot_Volume() { lot=AccountBalance() * 0.01 /LotFactor ; return(lot); } //+------------------------------------------------------------------+ //| //+------------------------------------------------------------------+
    lefeuvr3 a joint une image
    chandelier-gaps-booster-corrige-12512
  • lefeuvr3

    Version améliorée et plus performante
    Code
    //+------------------------------------------------------------------+ // CHANDELIERS+GAPS+MTF v1 //+------------------------------------------------------------------+ #property copyright "Copyright 2019, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| input parameters //| //+------------------------------------------------------------------+ extern int MagicNumber=20180708; //extern double Lots =0.01; extern double StopLoss=130; extern double TakeProfit=0; extern int TrailingStop=18; extern int Slippage=3; double lot; extern double LotFactor=150; //+------------------------------------------------------------------+ //| //+------------------------------------------------------------------+ extern string ga="--GAPS--"; extern int min_gapsizePERIOD_M1 = 6; extern int min_gapsizePERIOD_M5 = 6; extern int min_gapsizePERIOD_M15 = 6; extern int min_gapsizePERIOD_M30 = 6; extern int min_gapsizePERIOD_H1 = 6; extern int min_gapsizePERIOD_H4 = 6; //---- extern bool PERIOD_M1=true; extern bool PERIOD_M5=true; extern bool PERIOD_M15=true; extern bool PERIOD_M30=true; extern bool PERIOD_H1=true; extern bool PERIOD_H4=true; // extern string ca="--CANDLES--"; extern bool min_gap_size=7;//Min gap size in points extern bool multiplierbody=3; extern bool Lowerwick =0.10; extern int adxperiod =14; extern int adxthreshold =27; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { double MyPoint=Point; if(Digits==3 || Digits==5) MyPoint=Point*10; double TheStopLoss=0; double TheTakeProfit=0; if( TotalOrdersCount()==0 ) { int result=0; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //HAMMER double bodyBottom = MathMin(iOpen(NULL,PERIOD_M1,1), iClose(NULL,PERIOD_M1,1)); double bodyTop = MathMax(iOpen(NULL,PERIOD_M1,1), iClose(NULL,PERIOD_M1,1)); double body = bodyTop - bodyBottom; double lowerWick = bodyBottom - Low[1]; double upperWick = High[1] - bodyTop; bool isHammer = lowerWick > multiplierbody*body && upperWick < lowerWick*Lowerwick; bool isHangingMan = lowerWick > multiplierbody*body && upperWick < lowerWick*Lowerwick; bool invertedHammer = upperWick > multiplierbody*body && lowerWick < upperWick*Lowerwick; bool isInvertedHangingMan = upperWick > multiplierbody*body && lowerWick < upperWick*Lowerwick; if(((iOpen(NULL,PERIOD_M1,0)>iClose(NULL,PERIOD_M1,0)&&iClose(NULL,PERIOD_M1,1) > iOpen(NULL,PERIOD_M1,1) && (isHammer)) ||(iClose(NULL,PERIOD_M1,1) < iOpen(NULL,PERIOD_M1,1) && (isHammer))//bullish ||(iOpen(NULL,PERIOD_M1,0)>iClose(NULL,PERIOD_M1,0)&&iClose(NULL,PERIOD_M1,1) > iOpen(NULL,PERIOD_M1,1) && (invertedHammer)) ||(iClose(NULL,PERIOD_M1,1) < iOpen(NULL,PERIOD_M1,1) && (invertedHammer))//bullish ||(iOpen(NULL,PERIOD_M15,0)>iClose(NULL,PERIOD_M15,0)&&iClose(NULL,PERIOD_M15,0)>iOpen(NULL,PERIOD_M15,1)&&iOpen(NULL,PERIOD_M15,0)>iClose(NULL,PERIOD_M15,1)&&iOpen(NULL,PERIOD_M15,2)<iOpen(NULL,PERIOD_M15 ,3)&&iOpen(NULL,PERIOD_M15 ,2)<iClose(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15,2)<iOpen(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15 ,2)<iClose(NULL,PERIOD_M15 ,3)&&iOpen(NULL,PERIOD_M15 ,3)<iClose(NULL,PERIOD_M15 ,3))//Star ||(iOpen(NULL,PERIOD_M15,0)>iClose(NULL,PERIOD_M15,0)&&iOpen(NULL,PERIOD_M15,0)>iOpen(NULL,PERIOD_M15,1)&&iClose(NULL,PERIOD_M15,0)>iOpen(NULL,PERIOD_M15,1)&&iClose(NULL,PERIOD_M15,0)>iClose(NULL,PERIOD_M15,1)-min_gap_size*Point&&iOpen(NULL,PERIOD_M15 ,2)<iOpen(NULL,PERIOD_M15 ,3)&&iOpen(NULL,PERIOD_M15 ,2)<iClose(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15 ,2)<iOpen(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15 ,2)<iClose(NULL,PERIOD_M15 ,3)&&iOpen(NULL,PERIOD_M15 ,3)<iClose(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15,1)<iOpen(NULL,PERIOD_M15,1))//Star ||(iClose(NULL,PERIOD_D1,1)>iOpen(NULL,PERIOD_D1,1)&&iOpen(NULL,PERIOD_D1,0)>iClose(NULL,PERIOD_D1,0)&& iClose(NULL,PERIOD_D1,0)<iClose(NULL,PERIOD_D1,1)&&iClose(NULL,PERIOD_D1,0)<iOpen(NULL,PERIOD_D1,1)&&iOpen(NULL,PERIOD_D1,0)>iOpen(NULL,PERIOD_D1,1)&&iOpen(NULL,PERIOD_D1,0)>iClose(NULL,PERIOD_D1,1))//Harami ||(iOpen(NULL,PERIOD_M1,1)<iClose(NULL,PERIOD_M1,1)&&iOpen(NULL,PERIOD_M1,0)<iClose(NULL,PERIOD_M1,1)&& iOpen(NULL,PERIOD_M1,0)>iOpen(NULL,PERIOD_M1,1)&&iClose(NULL,PERIOD_M1,0)<iClose(NULL,PERIOD_M1,1)&&iClose(NULL,PERIOD_M1,0)>iOpen(NULL,PERIOD_M1,1)&&iOpen(NULL,PERIOD_M1,0)<iClose(NULL,PERIOD_M1,1)&&iOpen(NULL,PERIOD_M1,0)>iOpen(NULL,PERIOD_M1,1)&&iClose(NULL,PERIOD_M1,0)<iClose(NULL,PERIOD_M1,1)&&iClose(NULL,PERIOD_M1,0)>iOpen(NULL,PERIOD_M1,1)))//engulfing ||(iOpen(NULL,PERIOD_M5,0)>iClose(NULL,PERIOD_M5,0)&&iClose(NULL,PERIOD_M5,0)>iOpen(NULL,PERIOD_M5 ,1)&&iOpen(NULL,PERIOD_M5 ,1)==iLow(NULL,PERIOD_M5 ,1)&&iClose(NULL,PERIOD_M5 ,1)>iOpen(NULL,PERIOD_M5 ,1)&&iOpen(NULL,PERIOD_M5 ,2)<iClose(NULL,PERIOD_M5 ,2)&&iClose(NULL,PERIOD_M5 ,1)<iClose(NULL,PERIOD_M5 ,2))) // Holding Belt // Here is your open Buy rule bearish gap { result=OrderSend(Symbol(),OP_BUY, NR(Lot_Volume()),Ask,Slippage,0,0,"EA Generator www.ForexEAdvisor.com",MagicNumber,0,Blue); if(result>0) { TheStopLoss=0; TheTakeProfit=0; if(TakeProfit>0) TheTakeProfit=Bid+TakeProfit*MyPoint; if(StopLoss>0) TheStopLoss=Bid-StopLoss*MyPoint; if(OrderSelect(result,SELECT_BY_TICKET)==true) bool modif2=OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(TheStopLoss,Digits),NormalizeDouble(TheTakeProfit,Digits),0,Green); } return(0); } if((iOpen(NULL,PERIOD_M1,0)<iClose(NULL,PERIOD_M1,0)&&iClose(NULL,PERIOD_M1,1) < iOpen(NULL,PERIOD_M1,1) && (isHangingMan)) ||(iClose(NULL,PERIOD_M1,1) > iOpen(NULL,PERIOD_M1,1) && (isHangingMan))//bearish ||(iOpen(NULL,PERIOD_M1,0)<iClose(NULL,PERIOD_M1,0)&&iClose(NULL,PERIOD_M1,1) > iOpen(NULL,PERIOD_M1,1) && (isInvertedHangingMan)) ||(iClose(NULL,PERIOD_M1,1) < iOpen(NULL,PERIOD_M1,1) && (isInvertedHangingMan))//bearish ||(iOpen(NULL,PERIOD_M15,0)<iClose(NULL,PERIOD_M15,0)&&iClose(NULL,PERIOD_M15,0)<iOpen(NULL,PERIOD_M15,1)&&iOpen(NULL,PERIOD_M15,0)<iClose(NULL,PERIOD_M15,1)&&iOpen(NULL,PERIOD_M15,2)>iOpen(NULL,PERIOD_M15 ,3)&&iOpen(NULL,PERIOD_M15 ,2)>iClose(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15 ,2)>iOpen(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15 ,2)>iClose(NULL,PERIOD_M15 ,3)&&iOpen(NULL,PERIOD_M15 ,3)>iClose(NULL,PERIOD_M15 ,3))//Star ||(iOpen(NULL,PERIOD_M15,0)<iClose(NULL,PERIOD_M15,0)&&iOpen(NULL,PERIOD_M15,0)<iOpen(NULL,PERIOD_M15,1)&&iClose(NULL,PERIOD_M15,0)<iOpen(NULL,PERIOD_M15,1)&&iClose(NULL,PERIOD_M15,0)<iClose(NULL,PERIOD_M15,1)+min_gap_size*Point&&iOpen(NULL,PERIOD_M15 ,2)>iOpen(NULL,PERIOD_M15 ,3)&&iOpen(NULL,PERIOD_M15 ,2)>iClose(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15 ,2)>iOpen(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15 ,2)>iClose(NULL,PERIOD_M15 ,3)&&iOpen(NULL,PERIOD_M15 ,3)>iClose(NULL,PERIOD_M15 ,3)&&iClose(NULL,PERIOD_M15,1)>iOpen(NULL,PERIOD_M15,1))//Star ||(iClose(NULL,PERIOD_D1,1)<iOpen(NULL,PERIOD_D1,1)&&iOpen(NULL,PERIOD_D1,0)<iClose(NULL,PERIOD_D1,0)&& iClose(NULL,PERIOD_D1,0)>iClose(NULL,PERIOD_D1,1)&&iClose(NULL,PERIOD_D1,0)>iOpen(NULL,PERIOD_D1,1)&&iOpen(NULL,PERIOD_D1,0)<iOpen(NULL,PERIOD_D1,1)&&iOpen(NULL,PERIOD_D1,0)<iClose(NULL,PERIOD_D1,1)) //Harami ||(iOpen(NULL,PERIOD_M1,1)>iClose(NULL,PERIOD_M1,1)&&iOpen(NULL,PERIOD_M1,0)>iClose(NULL,PERIOD_M1,1)&& iOpen(NULL,PERIOD_M1,0)<iOpen(NULL,PERIOD_M1,1)&&iClose(NULL,PERIOD_M1,0)>iClose(NULL,PERIOD_M1,1)&&iClose(NULL,PERIOD_M1,0)<iOpen(NULL,PERIOD_M1,1)&&iOpen(NULL,PERIOD_M1,0)>iClose(NULL,PERIOD_M1,1)&&iOpen(NULL,PERIOD_M1,0)<iOpen(NULL,PERIOD_M1,1)&&iClose(NULL,PERIOD_M1,0)>iClose(NULL,PERIOD_M1,1)&&iClose(NULL,PERIOD_M1,0)<iOpen(NULL,PERIOD_M1,1))//Engulfing ||(iOpen(NULL,PERIOD_M5,0)<iClose(NULL,PERIOD_M5,0)&&iClose(NULL,PERIOD_M5,0)<iOpen(NULL,PERIOD_M5 ,1)&&iOpen(NULL,PERIOD_M5 ,1)==iHigh(NULL,PERIOD_M5 ,1)&&iClose(NULL,PERIOD_M5 ,1)<iOpen(NULL,PERIOD_M5 ,1)&&iOpen(NULL,PERIOD_M5,2)>iClose(NULL,PERIOD_M5,2)&&iClose(NULL,PERIOD_M5 ,1)>iClose(NULL,PERIOD_M5 ,2)/*&& (booster))*/))// Holding Belt // Here is your open Sell rule bullish gap { result=OrderSend(Symbol(),OP_SELL, NR(Lot_Volume()),Bid,Slippage,0,0,"EA Generator www.ForexEAdvisor.com",MagicNumber,0,Red); if(result>0) { TheStopLoss=0; TheTakeProfit=0; if(TakeProfit>0) TheTakeProfit=Ask-TakeProfit*MyPoint; if(StopLoss>0) TheStopLoss=Ask+StopLoss*MyPoint; if(OrderSelect(result,SELECT_BY_TICKET)==true) bool modif3=OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(TheStopLoss,Digits),NormalizeDouble(TheTakeProfit,Digits),0,Green); } return(0); } } //+------------------------------------------------------------------+ //| //+------------------------------------------------------------------+ static datetime order_time = 0; int ticket = 0; if(OrdersTotal()==0) order_time=0; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //Defining the variables to decide. //Print("order time", order_time); //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ // catching the gap on sell upper gap double booster = Volume[1]> Volume[0] &&(iADX(Symbol(),0,adxperiod,PRICE_CLOSE,MODE_MAIN,0)>adxthreshold ); // if(PERIOD_M1==True && (booster)&& iOpen(Symbol(), PERIOD_M1, 0) > (iHigh(Symbol(), PERIOD_M1, 1) + (min_gapsizePERIOD_M1 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_M1, 0) != order_time) { ticket = OrderSend(Symbol(), OP_SELL, NR(Lot_Volume()), Bid, 0, 0, iHigh(Symbol(), PERIOD_M1, 1) + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 4, 0, Red); order_time = iTime(Symbol(), PERIOD_M1, 0); Print("I am inside (sell) :-)", order_time); //---- //---- if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_M5==True && (booster) && iOpen(Symbol(), PERIOD_M5, 0) > (iHigh(Symbol(), PERIOD_M5, 1) + (min_gapsizePERIOD_M5 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_M5, 0) != order_time) { ticket = OrderSend(Symbol(), OP_SELL, NR(Lot_Volume()), Bid, 0, 0, iHigh(Symbol(), PERIOD_M5, 1) + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 4, 0, Red); order_time = iTime(Symbol(), PERIOD_M5, 0); Print("I am inside (sell) :-)", order_time); //---- if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_M15==True && (booster)&& iOpen(Symbol(), PERIOD_M15, 0) > (iHigh(Symbol(), PERIOD_M15, 1) + (min_gapsizePERIOD_M15 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_M15, 0) != order_time) { ticket = OrderSend(Symbol(), OP_SELL,NR(Lot_Volume()), Bid, 0, 0, iHigh(Symbol(), PERIOD_M15, 1) + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 4, 0, Red); order_time = iTime(Symbol(), PERIOD_M15, 0); Print("I am inside (sell) :-)", order_time); //---- if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_M30==True && (booster) && iOpen(Symbol(), PERIOD_M30, 0) > (iHigh(Symbol(), PERIOD_M30, 1) + (min_gapsizePERIOD_M30 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_M30, 0) != order_time) { ticket = OrderSend(Symbol(), OP_SELL,NR(Lot_Volume()), Bid, 0, 0, iHigh(Symbol(), PERIOD_M30, 1) + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 4, 0, Red); order_time = iTime(Symbol(), PERIOD_M30, 0); Print("I am inside (sell) :-)", order_time); //---- if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_H1==True && (booster)&& iOpen(Symbol(), PERIOD_H1 ,0) > (iHigh(Symbol(), PERIOD_H1, 1) + (min_gapsizePERIOD_H1 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_H1, 0) != order_time) { ticket = OrderSend(Symbol(), OP_SELL,NR(Lot_Volume()), Bid, 0, 0, iHigh(Symbol(), PERIOD_H1, 1) + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 4, 0, Red); order_time = iTime(Symbol(), PERIOD_H1, 0); Print("I am inside (sell) :-)", order_time); //---- if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_H4==True && (booster)&& iOpen(Symbol(), PERIOD_H4, 0) > (iHigh(Symbol(), PERIOD_H4, 1) + (min_gapsizePERIOD_H4 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_H4, 0) != order_time) { ticket = OrderSend(Symbol(), OP_SELL, NR(Lot_Volume()), Bid, 0, 0, iHigh(Symbol(), PERIOD_H4, 1) + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 4, 0, Red); order_time = iTime(Symbol(), PERIOD_H4, 0); Print("I am inside (sell) :-)", order_time); //---- if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } //catching the gap on buy down gap if(PERIOD_M1==True && (booster)&& iOpen(Symbol(), PERIOD_M1, 0) < (iLow(Symbol(), PERIOD_M1, 1) - (min_gapsizePERIOD_M1 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_M1, 0) != order_time) { ticket = OrderSend(Symbol(), OP_BUY, NR(Lot_Volume()), Ask, 0, 0, iLow(Symbol(), PERIOD_M1, 1) - MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 5, 0, Green); order_time = iTime(Symbol(), PERIOD_M1, 0); Print("I am inside (buy) :-)", order_time); if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_M5==True && (booster)&& iOpen(Symbol(), PERIOD_M5, 0) < (iLow(Symbol(), PERIOD_M5, 1) - (min_gapsizePERIOD_M5 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_M5, 0) != order_time) { ticket = OrderSend(Symbol(), OP_BUY, NR(Lot_Volume()), Ask, 0, 0, iLow(Symbol(), PERIOD_M5, 1) - MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 5, 0, Green); order_time = iTime(Symbol(), PERIOD_M5, 0); Print("I am inside (buy) :-)", order_time); if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_M15==True && (booster)&& iOpen(Symbol(), PERIOD_M15, 0) < (iLow(Symbol(), PERIOD_M15, 1) - (min_gapsizePERIOD_M15 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_M15, 0) != order_time) { ticket = OrderSend(Symbol(), OP_BUY, NR(Lot_Volume()), Ask, 0, 0, iLow(Symbol(), PERIOD_M15, 1) - MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 5, 0, Green); order_time = iTime(Symbol(), PERIOD_M15, 0); Print("I am inside (buy) :-)", order_time); if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_M30==True && (booster)&& iOpen(Symbol(), PERIOD_M30, 0) < (iLow(Symbol(), PERIOD_M30, 1) - (min_gapsizePERIOD_M30 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_M30, 0) != order_time) { ticket = OrderSend(Symbol(), OP_BUY,NR(Lot_Volume()) , Ask, 0, 0, iLow(Symbol(), PERIOD_M30, 1) - MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 5, 0, Green); order_time = iTime(Symbol(), PERIOD_M30, 0); Print("I am inside (buy) :-)", order_time); if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_H1==True && (booster)&& iOpen(Symbol(), PERIOD_H1, 0) < (iLow(Symbol(), PERIOD_H1, 1) - (min_gapsizePERIOD_H1 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_H1, 0) != order_time) { ticket = OrderSend(Symbol(), OP_BUY,NR(Lot_Volume()), Ask, 0, 0, iLow(Symbol(), PERIOD_H1, 1) - MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 5, 0, Green); order_time = iTime(Symbol(), PERIOD_H1, 0); Print("I am inside (buy) :-)", order_time); if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } if(PERIOD_H4==True && (booster)&& iOpen(Symbol(), PERIOD_H4, 0) < (iLow(Symbol(), PERIOD_H4, 1) - (min_gapsizePERIOD_H4 + MarketInfo(Symbol(), MODE_SPREAD))*MarketInfo(Symbol(), MODE_POINT)) && iTime(Symbol(), PERIOD_H4, 0) != order_time) { ticket = OrderSend(Symbol(), OP_BUY, NR(Lot_Volume()), Ask, 0, 0, iLow(Symbol(), PERIOD_H4, 1) - MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT), "", 5, 0, Green); order_time = iTime(Symbol(), PERIOD_H4, 0); Print("I am inside (buy) :-)", order_time); if(ticket < 0) { Print("OrderSend failed with error #", GetLastError()); } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ for(int cnt=0;cnt<OrdersTotal();cnt++) { if(OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)==true) if(OrderType()<=OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber ) { if(OrderType()==OP_BUY) { if(TrailingStop>0) { if(Bid-OrderOpenPrice()>MyPoint*TrailingStop) { if(OrderStopLoss()<Bid-MyPoint*TrailingStop) { bool modif1=OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*MyPoint,OrderTakeProfit(),0,Green); return(0); } } } } else { if(TrailingStop>0) { if((OrderOpenPrice()-Ask)>(MyPoint*TrailingStop)) { if((OrderStopLoss()>(Ask+MyPoint*TrailingStop)) || (OrderStopLoss()==0)) { bool modif4=OrderModify(OrderTicket(),OrderOpenPrice(),Ask+MyPoint*TrailingStop,OrderTakeProfit(),0,Red); return(0); } } } } } } return(0); } int TotalOrdersCount() { int result=0; for(int i=0;i<OrdersTotal();i++) { if(OrderSelect(i,SELECT_BY_POS ,MODE_TRADES)==true) if (OrderMagicNumber()==MagicNumber) result++; } return (result); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //Calculates Lot Size based on balance and factor //+------------------------------------------------------------------+ double NR(double thelot) { double maxlots=MarketInfo(Symbol(),MODE_MAXLOT), minilot=MarketInfo(Symbol(),MODE_MINLOT), lstep=MarketInfo(Symbol(),MODE_LOTSTEP); double lots=lstep*NormalizeDouble(thelot/lstep,0); lots=MathMax(MathMin(maxlots,lots),minilot); return (lots); } //+------------------------------------------------------------------+ double Lot_Volume() { lot=AccountBalance() * 0.01 /LotFactor ; return(lot); } //+------------------------------------------------------------------+ //| //+------------------------------------------------------------------+
    lefeuvr3 a joint une image
    chandelier-gaps-booster-corrige-12513