how to add indicator code into expertadvisor code ?? - page 2

 
int start
       {
       if (Close<i)
       int Ticket = OrderSend(Symbol(),OP_BUY,LotSize(),StopLoss(),TakeProfit(),0,0,);
       else
       OP_SELL;         
       return(0);
       }

what's wrong with this ???

still the same error, { - comma or semicolon expected

 
What is OP_SELL; doing there ? OP_SELL = 1 see here: https://docs.mql4.com/constants/trading
 
albert_lim83:

what's wrong with this ???

still the same error, { - comma or semicolon expected

start is a function and needs brackets after it

Close is an array and needs an index.

int start(){

   if( Close[1]<i )
      int Ticket = OrderSend(Symbol(),OP_BUY,LotSize(),Ask,10,StopLoss(),TakeProfit());
   else
      OP_SELL;    // WTF?     
   return(0);
}

Missed two parameters from OrderSend

Grade 1 out of 10. Must try harder.

Must RTFM.

 
'%' - remainder operator is to be applied to integer values only

why can't i put % on the ea ??

i wish to use for counting % free margin of total balance ...


then how should i do to calculate the percentage of free margin of balance ??

 
extern double Percent = 20;

for insert percentage of margin to use

   if(AccountFreeMargin()<(Percent())(AccountBalance())){
      Print("We have no money. Free Margin = ", AccountFreeMargin());
      return(0);
   }

if the percent of free margin is lesser than then percent i chosen(20),

then the operation is stop and return 0,


but the error appear 'percent' - function is not defined

'(' - unexpected token


anyone can help me to fix this error ???

 
albert_lim83:

why can't i put % on the ea ??

i wish to use for counting % free margin of total balance ...


then how should i do to calculate the percentage of free margin of balance ??

How would you calculate a percentage using a pencil and paper ? do it the same way . . . .

% in mql4 is for calculating a remainder not for percentages . . .

 
albert_lim83:

for insert percentage of margin to use

if the percent of free margin is lesser than then percent i chosen(20),

then the operation is stop and return 0,


but the error appear 'percent' - function is not defined

'(' - unexpected token

What is Percent() ? did you mean Percent ?
 

Here, for free . .

extern double Percent = 20;




if( AccountFreeMargin() < ( Percent/100 ) * AccountBalance() )
   {
   Print("We have no money. Free Margin = ", AccountFreeMargin());
   return(0);
   }
 
RaptorUK:

Here, for free . .


thanks...

the problem is fixed.

you are the best. ^^

 
can i add MA in the ea chart ??