Does MQL let you program volume as a perimeter?

 
Does MQL let you program volume as a perimeter?
 if(Volume[0] > Volume[1])
        {
        
         res=OrderSend(Symbol(),OP_SELL,SetLotSize(),Bid,1,Bid+StopLoss*_Point,Bid-TakeProfit*Point,NULL,0,0,Green);
        }

or 

if(Volume[0] >300)
 
Sanjay Rathore: Does MQL let you program volume as a perimeter?
Yes, in MQL4 you can obtain tick volume by using the Volume[] predefined variable, or the iVolume() function, or the CopyTickVolume() function, or via the MqlRates data obtained from the CopyRates() or ArrayCopyRates() functions.
 
res=OrderSend(Symbol(),OP_SELL,SetLotSize(),Bid,1,Bid+StopLoss*_Point,Bid-TakeProfit*Point,NULL,0,0,Green);

You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit and open at the Ask.

  1. Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?

  2. Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger close to 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.)
    Most brokers with variable spreads widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY shows average spread = 26 points, but average maximum spread = 134 (your broker will be similar).

 
William Roeder #:

You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit and open at the Ask.

  1. Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?

  2. Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger close to 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.)
    Most brokers with variable spreads widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY shows average spread = 26 points, but average maximum spread = 134 (your broker will be similar).

Thanks William & Fernando, the issue is Volume[0] doesn't compute, you have to use Volume[1]. I've made adjustments to the Ordersend function too. 

 
Sanjay Rathore #: Thanks William & Fernando, the issue is Volume[0] doesn't compute, you have to use Volume[1]. I've made adjustments to the Ordersend function too. 

Volume[] is the tick volume or tick count for a bar. It has nothing to do with lots or the order volume to be used with OrderSend. For that you have to consider the margin requirements and the risk of the stop-loss, and you will need to calculate the lots taking into account your balance, the symbol's tick size and tick value.

Reason: