Help me with this script

 

Hey guys,


Here's my script below, mostly it works as per inputs, but sometimes there's difference in TP, SL, and Distance. I mean, is there a way to make it 'recheck' for inputs and trades for their TP, SL and distance?


//+------------------------------------------------------------------+
#property version   "1.00"
#property strict
#property show_inputs

int MAGICMA=23423423;
//int MAGICMA2=23423424;
   
//---- Parametres Externes
extern string BSSS = "(Buy, SellStop)";
extern double BLot = 0.02;
extern int BuySL = 50;
extern int BuyTP = 53;

extern double   SLot = 0.04;
extern int      SellStopSL = 50; 
extern int      SellTP = 54;

extern int  Distance = 40;
//double pip=Point;

void OnStart()
  {
//---
  // if(Digits == 3 || Digits == 5) pip = 10*Point;

   int buy, sellstop;
   buy=OrderSend(Symbol(),OP_BUY, BLot,Ask, 0,Ask-BuySL*Point, Ask+BuyTP*Point,"BUY",MAGICMA,0,Blue);
   if(buy > 0)
     {
      double stOpen = Ask-Distance*Point;
      sellstop = OrderSend(Symbol(),OP_SELLSTOP,SLot,stOpen,0,stOpen+SellStopSL*Point,stOpen-SellTP*Point,"SELLSTOP",MAGICMA);
     }
     else
       {
        Print("Fail to open the order ERROR : ",GetLastError());
       }
  }


Thanks, please help!

 
Sequisite: Here's my script below,  is there a way to make it 'recheck' for inputs

A script runs once and exits. The externs are whatever you set them to in the pop up.

Reason: