Errors in one area

 

I have been coding my first EA. There is one area that almost everthing has an errors, assignment expected, unexpected tokens, semi-colons, in places that shoulden't have them.

I have marked a few examples in comments.

Why would this one area do this? I really need help, I don't know what eles to try.

string Old_Price,New_Price,Point2Pip,Stopped,SubjectStopped;

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;
   string TDirection,UseEpipSetter,ACondition,InvestType,InvestAmount,
   InvestPercent,Margin,realamount,Beforefloor,InvestLots,donttrade,
   RolloverHour,RolloverMin,RolloverStop,StartWeekendHour,StartWeekendMin,
   StartWeekendDay,StopWeekendDay,StartWeekendStop,SentReportHour,
   trenddirection,Str_Np,Str_Op,maxslip,Excludefrompercent;
   //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=0; //"1" for Yes or "0" for 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)
   ACondition=NULL;//none  //Condition needed for Apips to be used
   //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==1&&ACondition)
   {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())&&
   TimeMinute(TimeCurrent())>=StartWeekendMin-1)
   {
   //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;
   }
   /////////////////////////////////////////////////////////////////////////////////////////////////HERE
   realamount/1000=Beforefloor;                                                       ///// "/ - assignment expected" and "1000 - unexpected token"         
   MathFloor(Beforefloor)/100==InvestLots;                                            ///// "/ - semicolon expected" and "/ - unexpected token" and "100 - unexpected" and more
   /*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";}
   ///////////////////////////////////////////////////////////////////////////////////////////////////TO HERE
    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);
   }
 
realamount/1000=Beforefloor;                                                       ///// "/ - assignment expected" and "1000 - unexpected token"         
MathFloor(Beforefloor)/100==InvestLots;                                            ///// "/ - semicolon expected" and "/ - unexpected token" and "100 - unexpected" and more

I reckon you wanted to:

Beforefloor=realamount/1000;
InvestLots=MathFloor(Beforefloor)/100;

The expression to calculate is always on the right, and the variable to assign the result to - on the left.

 
{i++&&Alert"up";}

This won't work either. && is for logical AND, not for 'do this and that'.

{
i++;
Alert("up");
}

This will. (I think so :)

 

Thanks so much Drave. That fixed all the problems. Theres more showing up now, but at least there diffrent so I can work on them.

Thanks again

Reason: