We can ignore the instances of Symbol() in void CalculateLotAsAmountPerCashDollops(). So far as I know, MODE_LOTSTEP is a platform wide thingy, not pair specific.
I found one that does matter. Line 1924:
result = SendSingleTrade(Symbol(), OP_BUYSTOP, TradeComments[dd], SendLots, price, stop, take, MagicNumbers[dd]);
should be:
result = SendSingleTrade(OrderSymbol(), OP_BUYSTOP, TradeComments[dd], SendLots, price, stop, take, MagicNumbers[dd]);
Also DIYers, copy this from Thomas over the top of the existing void CheckPricesAreStillValid(int cc) function:
Code: Select all
void CheckPricesAreStillValid(int cc)
{
//Examine pending trades and adjust the price if the peak has moved by 1 pip or more.
if (!BetterOrderSelect(LatestTradeTicketNo, SELECT_BY_TICKET, MODE_TRADES) )
return;
double price = 0, newPrice = 0;
bool modify = false;
double stop = 0, take = 0;
//A buy stop will be above the lowest trade line
if (OrderType() == OP_BUYSTOP)
{
price = PeakLowTradingLines[cc];
if (OrderOpenPrice() - price > (1 / factor) )
if (bid < price + (TradeBuffers[cc] / factor) )
{
modify = true;
newPrice = price + (TradeBuffers[cc] / factor);
stop = CalculateStopLoss(OP_BUY, newPrice, cc);
take = CalculateTakeProfit(OP_BUY, newPrice, cc);
}//if (bid < price + (TradeBuffers[cc] / factor) )
}//if (OrderType() == OP_BUYSTOP)
//A sell stop will be below the highest trade line
if (OrderType() == OP_SELLSTOP)
{
price = PeakHighTradingLines[cc];
if (price - OrderOpenPrice() > (1 / factor) )
if (bid > price - (TradeBuffers[cc] / factor) )
{
modify = true;
newPrice = price - (TradeBuffers[cc] / factor);
stop = CalculateStopLoss(OP_SELL, newPrice, cc);
take = CalculateTakeProfit(OP_SELL, newPrice, cc);
}//if (OrderOpenPrice() - price > (1 / factor) )
}//if (OrderType() == OP_SELLSTOP)
if (!modify)
return;
bool result = ModifyOrder(OrderTicket(), newPrice, stop, take, OrderExpiration(), clrNONE, __FUNCTION__, oop);
}//void CheckPricesAreStillValid(int cc)