Zamieszczone przez
;
int start ()
{
int count;
if (Barslt; 100) {Drukuj (paski mniejszy niż 100); return (0); }
total = OrdersTotal ();
if (trend! = 0) {last_trend = trend; }
trend = MACD_Direction ();
strength = trend_strength ();
if (pending_timegt; 0) last_pending_time = pending_time;
dla (count = 0; countlt; total; count ) gt;
{
OrderSelect (liczba, 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 * poziom MACD) 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 * poziom MACD) 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 = trend; }
if (trendlt; 0 strengthlt; = - 0.95 * MACD_level) {sell_flag = true; buy_flag = false; last_trend = 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);
}
}