Help scripting a buy order below current price

 

Hi!

I'm trying to make my own script and I'm stuck with opening a buy order with the price below current price

Here's what I'm thinking can anyone shed a light on it?


 {

  trade.Buy(Lots,NULL, Ask-100,SL,TP,"Buy Condition");

 }


is this supposed to open a buy order 100 pips below current price?

Thanks

 
blocowow:

Hi!

I'm trying to make my own script and I'm stuck with opening a buy order with the price below current price

Here's what I'm thinking can anyone shed a light on it?


 {

  trade.Buy(Lots,NULL, Ask-100,SL,TP,"Buy Condition");

 }


is this supposed to open a buy order 100 pips below current price?

Thanks

I think, you habe to read first about the order types and learn some basics

 
amando:

I think, you habe to read first about the order types and learn some basics


Thanks! It did help!

Here's what It turns out:


trade.BuyLimit(lote,SymbolInfoDouble(Symbol(),SYMBOL_ASK)-100,_Symbol,mediaCurta[0] - SL,mediaCurta[0] + TP,ORDER_TIME_GTC,0,"");

Reason: