how to coding trailing stop ?

 

i never use trailing stop on trading since 5 years ago.

so i wanna to know what's trailing stop ?

and how to coding it in mql4 ?

 
Search for trailing SL and read : Trailing SL
 
RaptorUK:
Search for trailing SL and read : Trailing SL

i got this error...

ordermodify error 4108

unknown ticket 6 for ordermodify function,

it's probably is cause by what error ??

 

Your tick number used in your OrderModify() is not valid.

ERR_INVALID_TICKET4108Invalid ticket.
 
actually what is ticket ??
 
what is Invalid function parameter value.
 

what error is it ??


Invalid function parameter value.

 

int is a value type double value is a type string is a value type.

this is what a function looks like when defined in code

bool Afunction( double x, string symbol, bool doI )
{
//code for function
return(false)
}

in the start() code functions can get called

start()
{
if ( Afunction( Bid, Symbol(), false) ) {Print("function worked") ; }
//Bid is a value of type double
//Symbol() is a value of type string
//false is a value of type bool
if the value types in the call don't match the value types in the definition then you get the error 'Invalid function parameter value'
 

hi...

everyone

i just wonder how to make crossover since send order function required take profit and stop loss into command ordersend ?


i put " " into ordersend command as tp and sl,

but the error shown invalid double number as parameter for ordersend function.


so what to do for ordersend of crossover ea ??

         {
         OrderSend(Symbol(),OP_SELL,LotSize,Bid,Slippage,"","","",0,0); 
         return(0);
         }
 

well i just put

double tp, sl;


and

int start()
  {
  
  tp = 0;
  sl = 0;
 

function definition of ordersend

int OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=0, datetime expiration=0, color arrow_color=CLR_NONE) 
//symbol is of type string you call function Symbol() which retruns a string - correct
//cmd is of type int you give it the predefined value of OP_SELL which means that the preprocessor replaces the word OP_SELL with 1 - correct
//volume is of type double which you tell it is found in the value of LotSize, if LotSize is of type double then the types match and is correct
//price is of type double and you tell it to use predefined value of Bid which is also a double so this is correct
//silppage is of type int or integer if the value you give it Slippage is of type integer then this is correct
//stoploss is of type double and you give it a string "" - the compiler sees the double quote mark and interprits the type in value as an empty string "" - invalid parameter
//takeprofit is of type double and you give it a string "" - the compiler sees the double quote mark and interprits the type in value as an empty string "" - invalid parameter
//comment is of type string and you give it a string value of "" - correct
//magic is of type int you give it a value of 0 - correct
//expiration is of type datetime you give it a value of 0 in the code so it thinks it is of the the correct type 
//arror_color is of type color and you give it by default function parameter definition CLR_NONE - correct but not from you choosing it as it defaults to this value.
Reason: