Originally Posted by
;
int start()
{
int count;
if(Barslt; 100){打印(小於100);返回(0); }
總= OrdersTotal();
if(trend!= 0){last_trend = trend; }
趨勢= MACD_Direction();
強度= trend_strength();
if(pending_timegt; 0)last_pending_time = pending_time;
為(計數= 0; countlt;總;計數 )GT;
{
OrderSelect(count,SELECT_BY_POS,MODE_TRADES);
if(OrderType()lt; = OP_SELL OrderSymbol()== Symbol())
{
if(OrderType()== OP_BUY find_highest)
{
trailing_stop(1);
if(Close [0] gt; = OrderOpenPrice() Point * 5){pending_time = 0; revival_attempts = 0; opposite_trend_duration = 0; opp_trend_period = 0; }
if(Close [0] lt; orderopenprice() point * 5){= pending_time = last_loss = OrderOpenPrice() Point * 5-Close [0]; opp_trend_period = 0;} LT; BRGT; if(strengthlt; = - 0.95 * MACD_level)opp_trend_period ;
if(best_deal()gt; 0)ClosePending();
}
else if(OrderType()== OP_SELL find_lowest)
{
trailing_stop(2);
if(Close [0] lt; = OrderOpenPrice() - Point * 5){pending_time = 0; revival_attempts = 0; opp_trend_period = 0; }
if(Close [0] gt; OrderOpenPrice() - Point * 5)pending_time ;
if(strengthgt; = 0.95 * MACD_level)opp_trend_period ;
if(best_deal()gt; 0)ClosePending();
}
}
}
if(trendgt; 0 strengthgt; = 0.95 * MACD_level){buy_flag = true; sell_flag = FALSE; last_trend =趨勢; }
if(trendlt; 0 strengthlt; = - 0.95 * MACD_level){sell_flag = true; buy_flag = FALSE; last_trend =趨勢; }
if((sell_flag == true || buy_flag == true)total == 0 trend!= 0)
{
if(buy_flag == true)do_order(1);
if(sell_flag == true)do_order(2);
}
}