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

PIEDS SUR TERRE TETE DANS LES ETOILES VERSION 2

  • lefeuvr3

    Version atypique ,sur ,plusieurs unités de temps,des etoiles du soir et du matin ,suggérée par les Backtests

    Code
    //+------------------------------------------------------------------+ //| PIEDS SUR TERRE TETE DANS LES ETOILES VERSION 2.mq4 | //| EURUSD DAILY QPG | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "QPG" #property link "https://www.mql5.com" #property version "2.00" //#property strict extern int A0=1; extern int A1=0; extern int A2=3; extern int A3=0; extern string Name_EA = "ENGULFING_VERSION_2"; extern bool Trade_buy = true; extern bool Trade_sell = true; extern int Start_Hour = 1; extern int End_Hour = 23; extern bool Tp_in_Money = true; extern double TP_in_money = 5; extern int TP = 160; extern int SL = 100; extern int Max_order = 10; extern bool min_gap_size=7;//Min gap size in points extern string mm="MONEY MANAGEMENT"; extern bool TrailingStop_ = true; extern int TrailingStop = 20; extern int Magic = 76; double LotSize; //lotsize extern double LotFactor = 40; //lotsize factor extern int MagicNumber=28092018; //magic double lot; double slb,tpb,sls,tps,pt; int ras,wt,wk,ticketb,tickets; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- if(Digits==3 || Digits==5) pt=10*Point; else pt=Point; //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { if(TrailingStop_)dtrailing(); if(Tp_in_Money && TP_in_money<=money()) closeall(); //---- int signal; if(PERIOD_M1==True &&iOpen(NULL,PERIOD_M1,A0)>iClose(NULL,PERIOD_M1,A0)&&iClose(NULL,PERIOD_M1,A0)>iOpen(NULL,PERIOD_M1,A1)&&iOpen(NULL,PERIOD_M1,A0)>iClose(NULL,PERIOD_M1,A1)&&iOpen(NULL,PERIOD_M1,A2)<iOpen(NULL,PERIOD_M1 ,A3)&&iOpen(NULL,PERIOD_M1 ,A2)<iClose(NULL,PERIOD_M1 ,A3)&&iClose(NULL,PERIOD_M1,A2)<iOpen(NULL,PERIOD_M1 ,A3)&&iClose(NULL,PERIOD_M1 ,A2)<iClose(NULL,PERIOD_M1 ,A3)&&iOpen(NULL,PERIOD_M1 ,A3)<iClose(NULL,PERIOD_M1 ,A3)//Star ||PERIOD_M1==True &&iOpen(NULL,PERIOD_M1,A0)>iClose(NULL,PERIOD_M1,A0)&&iOpen(NULL,PERIOD_M1,A0)>iOpen(NULL,PERIOD_M1,A1)&&iClose(NULL,PERIOD_M1,A0)>iOpen(NULL,PERIOD_M1,A1)&&iClose(NULL,PERIOD_M1,A0)>iClose(NULL,PERIOD_M1,A1)-min_gap_size*Point&&iOpen(NULL,PERIOD_M1 ,A2)<iOpen(NULL,PERIOD_M1 ,A3)&&iOpen(NULL,PERIOD_M1 ,A2)<iClose(NULL,PERIOD_M1 ,A3)&&iClose(NULL,PERIOD_M1 ,A2)<iOpen(NULL,PERIOD_M1 ,A3)&&iClose(NULL,PERIOD_M1 ,A2)<iClose(NULL,PERIOD_M1 ,A3)&&iOpen(NULL,PERIOD_M1 ,A3)<iClose(NULL,PERIOD_M1 ,A3)&&iClose(NULL,PERIOD_M1,A1)<iOpen(NULL,PERIOD_M1,A1)//Star ||PERIOD_M5==True &&iOpen(NULL,PERIOD_M5,A0)>iClose(NULL,PERIOD_M5,A0)&&iClose(NULL,PERIOD_M5,A0)>iOpen(NULL,PERIOD_M5,A1)&&iOpen(NULL,PERIOD_M5,A0)>iClose(NULL,PERIOD_M5,A1)&&iOpen(NULL,PERIOD_M5,A2)<iOpen(NULL,PERIOD_M5 ,A3)&&iOpen(NULL,PERIOD_M5 ,A2)<iClose(NULL,PERIOD_M5 ,A3)&&iClose(NULL,PERIOD_M5,A2)<iOpen(NULL,PERIOD_M5 ,A3)&&iClose(NULL,PERIOD_M5 ,A2)<iClose(NULL,PERIOD_M5 ,A3)&&iOpen(NULL,PERIOD_M5 ,A3)<iClose(NULL,PERIOD_M5 ,A3)//Star ||PERIOD_M5==True &&iOpen(NULL,PERIOD_M5,A0)>iClose(NULL,PERIOD_M5,A0)&&iOpen(NULL,PERIOD_M5,A0)>iOpen(NULL,PERIOD_M5,A1)&&iClose(NULL,PERIOD_M5,A0)>iOpen(NULL,PERIOD_M5,A1)&&iClose(NULL,PERIOD_M5,A0)>iClose(NULL,PERIOD_M5,A1)-min_gap_size*Point&&iOpen(NULL,PERIOD_M5 ,A2)<iOpen(NULL,PERIOD_M5 ,A3)&&iOpen(NULL,PERIOD_M5 ,A2)<iClose(NULL,PERIOD_M5 ,A3)&&iClose(NULL,PERIOD_M5 ,A2)<iOpen(NULL,PERIOD_M5 ,A3)&&iClose(NULL,PERIOD_M5 ,A2)<iClose(NULL,PERIOD_M5 ,A3)&&iOpen(NULL,PERIOD_M5 ,A3)<iClose(NULL,PERIOD_M5 ,A3)&&iClose(NULL,PERIOD_M5,A1)<iOpen(NULL,PERIOD_M5,A1)//Star ||PERIOD_M15==True &&iOpen(NULL,PERIOD_M15,A0)>iClose(NULL,PERIOD_M15,A0)&&iClose(NULL,PERIOD_M15,A0)>iOpen(NULL,PERIOD_M15,A1)&&iOpen(NULL,PERIOD_M15,A0)>iClose(NULL,PERIOD_M15,A1)&&iOpen(NULL,PERIOD_M15,A2)<iOpen(NULL,PERIOD_M15 ,A3)&&iOpen(NULL,PERIOD_M15 ,A2)<iClose(NULL,PERIOD_M15 ,A3)&&iClose(NULL,PERIOD_M15,A2)<iOpen(NULL,PERIOD_M15 ,A3)&&iClose(NULL,PERIOD_M15 ,A2)<iClose(NULL,PERIOD_M15 ,A3)&&iOpen(NULL,PERIOD_M15 ,A3)<iClose(NULL,PERIOD_M15 ,A3)//Star ||PERIOD_M15==True &&iOpen(NULL,PERIOD_M15,A0)>iClose(NULL,PERIOD_M15,A0)&&iOpen(NULL,PERIOD_M15,A0)>iOpen(NULL,PERIOD_M15,A1)&&iClose(NULL,PERIOD_M15,A0)>iOpen(NULL,PERIOD_M15,A1)&&iClose(NULL,PERIOD_M15,A0)>iClose(NULL,PERIOD_M15,A1)-min_gap_size*Point&&iOpen(NULL,PERIOD_M15 ,A2)<iOpen(NULL,PERIOD_M15 ,A3)&&iOpen(NULL,PERIOD_M15 ,A2)<iClose(NULL,PERIOD_M15 ,A3)&&iClose(NULL,PERIOD_M15 ,A2)<iOpen(NULL,PERIOD_M15 ,A3)&&iClose(NULL,PERIOD_M15 ,A2)<iClose(NULL,PERIOD_M15 ,A3)&&iOpen(NULL,PERIOD_M15 ,A3)<iClose(NULL,PERIOD_M15 ,A3)&&iClose(NULL,PERIOD_M15,A1)<iOpen(NULL,PERIOD_M15,A1)//Star ||PERIOD_M30==True &&iOpen(NULL,PERIOD_M30,A0)>iClose(NULL,PERIOD_M30,A0)&&iClose(NULL,PERIOD_M30,A0)>iOpen(NULL,PERIOD_M30,A1)&&iOpen(NULL,PERIOD_M30,A0)>iClose(NULL,PERIOD_M30,A1)&&iOpen(NULL,PERIOD_M30,A2)<iOpen(NULL,PERIOD_M30 ,A3)&&iOpen(NULL,PERIOD_M30 ,A2)<iClose(NULL,PERIOD_M30 ,A3)&&iClose(NULL,PERIOD_M30,A2)<iOpen(NULL,PERIOD_M30 ,A3)&&iClose(NULL,PERIOD_M30 ,A2)<iClose(NULL,PERIOD_M30 ,A3)&&iOpen(NULL,PERIOD_M30 ,A3)<iClose(NULL,PERIOD_M30 ,A3)//Star ||PERIOD_M30==True &&iOpen(NULL,PERIOD_M30,A0)>iClose(NULL,PERIOD_M30,A0)&&iOpen(NULL,PERIOD_M30,A0)>iOpen(NULL,PERIOD_M30,A1)&&iClose(NULL,PERIOD_M30,A0)>iOpen(NULL,PERIOD_M30,A1)&&iClose(NULL,PERIOD_M30,A0)>iClose(NULL,PERIOD_M30,A1)-min_gap_size*Point&&iOpen(NULL,PERIOD_M30 ,A2)<iOpen(NULL,PERIOD_M30 ,A3)&&iOpen(NULL,PERIOD_M30 ,A2)<iClose(NULL,PERIOD_M30 ,A3)&&iClose(NULL,PERIOD_M30 ,A2)<iOpen(NULL,PERIOD_M30 ,A3)&&iClose(NULL,PERIOD_M30 ,A2)<iClose(NULL,PERIOD_M30 ,A3)&&iOpen(NULL,PERIOD_M30 ,A3)<iClose(NULL,PERIOD_M30 ,A3)&&iClose(NULL,PERIOD_M30,A1)<iOpen(NULL,PERIOD_M30,A1)//Star ||PERIOD_H1==True &&iOpen(NULL,PERIOD_H1,A0)>iClose(NULL,PERIOD_H1,A0)&&iClose(NULL,PERIOD_H1,A0)>iOpen(NULL,PERIOD_H1,A1)&&iOpen(NULL,PERIOD_H1,A0)>iClose(NULL,PERIOD_H1,A1)&&iOpen(NULL,PERIOD_H1,A2)<iOpen(NULL,PERIOD_H1 ,A3)&&iOpen(NULL,PERIOD_H1 ,A2)<iClose(NULL,PERIOD_H1 ,A3)&&iClose(NULL,PERIOD_H1,A2)<iOpen(NULL,PERIOD_H1 ,A3)&&iClose(NULL,PERIOD_H1 ,A2)<iClose(NULL,PERIOD_H1 ,A3)&&iOpen(NULL,PERIOD_H1 ,A3)<iClose(NULL,PERIOD_H1 ,A3)//Star ||PERIOD_H1==True &&iOpen(NULL,PERIOD_H1,A0)>iClose(NULL,PERIOD_H1,A0)&&iOpen(NULL,PERIOD_H1,A0)>iOpen(NULL,PERIOD_H1,A1)&&iClose(NULL,PERIOD_H1,A0)>iOpen(NULL,PERIOD_H1,A1)&&iClose(NULL,PERIOD_H1,A0)>iClose(NULL,PERIOD_H1,A1)-min_gap_size*Point&&iOpen(NULL,PERIOD_H1 ,A2)<iOpen(NULL,PERIOD_H1 ,A3)&&iOpen(NULL,PERIOD_H1 ,A2)<iClose(NULL,PERIOD_H1 ,A3)&&iClose(NULL,PERIOD_H1 ,A2)<iOpen(NULL,PERIOD_H1 ,A3)&&iClose(NULL,PERIOD_H1 ,A2)<iClose(NULL,PERIOD_H1 ,A3)&&iOpen(NULL,PERIOD_H1 ,A3)<iClose(NULL,PERIOD_H1 ,A3)&&iClose(NULL,PERIOD_H1,A1)<iOpen(NULL,PERIOD_H1,A1)//Star ||PERIOD_H4==True &&iOpen(NULL,PERIOD_H4,A0)>iClose(NULL,PERIOD_H4,A0)&&iClose(NULL,PERIOD_H4,A0)>iOpen(NULL,PERIOD_H4,A1)&&iOpen(NULL,PERIOD_H4,A0)>iClose(NULL,PERIOD_H4,A1)&&iOpen(NULL,PERIOD_H4,A2)<iOpen(NULL,PERIOD_H4 ,A3)&&iOpen(NULL,PERIOD_H4 ,A2)<iClose(NULL,PERIOD_H4 ,A3)&&iClose(NULL,PERIOD_H4,A2)<iOpen(NULL,PERIOD_H4 ,A3)&&iClose(NULL,PERIOD_H4 ,A2)<iClose(NULL,PERIOD_H4 ,A3)&&iOpen(NULL,PERIOD_H4 ,A3)<iClose(NULL,PERIOD_H4 ,A3)//Star ||PERIOD_H4==True &&iOpen(NULL,PERIOD_H4,A0)>iClose(NULL,PERIOD_H4,A0)&&iOpen(NULL,PERIOD_H4,A0)>iOpen(NULL,PERIOD_H4,A1)&&iClose(NULL,PERIOD_H4,A0)>iOpen(NULL,PERIOD_H4,A1)&&iClose(NULL,PERIOD_H4,A0)>iClose(NULL,PERIOD_H4,A1)-min_gap_size*Point&&iOpen(NULL,PERIOD_H4 ,A2)<iOpen(NULL,PERIOD_H4 ,A3)&&iOpen(NULL,PERIOD_H4 ,A2)<iClose(NULL,PERIOD_H4 ,A3)&&iClose(NULL,PERIOD_H4 ,A2)<iOpen(NULL,PERIOD_H4 ,A3)&&iClose(NULL,PERIOD_H4 ,A2)<iClose(NULL,PERIOD_H4 ,A3)&&iOpen(NULL,PERIOD_H4 ,A3)<iClose(NULL,PERIOD_H4 ,A3)&&iClose(NULL,PERIOD_H4,A1)<iOpen(NULL,PERIOD_H4,A1)//Star ||PERIOD_D1==True &&iOpen(NULL,PERIOD_D1,A0)>iClose(NULL,PERIOD_D1,A0)&&iClose(NULL,PERIOD_D1,A0)>iOpen(NULL,PERIOD_D1,A1)&&iOpen(NULL,PERIOD_D1,A0)>iClose(NULL,PERIOD_D1,A1)&&iOpen(NULL,PERIOD_D1,A2)<iOpen(NULL,PERIOD_D1 ,A3)&&iOpen(NULL,PERIOD_D1 ,A2)<iClose(NULL,PERIOD_D1 ,A3)&&iClose(NULL,PERIOD_D1,A2)<iOpen(NULL,PERIOD_D1 ,A3)&&iClose(NULL,PERIOD_D1 ,A2)<iClose(NULL,PERIOD_D1 ,A3)&&iOpen(NULL,PERIOD_D1 ,A3)<iClose(NULL,PERIOD_D1 ,A3)//Star ||PERIOD_D1==True &&iOpen(NULL,PERIOD_D1,A0)>iClose(NULL,PERIOD_D1,A0)&&iOpen(NULL,PERIOD_D1,A0)>iOpen(NULL,PERIOD_D1,A1)&&iClose(NULL,PERIOD_D1,A0)>iOpen(NULL,PERIOD_D1,A1)&&iClose(NULL,PERIOD_D1,A0)>iClose(NULL,PERIOD_D1,A1)-min_gap_size*Point&&iOpen(NULL,PERIOD_D1 ,A2)<iOpen(NULL,PERIOD_D1 ,A3)&&iOpen(NULL,PERIOD_D1 ,A2)<iClose(NULL,PERIOD_D1 ,A3)&&iClose(NULL,PERIOD_D1 ,A2)<iOpen(NULL,PERIOD_D1 ,A3)&&iClose(NULL,PERIOD_D1 ,A2)<iClose(NULL,PERIOD_D1 ,A3)&&iOpen(NULL,PERIOD_D1 ,A3)<iClose(NULL,PERIOD_D1 ,A3)&&iClose(NULL,PERIOD_D1,A1)<iOpen(NULL,PERIOD_D1,A1))signal=1;//Star signal=1; // Here is your open buy rule signal=1;// open buy //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ if(PERIOD_M1==True &&iOpen(NULL,PERIOD_M1,A0)<iClose(NULL,PERIOD_M1,A0)&&iClose(NULL,PERIOD_M1,A0)<iOpen(NULL,PERIOD_M1,A1)&&iOpen(NULL,PERIOD_M1,A0)<iClose(NULL,PERIOD_M1,A1)&&iOpen(NULL,PERIOD_M1,A2)>iOpen(NULL,PERIOD_M1 ,A3)&&iOpen(NULL,PERIOD_M1 ,A2)>iClose(NULL,PERIOD_M1 ,A3)&&iClose(NULL,PERIOD_M1 ,A2)>iOpen(NULL,PERIOD_M1 ,A3)&&iClose(NULL,PERIOD_M1 ,A2)>iClose(NULL,PERIOD_M1 ,A3)&&iOpen(NULL,PERIOD_M1 ,A3)>iClose(NULL,PERIOD_M1 ,3)//Star ||PERIOD_M1==True &&iOpen(NULL,PERIOD_M1,A0)<iClose(NULL,PERIOD_M1,A0)&&iOpen(NULL,PERIOD_M1,A0)<iOpen(NULL,PERIOD_M1,A1)&&iClose(NULL,PERIOD_M1,A0)<iOpen(NULL,PERIOD_M1,A1)&&iClose(NULL,PERIOD_M1,A0)<iClose(NULL,PERIOD_M1,A1)+min_gap_size*Point&&iOpen(NULL,PERIOD_M1 ,A2)>iOpen(NULL,PERIOD_M1 ,A3)&&iOpen(NULL,PERIOD_M1 ,A2)>iClose(NULL,PERIOD_M1 ,A3)&&iClose(NULL,PERIOD_M1 ,A2)>iOpen(NULL,PERIOD_M1 ,A3)&&iClose(NULL,PERIOD_M1 ,A2)>iClose(NULL,PERIOD_M1 ,A3)&&iOpen(NULL,PERIOD_M1 ,A3)>iClose(NULL,PERIOD_M1 ,A3)&&iClose(NULL,PERIOD_M1,A1)>iOpen(NULL,PERIOD_M1,A1)//Star ||PERIOD_M5==True &&iOpen(NULL,PERIOD_M5,A0)<iClose(NULL,PERIOD_M5,A0)&&iClose(NULL,PERIOD_M5,A0)<iOpen(NULL,PERIOD_M5,A1)&&iOpen(NULL,PERIOD_M5,A0)<iClose(NULL,PERIOD_M5,A1)&&iOpen(NULL,PERIOD_M5,A2)>iOpen(NULL,PERIOD_M5 ,A3)&&iOpen(NULL,PERIOD_M5 ,A2)>iClose(NULL,PERIOD_M5 ,A3)&&iClose(NULL,PERIOD_M5 ,A2)>iOpen(NULL,PERIOD_M5 ,A3)&&iClose(NULL,PERIOD_M5 ,A2)>iClose(NULL,PERIOD_M5 ,A3)&&iOpen(NULL,PERIOD_M5 ,A3)>iClose(NULL,PERIOD_M5 ,A3)//Star ||PERIOD_M5==True &&iOpen(NULL,PERIOD_M5,A0)<iClose(NULL,PERIOD_M5,A0)&&iOpen(NULL,PERIOD_M5,A0)<iOpen(NULL,PERIOD_M5,A1)&&iClose(NULL,PERIOD_M5,A0)<iOpen(NULL,PERIOD_M5,A1)&&iClose(NULL,PERIOD_M5,A0)<iClose(NULL,PERIOD_M5,A1)+min_gap_size*Point&&iOpen(NULL,PERIOD_M5 ,A2)>iOpen(NULL,PERIOD_M5 ,A3)&&iOpen(NULL,PERIOD_M5 ,A2)>iClose(NULL,PERIOD_M5 ,A3)&&iClose(NULL,PERIOD_M5 ,A2)>iOpen(NULL,PERIOD_M5 ,A3)&&iClose(NULL,PERIOD_M5 ,A2)>iClose(NULL,PERIOD_M5 ,A3)&&iOpen(NULL,PERIOD_M5 ,A3)>iClose(NULL,PERIOD_M5 ,A3)&&iClose(NULL,PERIOD_M5,A1)>iOpen(NULL,PERIOD_M5,A1)//Star ||PERIOD_M15==True &&iOpen(NULL,PERIOD_M15,A0)<iClose(NULL,PERIOD_M15,A0)&&iClose(NULL,PERIOD_M15,A0)<iOpen(NULL,PERIOD_M15,A1)&&iOpen(NULL,PERIOD_M15,A0)<iClose(NULL,PERIOD_M15,A1)&&iOpen(NULL,PERIOD_M15,A2)>iOpen(NULL,PERIOD_M15 ,A3)&&iOpen(NULL,PERIOD_M15 ,A2)>iClose(NULL,PERIOD_M15 ,A3)&&iClose(NULL,PERIOD_M15 ,A2)>iOpen(NULL,PERIOD_M15 ,A3)&&iClose(NULL,PERIOD_M15 ,A2)>iClose(NULL,PERIOD_M15 ,A3)&&iOpen(NULL,PERIOD_M15 ,A3)>iClose(NULL,PERIOD_M15 ,A3)//Star ||PERIOD_M15==True &&iOpen(NULL,PERIOD_M15,A0)<iClose(NULL,PERIOD_M15,A0)&&iOpen(NULL,PERIOD_M15,A0)<iOpen(NULL,PERIOD_M15,A1)&&iClose(NULL,PERIOD_M15,A0)<iOpen(NULL,PERIOD_M15,A1)&&iClose(NULL,PERIOD_M15,A0)<iClose(NULL,PERIOD_M15,A1)+min_gap_size*Point&&iOpen(NULL,PERIOD_M15 ,A2)>iOpen(NULL,PERIOD_M15 ,A3)&&iOpen(NULL,PERIOD_M15 ,A2)>iClose(NULL,PERIOD_M15 ,A3)&&iClose(NULL,PERIOD_M15 ,A2)>iOpen(NULL,PERIOD_M15 ,A3)&&iClose(NULL,PERIOD_M15 ,A2)>iClose(NULL,PERIOD_M15 ,A3)&&iOpen(NULL,PERIOD_M15 ,A3)>iClose(NULL,PERIOD_M15 ,A3)&&iClose(NULL,PERIOD_M15,A1)>iOpen(NULL,PERIOD_M15,A1)//Star ||PERIOD_M30==True &&iOpen(NULL,PERIOD_M30,A0)<iClose(NULL,PERIOD_M30,A0)&&iClose(NULL,PERIOD_M30,A0)<iOpen(NULL,PERIOD_M30,A1)&&iOpen(NULL,PERIOD_M30,A0)<iClose(NULL,PERIOD_M30,A1)&&iOpen(NULL,PERIOD_M30,A2)>iOpen(NULL,PERIOD_M30 ,A3)&&iOpen(NULL,PERIOD_M30 ,A2)>iClose(NULL,PERIOD_M30 ,A3)&&iClose(NULL,PERIOD_M30 ,A2)>iOpen(NULL,PERIOD_M30 ,A3)&&iClose(NULL,PERIOD_M30 ,A2)>iClose(NULL,PERIOD_M30 ,A3)&&iOpen(NULL,PERIOD_M30 ,A3)>iClose(NULL,PERIOD_M30 ,A3)//Star ||PERIOD_M30==True &&iOpen(NULL,PERIOD_M30,A0)<iClose(NULL,PERIOD_M30,A0)&&iOpen(NULL,PERIOD_M30,A0)<iOpen(NULL,PERIOD_M30,A1)&&iClose(NULL,PERIOD_M30,A0)<iOpen(NULL,PERIOD_M30,A1)&&iClose(NULL,PERIOD_M30,A0)<iClose(NULL,PERIOD_M30,A1)+min_gap_size*Point&&iOpen(NULL,PERIOD_M30 ,A2)>iOpen(NULL,PERIOD_M30 ,A3)&&iOpen(NULL,PERIOD_M30 ,A2)>iClose(NULL,PERIOD_M30 ,A3)&&iClose(NULL,PERIOD_M30 ,A2)>iOpen(NULL,PERIOD_M30 ,A3)&&iClose(NULL,PERIOD_M30 ,A2)>iClose(NULL,PERIOD_M30 ,A3)&&iOpen(NULL,PERIOD_M30 ,A3)>iClose(NULL,PERIOD_M30 ,A3)&&iClose(NULL,PERIOD_M30,A1)>iOpen(NULL,PERIOD_M30,A1)//Star ||PERIOD_H1==True &&iOpen(NULL,PERIOD_H1,A0)<iClose(NULL,PERIOD_H1,A0)&&iClose(NULL,PERIOD_H1,A0)<iOpen(NULL,PERIOD_H1,A1)&&iOpen(NULL,PERIOD_H1,A0)<iClose(NULL,PERIOD_H1,A1)&&iOpen(NULL,PERIOD_H1,A2)>iOpen(NULL,PERIOD_H1 ,A3)&&iOpen(NULL,PERIOD_H1 ,A2)>iClose(NULL,PERIOD_H1 ,A3)&&iClose(NULL,PERIOD_H1 ,A2)>iOpen(NULL,PERIOD_H1 ,A3)&&iClose(NULL,PERIOD_H1 ,A2)>iClose(NULL,PERIOD_H1 ,A3)&&iOpen(NULL,PERIOD_H1 ,A3)>iClose(NULL,PERIOD_H1 ,A3)//Star ||PERIOD_H1==True &&iOpen(NULL,PERIOD_H1,A0)<iClose(NULL,PERIOD_H1,A0)&&iOpen(NULL,PERIOD_H1,A0)<iOpen(NULL,PERIOD_H1,A1)&&iClose(NULL,PERIOD_H1,A0)<iOpen(NULL,PERIOD_H1,A1)&&iClose(NULL,PERIOD_H1,A0)<iClose(NULL,PERIOD_H1,A1)+min_gap_size*Point&&iOpen(NULL,PERIOD_H1 ,A2)>iOpen(NULL,PERIOD_H1 ,A3)&&iOpen(NULL,PERIOD_H1 ,A2)>iClose(NULL,PERIOD_H1 ,A3)&&iClose(NULL,PERIOD_H1 ,A2)>iOpen(NULL,PERIOD_H1 ,A3)&&iClose(NULL,PERIOD_H1 ,A2)>iClose(NULL,PERIOD_H1 ,A3)&&iOpen(NULL,PERIOD_H1 ,A3)>iClose(NULL,PERIOD_H1 ,A3)&&iClose(NULL,PERIOD_H1,A1)>iOpen(NULL,PERIOD_H1,A1)//Star ||PERIOD_H4==True &&iOpen(NULL,PERIOD_H4,A0)<iClose(NULL,PERIOD_H4,A0)&&iClose(NULL,PERIOD_H4,A0)<iOpen(NULL,PERIOD_H4,A1)&&iOpen(NULL,PERIOD_H4,A0)<iClose(NULL,PERIOD_H4,A1)&&iOpen(NULL,PERIOD_H4,A2)>iOpen(NULL,PERIOD_H4 ,A3)&&iOpen(NULL,PERIOD_H4 ,A2)>iClose(NULL,PERIOD_H4 ,A3)&&iClose(NULL,PERIOD_H4 ,A2)>iOpen(NULL,PERIOD_H4 ,A3)&&iClose(NULL,PERIOD_H4 ,A2)>iClose(NULL,PERIOD_H4 ,A3)&&iOpen(NULL,PERIOD_H4 ,A3)>iClose(NULL,PERIOD_H4 ,A3)//Star ||PERIOD_H4==True &&iOpen(NULL,PERIOD_H4,A0)<iClose(NULL,PERIOD_H4,A0)&&iOpen(NULL,PERIOD_H4,A0)<iOpen(NULL,PERIOD_H4,A1)&&iClose(NULL,PERIOD_H4,A0)<iOpen(NULL,PERIOD_H4,A1)&&iClose(NULL,PERIOD_H4,A0)<iClose(NULL,PERIOD_H4,A1)+min_gap_size*Point&&iOpen(NULL,PERIOD_H4 ,A2)>iOpen(NULL,PERIOD_H4 ,A3)&&iOpen(NULL,PERIOD_H4 ,A2)>iClose(NULL,PERIOD_H4 ,A3)&&iClose(NULL,PERIOD_H4 ,A2)>iOpen(NULL,PERIOD_H4 ,A3)&&iClose(NULL,PERIOD_H4 ,A2)>iClose(NULL,PERIOD_H4 ,A3)&&iOpen(NULL,PERIOD_H4 ,A3)>iClose(NULL,PERIOD_H4 ,A3)&&iClose(NULL,PERIOD_H4,A1)>iOpen(NULL,PERIOD_H4,A1)//Star ||PERIOD_D1==True &&iOpen(NULL,PERIOD_D1,A0)<iClose(NULL,PERIOD_D1,A0)&&iClose(NULL,PERIOD_D1,A0)<iOpen(NULL,PERIOD_D1,A1)&&iOpen(NULL,PERIOD_D1,A0)<iClose(NULL,PERIOD_D1,A1)&&iOpen(NULL,PERIOD_D1,A2)>iOpen(NULL,PERIOD_D1 ,A3)&&iOpen(NULL,PERIOD_D1 ,A2)>iClose(NULL,PERIOD_D1 ,A3)&&iClose(NULL,PERIOD_D1 ,A2)>iOpen(NULL,PERIOD_D1 ,A3)&&iClose(NULL,PERIOD_D1 ,A2)>iClose(NULL,PERIOD_D1 ,A3)&&iOpen(NULL,PERIOD_D1 ,A3)>iClose(NULL,PERIOD_D1 ,A3)//Star ||PERIOD_D1==True &&iOpen(NULL,PERIOD_D1,A0)<iClose(NULL,PERIOD_D1,A0)&&iOpen(NULL,PERIOD_D1,A0)<iOpen(NULL,PERIOD_D1,A1)&&iClose(NULL,PERIOD_D1,A0)<iOpen(NULL,PERIOD_D1,A1)&&iClose(NULL,PERIOD_D1,A0)<iClose(NULL,PERIOD_D1,A1)+min_gap_size*Point&&iOpen(NULL,PERIOD_D1 ,A2)>iOpen(NULL,PERIOD_D1 ,A3)&&iOpen(NULL,PERIOD_D1 ,A2)>iClose(NULL,PERIOD_D1 ,A3)&&iClose(NULL,PERIOD_D1 ,A2)>iOpen(NULL,PERIOD_D1 ,A3)&&iClose(NULL,PERIOD_D1 ,A2)>iClose(NULL,PERIOD_D1 ,A3)&&iOpen(NULL,PERIOD_D1 ,A3)>iClose(NULL,PERIOD_D1 ,A3)&&iClose(NULL,PERIOD_D1,A1)>iOpen(NULL,PERIOD_D1,A1))signal=2;//signal=2; // Here is your open Sell rule signal=2;// open sell if(Hour_trade()==1) { if(SL==0)slb=0;else slb=Ask-SL*pt; if(SL==0)sls=0;else sls=Bid+SL*pt; if(TP==0)tpb=0;else tpb=Ask+TP*pt; if(TP==0)tps=0;else tps=Bid-TP*pt; if(totalorder(0)<Max_order && CheckMoneyForTrade(Symbol(), NR(Lot_Volume()), OP_BUY)==True && Trade_buy && signal==1 && wt!=Time[0]) { ticketb=OrderSend(Symbol(),OP_BUY,NR(Lot_Volume()),Ask,3,slb,tpb,Name_EA,Magic,0,Blue); if(ticketb>0) wt=Time[0]; } if(totalorder(1)<Max_order && CheckMoneyForTrade(Symbol(), NR(Lot_Volume()), OP_SELL)==True && Trade_sell && signal==2 && wk!=Time[0]) { tickets=OrderSend(Symbol(),OP_SELL,NR(Lot_Volume()),Bid,3,sls,tps,Name_EA,Magic,0,Red); if(tickets>0) wk=Time[0]; } } //---- return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int Hour_trade() { bool trade=false; if(Start_Hour>End_Hour) { if(Hour()>=Start_Hour || Hour()<End_Hour) trade=true; } else if(Hour()>=Start_Hour && Hour()<End_Hour) trade=true; return (trade); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int totalorder(int tipe) { int total=0; for(int i=0; i<OrdersTotal(); i++) { if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue; if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=Magic || OrderType()!=tipe) continue; total++; } return(total); } //+------------------------------------------------------------------+ //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); } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void dtrailing() { int i,r;double tpn; for(i=0; i<OrdersTotal(); i++) { if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue; if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=Magic) continue; tpn=OrderTakeProfit(); if(OrderType()==OP_BUY) { if(Bid-OrderOpenPrice()>pt*TrailingStop) { if((OrderStopLoss()<Bid-pt*TrailingStop) || (OrderStopLoss()==0)) { if(tpn) r=OrderModify(OrderTicket(),OrderOpenPrice(),Bid-pt*TrailingStop,OrderTakeProfit(),0,Green); } } } if(OrderType()==OP_SELL) { if((OrderOpenPrice()-Ask)>(pt*TrailingStop)) { if(OrderStopLoss()>(Ask+pt*TrailingStop) || (OrderStopLoss()==0)) { if(tpn) r=OrderModify(OrderTicket(),OrderOpenPrice(),Ask+pt*TrailingStop,OrderTakeProfit(),0,Red); } } } } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void closeall() { for(int i=OrdersTotal()-1; i>=0; i--) { if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue; if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=Magic) continue; if(OrderType()>1) ras=OrderDelete(OrderTicket()); else { if(OrderType()==0) ras=OrderClose(OrderTicket(),OrderLots(),Bid,3,CLR_NONE); else ras=OrderClose(OrderTicket(),OrderLots(),Ask,3,CLR_NONE); } } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double money() { double dp=0; int i; for(i=0; i<OrdersTotal(); i++) { if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue; if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=Magic) continue; dp+=OrderProfit(); } return(dp); } //+------------------------------------------------------------------+ bool CheckMoneyForTrade(string symb,double lots,int type) { double free_margin=AccountFreeMarginCheck(symb,type, lots); //-- if there is not enough money if(free_margin<0) { string oper=(type==OP_BUY)? "Buy":"Sell"; //fPrint("Not enough money for ", oper," ",lots, " ", symb, " Error code=",GetLastError()); return(false); } //--- checking successful return(true); }
    Modifié le 2018-09-28 11:16:11 par lefeuvr3
    lefeuvr3 a joint une image
    pieds-sur-terre-tete-dans-les-etoiles-version-2-11018