/*[[SetOrder(operation,lots,price,slippage,stoploss,takeprofit,color) Name := Trade Author := Copyright © 2005, MetaQuotes Software Corp. Link := http://www.metaquotes.net/ Lots := 1.00 Stop_Loss := 10 Take_Profit := 30 Trailing Stop := 25 Slippage := 2 Notes := Simple Buy and Sell functions for hedging ]]*/ vars: Slippage(2), Stop_Loss(10),Take_Profit(30); Vars: i(0); Vars: BuyThisSymbol(0),SellThisSymbol(0); If Curtime-LastTradeTime<10 then Exit; BuyThisSymbol = 0; SellThisSymbol = 0; for i = 1 to TotalTrades { if ord(i,VAL_SYMBOL) = Symbol and ord(i,VAL_TYPE) = OP_BUY then BuyThisSymbol = BuyThisSymbol + 1; if ord(i,VAL_SYMBOL) = Symbol and ord(i,VAL_TYPE) = OP_SELL then SellThisSymbol = SellThisSymbol + 1; }; If SellThisSymbol = 0 then { SetOrder(OP_SELL,lots,Bid,Slippage,Bid+Stop_Loss*Point,Bid-Take_Profit*Point,Red); Exit; }; If BuyThisSymbol = 0 then { SetOrder(OP_BUY,lots,Ask,Slippage,Ask-Stop_Loss*Point,Ask+Take_Profit*Point,Blue); Exit; }; Exit;