
Happy New Year every one, i hope we all made it to 2014 in one piece
Hi guys;
I have been using TCO now for a couple of week (I know just a babe in the woods eh) Haha,
Any ways I have found a couple of brick walls that I have run into.
1, I every time I have a profit and I have TrailingStop = true I get an error each time the TrailingStop moves up/down with price
"
Buy Trailing Stop-Error 1: no error"
// Buy Trailing Stop Function
Code: Select all
void BuyTrailingStop(string argSymbol, int argTrailingStop, int argMinProfit,
int argMagicNumber)
{
for(int Counter = 0; Counter <= OrdersTotal()-1; Counter++)
{
OrderSelect(Counter,SELECT_BY_POS);
// Calculate Max Stop and Min Profit
double MaxStopLoss = MarketInfo(argSymbol,MODE_BID) -
(argTrailingStop * PipPoint(argSymbol));
double PipsProfit = MarketInfo(argSymbol,MODE_BID) - OrderOpenPrice();
double MinProfit = argMinProfit * PipPoint(argSymbol);
// Modify Stop
if(OrderMagicNumber() == argMagicNumber && OrderSymbol() == argSymbol
&& OrderType() == OP_BUY && OrderStopLoss() < MaxStopLoss
&& PipsProfit >= MinProfit)
{
while(IsTradeContextBusy()) Sleep(100);//Sleep(10); //--- Modified by ck
bool Trailed = OrderModify(OrderTicket(),OrderOpenPrice(),MaxStopLoss,
OrderTakeProfit(),0);
if(Trailed == false)
{
int ErrorCode = GetLastError();
string ErrDesc = ErrorDescription(ErrorCode);
string ErrAlert = StringConcatenate("Buy Trailing Stop - Error ",
ErrorCode,": ",ErrDesc);
Alert(ErrAlert);
string ErrLog = StringConcatenate("Bid: ",
MarketInfo(argSymbol,MODE_BID)," Ticket: ",OrderTicket()," Stop: ",
OrderStopLoss()," Trail: ",MaxStopLoss);
Print(ErrLog);
}
}
}
}
To get around this I have disabled the error handling for the Trailing Stop Function, this is obviously only till I find a fix and while demo trading it. The Trailing Stop works fine by the way.
2, I still have not found a way to stop TCO from taking subsequent trades when the prior trade is in drawdown.
So as a work around I have set the
Use_PipStep = true;
PipStep = 100;
I then check the platform each hour and if an unwanted trade has been taken I delete it ASAP, this too is not ideal.
So if anyone could point me in the right direction so that I could fix these two problems it would be appreciated.
Les