uninit reason 0;

 
hi all, i wrote this script to set TP and SL for orders. i am getting error uninit reason 0; cant figure out whats wrong :(
extern int PipSL =  10;
extern int PipTP =  30;
extern double Lots = 0.7;
extern string BuySell = "Buy";
int start()
  {


double SL;
double TP;
int pip = 0.0001;
if (Digits == 2 || Digits == 3) {pip = 0.01;}

if (BuySell == "Buy") {
SL = NormalizeDouble(Ask - (PipSL * pip),Digits);
TP = NormalizeDouble(Ask + (PipTP * pip),Digits);
OrderSend(Symbol(),OP_BUY,Lots,Ask,100,SL,TP,NULL,0,0,Blue);}

if (BuySell == "Sell") {
SL = NormalizeDouble(Bid + (PipSL * pip),Digits);
TP = NormalizeDouble(Bid - (PipTP * pip),Digits);
OrderSend(Symbol(),OP_SELL,Lots,Bid,100,SL,TP,NULL,0,0,Red);}  
//----
   return(0);
  }
 
cryptex:
hi all, i wrote this script to set TP and SL for orders. i am getting error uninit reason 0; cant figure out whats wrong :(
A script runs and then terminates . . . . why aren't you testing the return values from your trading functions ?

What are Function return values ? How do I use them ?
 
cryptex:
hi all, i wrote this script to set TP and SL for orders. i am getting error uninit reason 0; cant figure out whats wrong :(

You don't say whether the script is placing the order or not.
 
cryptex: i wrote this script . i am getting error uninit reason 0; cant figure out whats wrong :(
What's wrong is you need to RTFM. What is uninit reason 0?
Reason: