Another problem

 

I am having another problem I can't find a fix to. This time I'm getting warnings about the Start function: Start function not found and cannot be run, init function defined - start function's parameters will be ignored as expert properties and Function "Start" is not referenced and will be removed from exp-file. It seems that it doesen't see the Start function. Any help would be great.

int realamount,Old_Price,New_Price,Point2Pip;
int init()
  {
   /*Trend determiner:Part of trend determiner*/
   Old_Price=Ask;
   New_Price=Ask; 
   Point2Pip=Point;
   if(Digits==3)
   {Point2Pip=0.01;}
   if(Digits==5)
   {Point2Pip=0.0001;}
   return(0);
   }
   
   int Start()
  {
   //Declaration of variables
   int Spips,Apips,Epips,TStop,i,RolloverHour,RolloverMin,RolloverStop,
   StartWeekendHour,StartWeekendMin,StartWeekendDay,InvestType,
   Excludefrompercent,Margin,InvestPercent,InvestAmount,realamount,
   donttrade,trenddirection;
   string UseEpipSetter,ACondition,Beforefloor,InvestLots,
   SentReportHour,Str_Np,Str_Op,
   maxslip,Yes,No;
   //Initialization of variables
   //-----------------------------------------------------------------
   //-----------------------------------------------------------------
   Spips=2;//Standard entry pips
   Apips=1; //Alternitive entry pips; used if A condition is met and turned on
   TStop=2;//Trailing stop
   maxslip=1; //max slippage amount
   UseEpipSetter=No; //Yes or No
   InvestType=0; //"1" for use amount or "0" for use percentage of balance
   InvestAmount=0; //Amount invested if InvestType is set to 1
   InvestPercent=100; //Amount invested if InvestType is set to 0; 1-100
   Excludefrompercent=0; //Amount to exclude from acct percent
   Margin=100;//Margin multiplyer;max depends on acct, often 100 (for 1:100)
   //Use server time zone for all times
   RolloverHour=14; //hour of rollover
   RolloverMin=0;  //min of rollover
   RolloverStop=1; //mins before and after when trading is stopped
   StartWeekendHour=7; //hour of weekend start
   StartWeekendMin=59;  //min of weekend start; Can't be 0
   StartWeekendDay=5;  //day of weekend start; 0=Sunday, 6=Saturday ect.
   SentReportHour=14; //hour daily report is sent
   //-----------------------------------------------------------------
   //-----------------------------------------------------------------
   /*Epip setter: Determines whether the Apips condition is met and 
   sets Epip to Apip if it is so*/
   if(UseEpipSetter==Yes)
   {Epips=Apips;}
   else
   {Epips=Spips;}
   /*Rollover and Weekend Avoider:Assures that no trades are open during rollover or on 
   weekends by exiting and stopping before rollover and weekends*/
   donttrade=0;
   //Rollover
   if
   (
   RolloverHour==TimeHour(TimeCurrent())&&
   RolloverMin-RolloverStop>=TimeMinute(TimeCurrent())&&
   RolloverMin+RolloverStop<=TimeMinute(TimeCurrent())
   )
   {
   //Next 7 lines are from Ahmed Soliman of http://www.xpworx.com
   OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
   if(OrderType()==OP_BUY)
   OrderClose(OrderTicket(),OrderLots(),Bid,5,Violet);
   if(OrderType()==OP_SELL) 
   OrderClose(OrderTicket(),OrderLots(),Ask,5,Violet);
   if(OrderType()>OP_SELL)
   OrderDelete(OrderTicket());
   donttrade=1;
   }
   if(StartWeekendDay==TimeDayOfWeek(TimeCurrent())&&
   StartWeekendHour==TimeHour(TimeCurrent())&&
   StartWeekendMin-1<=TimeMinute(TimeCurrent()))
   {
   //Next 7 lines are from Ahmed Soliman of http://www.xpworx.com
   OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
   if(OrderType()==OP_BUY)
   OrderClose(OrderTicket(),OrderLots(),Bid,5,Violet);
   if(OrderType()==OP_SELL) 
   OrderClose(OrderTicket(),OrderLots(),Ask,5,Violet);
   if(OrderType()>OP_SELL)
   OrderDelete(OrderTicket());
   donttrade=1;
   }
   /*Investment Amount:Determines the amount invested if its a 
   percentage and sets the amount regardless then turns into lots*/
   if (InvestType==0)
   {
   realamount=(AccountBalance()-Excludefrompercent)*(InvestPercent/100)*Margin;
   }
   else
   {
   realamount=InvestAmount*Margin;
   }
   Beforefloor=realamount/1000;
   InvestLots=MathFloor(Beforefloor)/100;
   /*Trend determiner:Triggers when price moves a certain 
   number of pips and determines the direction of the trend.
   Modified code from ubzen of www.fourm.mql4.com */
   New_Price=Ask;
   Str_Np=DoubleToStr(New_Price,5);
   Str_Op=DoubleToStr(Old_Price,5);
   if(MathAbs(i)<Epips)
   {if(Ask>Old_Price+1*Point2Pip)
   {i++;Alert("up");}
   else
   {i--;Alert("down");}
    Old_Price=New_Price;
    if(MathAbs(i)==Epips)
    if(i>0){trenddirection=1;}else{trenddirection=-1;}
    i=0;}
   /* Entry&Exit:Uses Epips to enter InvestPerc percent of capital
   in a market order with a trailing stop of TStop */
   if (OrdersTotal()==0&&donttrade==0&&trenddirection==1||trenddirection==-1)
   {
      if (trenddirection==1)
      {OrderSend(Symbol(),OP_BUY,InvestLots,Ask,maxslip,TStop,0,NULL,NULL,0,Orange);}
      if (trenddirection==-1)
      {OrderSend(Symbol(),OP_SELL,InvestLots,Bid,maxslip,TStop,0,NULL,NULL,0,Blue);}
      trenddirection=0;
     }
   return(0);
   }
 
the start function is "start()", not "Start()" ...function names are case-sensitive ..compiler is looking for start() with lower-case 's' and cannot find it
 

Thanks, it worked. I can understand I can scew up code I write but now I even mess up pre-written code :(

I fixed with lots of help all the scew-ups now so its ok though :)

 
//Next 7 lines are from Ahmed Soliman of http://www.xpworx.com
   OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
   if(OrderType()==OP_BUY)
   OrderClose(OrderTicket(),OrderLots(),Bid,5,Violet);
   if(OrderType()==OP_SELL) 
   OrderClose(OrderTicket(),OrderLots(),Ask,5,Violet);
   if(OrderType()>OP_SELL)
   OrderDelete(OrderTicket());
   donttrade=1;
   }
If there are no open orders then OrderSelect fails and the remainder is nonsense. In addition the code means you can run the EA on ONE chart only, no other EAs, no manual trades.
    for(pos = OrdersTotal()-1; pos >= 0 ; pos--) if (
        OrderSelect(pos, SELECT_BY_POS)                 // Only my orders w/
    &&  OrderMagicNumber()  == magic.number             // my magic number
    &&  OrderSymbol()       == Symbol() ){              // and my pair.
        if(OrderType() <=OP_SELL) OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),5,Violet);
        else                      OrderDelete(OrderTicket());
        donttrade=1;
    }
Reason: