I need a filter for the condition_1 below which is the cross of two moving averages. The trigger for placing a buy order would be after the crossing of the moving average a difference between the moving averages of 2.5 pips. This is to avoid insignificant crossings of the moving averages during a ranging market. In advance, Thank you.
Inserted Code
// Long
OrderSelect(LongTicket,SELECT_BY_TICKET);
if(OrderCloseTime() != 0 || LongTicket == 0)
{
bool buy_condition_1 = iMA(NULL, PERIOD_M5, 9, 0, MODE_LWMA, PRICE_CLOSE, 0) < iCustom(NULL, PERIOD_M5, "PA", period, 0, 0) ;
if( buy_condition_1 )
{
OrderSelect(ShortTicket,SELECT_BY_TICKET);
if(OrderCloseTime() == 0 && ShortTicket > 0)
{
bool Closed = OrderClose(ShortTicket,OrderLots(),Ask,0,Red);
}