//+------------------------------------------------------------------+ //| M.1.30_bod501-EA.mq4 | //| hassan.mb@hotmail.com | //| kira-h | //+-------------------DO NOT REMOVE THIS HEADER----------------------+ #property copyright "Copyright © 2015, Programmed by kira-h" #property link "hassan.mb@hotmail.com" #property version "1.00" //+------------------------------------------------------------------+ //| Exported variables | //+------------------------------------------------------------------+ input int MagicNo=2015; input string orders="buy=1 & sell=0 "; input int order1=1, order2=1, order3=1, order4=1, order5=1, order6=1, order7=1, order8=1, order9=1, order10=1, order11=1, order12=1, order13=1, order14=1, order15=1, order16=1, order17=1, order18=1, order19=1, order20=1, order21=1, order22=1, order23=1, order24=1, order25=1, order26=1, order27=1, order28=1, order29=1, order30=1; input string o1=""; input double Lots_1=0.01, TakePtofit1=12, StopLoss1=10; input string o2=""; input double Lots_2=0.01, TakePtofit2=12, StopLoss2=10; input string o3=""; input double Lots_3=0.01, TakePtofit3=12, StopLoss3=10; input string o4=""; input double Lots_4=0.01, TakePtofit4=12, StopLoss4=10; input string o5=""; input double Lots_5=0.01, TakePtofit5=12, StopLoss5=10; input string o6=""; input double Lots_6=0.01, TakePtofit6=12, StopLoss6=10; input string o7=""; input double Lots_7=0.01, TakePtofit7=12, StopLoss7=10; input string o8=""; input double Lots_8=0.01, TakePtofit8=12, StopLoss8=10; input string o9=""; input double Lots_9=0.01, TakePtofit9=12, StopLoss9=10; input string o10=""; input double Lots_10=0.01, TakePtofit10=12, StopLoss10=10; input string o11=""; input double Lots_11=0.01, TakePtofit11=12, StopLoss11=10; input string o12=""; input double Lots_12=0.01, TakePtofit12=12, StopLoss12=10; input string o13=""; input double Lots_13=0.01, TakePtofit13=12, StopLoss13=10; input string o14=""; input double Lots_14=0.14, TakePtofit14=12, StopLoss14=10; input string o15=""; input double Lots_15=0.15, TakePtofit15=12, StopLoss15=10; input string o16=""; input double Lots_16=0.16, TakePtofit16=12, StopLoss16=10; input string o17=""; input double Lots_17=0.17, TakePtofit17=12, StopLoss17=10; input string o18=""; input double Lots_18=0.31, TakePtofit18=12, StopLoss18=10; input string o19=""; input double Lots_19=0.19, TakePtofit19=12, StopLoss19=10; input string o20=""; input double Lots_20=0.20, TakePtofit20=12, StopLoss20=10; input string o21=""; input double Lots_21=0.21, TakePtofit21=12, StopLoss21=10; input string o22=""; input double Lots_22=0.22, TakePtofit22=12, StopLoss22=10; input string o23=""; input double Lots_23=0.23, TakePtofit23=12, StopLoss23=10; input string o24=""; input double Lots_24=0.24, TakePtofit24=12, StopLoss24=10; input string o25=""; input double Lots_25=0.25, TakePtofit25=12, StopLoss25=10; input string o26=""; input double Lots_26=0.26, TakePtofit26=12, StopLoss26=10; input string o27=""; input double Lots_27=0.27, TakePtofit27=12, StopLoss27=10; input string o28=""; input double Lots_28=0.28, TakePtofit28=12, StopLoss28=10; input string o29=""; input double Lots_29=0.29, TakePtofit29=12, StopLoss29=10; input string o30=""; input double Lots_30=0.30, TakePtofit30=12, StopLoss30=10; //+------------------------------------------------------------------+ //| Local variables | //+------------------------------------------------------------------+ double point; int digits,Q; double chain0[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30}; double chain1[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30}; double chain2[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30}; double chain3[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30}; //+------------------------------------------------------------------+ //| Expert init | //+------------------------------------------------------------------+ int OnInit() { if(_Digits==5||_Digits==3)Q=30; else Q=1; if(_Digits<4){point=0.01;digits=2;} else{point=0.0001;digits=4;} PrintInfoToChart(); return(0); } //+------------------------------------------------------------------+ //| Expert deinit | //+------------------------------------------------------------------+ void OnDeinit(const int reason){Comment("");} //+------------------------------------------------------------------+ //| Expert fonctions | //+------------------------------------------------------------------+ //+------------------Info Chart void PrintInfoToChart() { string temp=" M.1.8_bod501-EA\nIdea by bod501\nProgrammed by Kira-h\nMail: hassan.mb@hotmail.com\nSkype: hassan.moussebbih\nSponsored by forexprog.com/\nForum: forexprog.com/vb/showthread.php/3377\nCopyright © 2015\n" +"------------------------------------------------\n"; Comment(temp); } int LEVEL() { int c; string comment; for(int i=OrdersHistoryTotal()-1;i>=0;i--) { bool select=OrderSelect(i,SELECT_BY_POS,MODE_HISTORY); comment=OrderComment(); if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNo) { StringReplace(comment,"[sl]",""); c=StrToInteger(comment); return(c); } } return(c); } int Orders() { int cnt=0; for(int i=0;i=0;i--) { bool select=OrderSelect(i,SELECT_BY_POS,MODE_HISTORY); if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNo) { if(OrderProfit()>=0)return(true); else return(false); } } return(true); } //+------------------------------------------------------------------+ //| Expert start | //+------------------------------------------------------------------+ void OnTick() { chain0[1]=order1; chain0[2]=order2; chain0[3]=order3; chain0[4]=order4; chain0[5]=order5; chain0[6]=order6; chain0[7]=order7; chain0[8]=order8; chain0[9]=order9; chain0[10]=order10; chain0[11]=order11; chain0[12]=order12; chain0[13]=order13; chain0[14]=order14; chain0[15]=order15; chain0[16]=order16; chain0[17]=order17; chain0[18]=order18; chain0[19]=order19; chain0[20]=order20; chain0[21]=order21; chain0[22]=order22; chain0[23]=order23; chain0[24]=order24; chain0[25]=order25; chain0[26]=order26; chain0[27]=order27; chain0[28]=order28; chain0[29]=order29; chain0[30]=order30; chain1[1]=Lots_1; chain1[2]=Lots_2; chain1[3]=Lots_3; chain1[4]=Lots_4; chain1[5]=Lots_5; chain1[6]=Lots_6; chain1[7]=Lots_7; chain1[8]=Lots_8; chain1[9]=Lots_9; chain1[10]=Lots_10; chain1[11]=Lots_11; chain1[12]=Lots_12; chain1[13]=Lots_13; chain1[14]=Lots_14; chain1[15]=Lots_15; chain1[16]=Lots_16; chain1[17]=Lots_17; chain1[18]=Lots_18; chain1[19]=Lots_19; chain1[20]=Lots_20; chain1[21]=Lots_21; chain1[22]=Lots_22; chain1[23]=Lots_23; chain1[24]=Lots_24; chain1[25]=Lots_25; chain1[26]=Lots_26; chain1[27]=Lots_27; chain1[28]=Lots_28; chain1[29]=Lots_29; chain1[30]=Lots_30; chain2[1]=TakePtofit1; chain2[2]=TakePtofit2; chain2[3]=TakePtofit3; chain2[4]=TakePtofit4; chain2[5]=TakePtofit5; chain2[6]=TakePtofit6; chain2[7]=TakePtofit7; chain2[8]=TakePtofit8; chain2[9]=TakePtofit9; chain2[10]=TakePtofit10; chain2[11]=TakePtofit11; chain2[12]=TakePtofit12; chain2[13]=TakePtofit13; chain2[14]=TakePtofit14; chain2[15]=TakePtofit15; chain2[16]=TakePtofit16; chain2[17]=TakePtofit17; chain2[18]=TakePtofit18; chain2[19]=TakePtofit19; chain2[20]=TakePtofit20; chain2[21]=TakePtofit21; chain2[22]=TakePtofit22; chain2[23]=TakePtofit23; chain2[24]=TakePtofit24; chain2[25]=TakePtofit25; chain2[26]=TakePtofit26; chain2[27]=TakePtofit27; chain2[28]=TakePtofit28; chain2[29]=TakePtofit29; chain2[30]=TakePtofit30; chain3[1]=StopLoss1; chain3[2]=StopLoss2; chain3[3]=StopLoss3; chain3[4]=StopLoss4; chain3[5]=StopLoss5; chain3[6]=StopLoss6; chain3[7]=StopLoss7; chain3[8]=StopLoss8; chain3[9]=StopLoss9; chain3[10]=StopLoss10; chain3[11]=StopLoss11; chain3[12]=StopLoss12; chain3[13]=StopLoss13; chain3[14]=StopLoss14; chain3[15]=StopLoss15; chain3[16]=StopLoss16; chain3[17]=StopLoss17; chain3[18]=StopLoss18; chain3[19]=StopLoss19; chain3[20]=StopLoss20; chain3[21]=StopLoss21; chain3[22]=StopLoss22; chain3[23]=StopLoss23; chain3[24]=StopLoss24; chain3[25]=StopLoss25; chain3[26]=StopLoss26; chain3[27]=StopLoss27; chain3[28]=StopLoss28; chain3[29]=StopLoss29; chain3[30]=StopLoss30; int level,ticket,NewCM; if(!LastOrderProfit()||LEVEL()<30)level=LEVEL()+1; if(LastOrderProfit()||LEVEL()==30)level=1; NewCM=chain0[level]; if(Orders()==0) { //-----------------------BUY Order if(NewCM==1) { ticket=OrderSend(Symbol(),OP_BUY,chain1[level],NormalizeDouble(Ask,digits),3*Q,Ask-chain3[level]*point,Ask+chain2[level]*point,DoubleToStr(level,0),MagicNo,0,Blue); } //-----------------------SELL Order if(NewCM==0) { ticket=OrderSend(Symbol(),OP_SELL,chain1[level],NormalizeDouble(Bid,digits),3*Q,Bid+chain3[level]*point,Bid-chain2[level]*point,DoubleToStr(level,0),MagicNo,0,Red); } } }