والآن نفس التقنية نقوم بها مع الترند الصاعد من أجل صفقة البيع وهي لها الكود التالي:
كود PHP:
if(ObjectFind(SellStop_TrendName) == 0)
{
SetObject("High" + SellStop_TrendName,
ObjectGet(SellStop_TrendName, OBJPROP_TIME1),
ObjectGet(SellStop_TrendName, OBJPROP_PRICE1) + SellStop_StepUpper*Point,
ObjectGet(SellStop_TrendName, OBJPROP_TIME2),
ObjectGet(SellStop_TrendName, OBJPROP_PRICE2) + SellStop_StepUpper*Point,
ObjectGet(SellStop_TrendName, OBJPROP_COLOR));
SetObject("Low" + SellStop_TrendName, ObjectGet(SellStop_TrendName, OBJPROP_TIME1),
ObjectGet(SellStop_TrendName, OBJPROP_PRICE1) - SellStop_StepLower*Point,
ObjectGet(SellStop_TrendName, OBJPROP_TIME2),
ObjectGet(SellStop_TrendName, OBJPROP_PRICE2) - SellStop_StepLower*Point,
ObjectGet(SellStop_TrendName, OBJPROP_COLOR));
vH = NormalizeDouble(ObjectGetValueByShift("High" + SellStop_TrendName, 0), Digits);
vM = NormalizeDouble(ObjectGetValueByShift(SellStop_TrendName, 0), Digits);
vL = NormalizeDouble(ObjectGetValueByShift("Low" +SellStop_TrendName, 0), Digits);
sl = vL + SellStop_StopLoss*Point;
tp = vL - SellStop_TakeProfit*Point;
if(Bid >= vM && Bid <= vH && OrderFind(MagicSellStop) == false)
if(OrderSend(Symbol(), OP_SELLSTOP, SellStop_Lot, vL, 3, sl, tp, "",
MagicSellStop, 0, Red) < 0)
Print("Err (",