//+------------------------------------------------------------------+ //| Precipice.mq4 | //| Maximus_genuine | //| gladmxm@bigmir.net | //+------------------------------------------------------------------+ #property copyright "Maximus_genuine " #property link "gladmxm@bigmir.net" //---- input parameters //.......................................................................... extern bool In_BUY =true; extern int step_BUY =89; //---âõîäíûå ïàðàìåòðû ïî ëîíãàì extern int level_BUY=67; //.......................................................................... extern bool In_SELL =true; extern int step_SELL =89; //---âõîäíûå ïàðàìåòðû ïî øîðòàì extern int level_SELL=67; //.......................................................................... //---- other parameters static int prevtime=0; int ticket=0; int x=1; //------------------------- int Magic_BUY =123; int Magic_SELL =321; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //-------------------------------- if(Digits == 5) x=10; MathSrand(GetTickCount()); //-------------------------------- if (step_BUY< 20) step_BUY=20; if (step_SELL<20) step_SELL=20; if( level_BUY< 1) level_BUY= 1; if( level_BUY>99) level_BUY=99; if( level_SELL<1 ) level_SELL= 1; if( level_SELL>99) level_SELL=99; //-------------------------------- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //.......................................................................... if (Time[0] == prevtime) return(0); prevtime = Time[0]; if (!IsTradeAllowed()) { prevtime=Time[1]; Sleep(30000 + MathRand()); //--- ôîðìèðîâêà áàðà--- } //.......................................................................... My_Play( Magic_BUY, In_BUY, level_BUY, step_BUY); //---òîðãîâëÿ ïî ëîíãàì My_Play(Magic_SELL,In_SELL,level_SELL,step_SELL); //---òîðãîâëÿ ïî øîðòàì //.......................................................................... return(0);//-----------âûõîä èç ñòàðòîâîé ôóíêöèè------------ } //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx void My_Play(int mn,bool flag,int level,int step) { int total=OrdersTotal(); for (int i = 0; i < total; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES);//---ïðîõîä ïî îðäåðàì-- if (OrderSymbol() == Symbol() && OrderMagicNumber() == mn) { return(0); } } //.......................................................................... ticket = -1; if ( flag && level*327.68 > MathRand() && //----ðàíäîìíûé âõîä â ðûíîê --- IsTradeAllowed()) { if (mn<200) { ticket= OrderSend(Symbol(), OP_BUY,lot(),Ask,5*x,Bid-x*step*Point,Ask+x*step*Point,DoubleToStr(mn,0),mn,0,Blue); } else { ticket= OrderSend(Symbol(),OP_SELL,lot(),Bid,5*x,Ask+x*step*Point,Bid-x*step*Point,DoubleToStr(mn,0),mn,0, Red); } RefreshRates(); if ( ticket < 0) { Sleep(30000); prevtime = Time[1]; } } //-- Exit --- return(0); } //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx double lot() { return(0.1); } //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Sample
Analysis
Market Information Used:
Series array that contains open time of each bar
Indicator Curves created:
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Checks for the total of open orders
It automatically opens orders when conditions are reached
Other Features: