error on stoploss even sending order without Stoploss! - page 2

 
  1. Amirfakhredin Ghanbari: double longSignal=OrderSend(NULL,OP_BUY,0.01,Ask,3,0,Bid+(Target*pips),"Long",0,0,clrBlue);
    Don't use NULL.
    • You can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not. OrderSend does not.
    • Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.
    • Zero is the same as PERIOD_CURRENT which means _Period. Don't hard code numbers.
    • MT4: No need for a function call with iHigh(NULL,0,s) just use the predefined arrays, i.e. High[].

  2. We have no idea what Target and pips are. You can't move stops (or pending prices) closer to the market than the minimum: MODE_STOPLEVEL * _Point or SymbolInfoInteger(SYMBOL_TRADE_STOPS_LEVEL).
              Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial


  3. Marius Ovidiu Sunzuiana: You have to multiply with Point() function. Ask+takeprofit*Point()
    You buy at the Ask and sell at the Bid. So for buy orders you pay the spread on open. For sell orders you pay the spread on close.
    1. Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid reaches it. Not the Ask. Your SL is shorter by the spread and your TP is longer. Don't you want the same/specified amount for either direction?
    2. Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask reaches it. To trigger at a specific Bid price, add the average spread.
                MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25
    3. The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (Control-O) → charts → Show ask line.)

_Symbol - Predefined Variables - MQL4 Reference
_Symbol - Predefined Variables - MQL4 Reference
  • docs.mql4.com
_Symbol - Predefined Variables - MQL4 Reference
 

Professionals already answered you, 

I just want to add that OrderSend returns the ticket number of the position if it opened the position successfully, otherwise it will return -1.

It gives you an int not a double value.

Reason: