NEED HELP TO CREATE PENDING ORDER

 

hello

im new at this programming mql4

i want to create a simple script, can someone help me?

i need it to

see 2nd last candle and open pending order 10 pips above the closing of that candle, with SL -80 pips, TP +60 pips.

I have this code and it doesnt do anything

#property version   "1.00"

#property strict


extern double valor = 00.00;

extern double lots = 0.01;

extern int takeprofit = 60;

extern int stoploss = 80;

extern int magic = 33454;

int compras[5] = {0, 0, 0, 0, 0};


int start()                                 // Special function 'start'

  {                         

   

   openbuystop(Bid, stoploss);

  

   return(0);                                  // Exit start()

  }


void openbuystop(double price, double stop)

   {

   OrderSend(Symbol(),OP_BUYSTOP,lots,price,3,stop, price+takeprofit*Point, NULL, magic, 0, Red);

   return;

   }


void opensellstop(double price, double stop)

   {

   OrderSend(Symbol(),OP_SELLSTOP, lots, price, 3, stop, price+takeprofit*Point, NULL, magic, 0, Green);

   return;

   } 

 

can someone help me?  

 
dac69: i need it to see 2nd last candle and open pending order 10 pips above the closing of that candle, with SL -80 pips, TP +60 pips.
  1. You pass the current Bid as price to your function. A buyStop must be above the Ask.
  2. You pass 80 as a stop loss, but the value passed to OrderSend must be a price (like you do with the take proft).
  3. You would know these two, had you checked your return codes: What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
  4. Where are you looking for the "2nd last candle?" learn to code it, or pay someone. We're not going to code it FOR you.
    We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
Reason: