Quote:
Originally Posted by Dr Hackenbush
Hi
I think you need to review the 'isposition' function. It will need to be generalised for all currency pairs. At the moment there is a hard coded multiple (90) and presumption about the POINT size. I expect you've tinkered this to suit a particular pair while developing EA.
Also it is unbalanced in terms of reference to MODE_ASK for both buy and sell (subsequent) entries.
Without looking too closely are you not over exposed by distant TP. I guess this is in reality not a biggy as the fast signal would force an exit before it got too bad.
Keep up good work, thanks for sharing.
|
bool IsPosition(double inRange)
{
int totalorders = OrdersTotal();
for(int i = 0;i < totalorders;i++)
{
OrderSelect(i, SELECT_BY_POS);
if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == Magic))
{
int type = OrderType();
if ((MathAbs(OrderOpenPrice() - MarketInfo(Symbol(),MODE_ASK))*90) < (inRange))
{
if (type == OP_BUY || type == OP_SELL)
{
return(true);
}
}
}
}
return(false);
}
Regarding this function what changes do you recommend?
Many thanks
roger