//--------------------------------------------------------------------
// Trading rule: Long entry (On Bar Open)
//--------------------------------------------------------------------
if ((LongEntrySignal
and Not LongExitSignal)
and (MarketPosition("Current", MagicNumber, "") is Not Long))
{
// Action #1
Open Long order at (Fibo(Main chart, Open-Close previous week, Fibo Level = -38.2)[] + (ATR(Main chart,ATRPeriod1)[5] * PriceEntryMult1)) Stop;
Order valid for BarsValid bars;
Duplicate trades: allowed;
Replacing pending orders: allowed;
Stop Loss = SLm * ATR(mATRp);
Profit target = TPm * ATR(mATRp);
Trailing Stop = TSm * ATR(mATRp);
Exit After ExitAfterBars bars;
}
//--------------------------------------------------------------------
// Trading rule: Short entry (On Bar Open)
//--------------------------------------------------------------------
if ((ShortEntrySignal
and Not ShortExitSignal)
and (MarketPosition("Current", MagicNumber, "") is Not Short))
{
// Action #1
Open Short order at (Fibo(Main chart, Open-Close previous week, Fibo Level = 138.2)[] - (ATR(Main chart,ATRPeriod1)[5] * PriceEntryMult1)) Stop;
Order valid for BarsValid bars;
Duplicate trades: allowed;
Replacing pending orders: allowed;
Stop Loss = SLm * ATR(mATRp);
Profit target = TPm * ATR(mATRp);
Trailing Stop = TSm * ATR(mATRp);
Exit After ExitAfterBars bars;
}