Help

 

this system is great but i cant get it to work, what is wrong with it!!!Can somebody code this into ea for mt4? extern int TP = 100; // TakeProfit ordersextern int SL = 100; // StopLoss ordersextern int lim= 1; // Distance of the rate returnextern int prodvig=3; // Distance of the rate progressextern double Prots= 10; // Percentage of the liquid assets//--------------------------------------------------------------------------------------------int total, // Count of lots bb=0, // 1 = the Buy order is available ss=0; // 1 = the Sell order is available //--------------------------------------------------------------------------------------------double max, // Maximum price at the peak (abs.) min, // Minimum price in the trough(abs.) lmax, // Limiting price after the exceeding // of which we consider selling(abs.) lmin, // The same for buying Lot; // Count of lots//жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжint start() { //============================================================================================ total=OrdersTotal(); // Count of lots if (total==0) // If there are no orders, .. { bb=0; // .. no Buys ss=0; // .. no Sells } if (maxAsk) min=Ask; // Calculate the min. price in the trough//------------------------------------------------------------- The price turns down ---- if (((max-Bid)>=lim*Point)&&(Bid>lmax )) // Turn at a high level { for (int i=total;i>=0;i--) // On all orders { if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true && OrderType()==OP_BUY) { OrderClose(OrderTicket(),OrderLots(),Bid,3,CLR_NONE);// Close Buy bb=0; // No Buys anymore } } Strateg(1); // Opening function } //------------------------------------------------------------ The price turns up ---- if (((Ask-min)>=lim*Point)&&(lmin>Ask )) // Turn at the deep bottom { for (i=total;i>=0;i--) // On all orders { if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true && OrderType()==OP_SELL) { OrderClose(OrderTicket(),OrderLots(),Ask,3,CLR_NONE);// Close Sell ss=0; // No Sells anymore } } Strateg(2); // Opening function }//============================================================================================ return; } //жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжvoid Strateg (int vv) // Opening function {//============================================================================================ if (vv==1 && ss==0) // Sell situation and no Sells { OrderSend(Symbol(),OP_SELL,Lots(),Bid,3,Bid+SL*Point,Bid-TP*Point,"",0,0,Red);// Откр ss=1; // Now, there is a Sell }//-------------------------------------------------------------------------------------------- if (vv==2 && bb==0) // Buy situation and no Buys { OrderSend(Symbol(),OP_BUY, Lots(),Ask,3,Ask-SL*Point,Ask+TP*Point,"",0,0,Blue);// Откр bb=1; // Now, there is a Buy } //-------------------------------------------------------------------------------------------- lmax=Ask+prodvig*Point; // Redefine the new limiting .. lmin=Bid-prodvig*Point; // .. levels for open and close //============================================================================================ return; }//жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжdouble Lots() // Calculation of lots {//============================================================================================ Lot=NormalizeDouble(AccountEquity()*Prots/100/1000,1);// Calculate the amoung of lots double Min_Lot = MarketInfo(Symbol(), MODE_MINLOT); // Minimum permissible cost of lots if (Lot == 0 ) Lot = Min_Lot; // For testing on const.min.lots//============================================================================================ return(Lot); }//жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжж/*

Reason: