@ Wiggy1965,Wiggy1965 wrote:i had the GU one the other day, i posted abut it...
did you have fun closing all those trades...
Wiggy
Here is a script that makes it a snap to close all open or pending trades.
-Frank
@ Wiggy1965,Wiggy1965 wrote:i had the GU one the other day, i posted abut it...
did you have fun closing all those trades...
Wiggy
SteveHopwood wrote:Just had umpteen GU NY trend sell trades sent, so there is something wrong in the code that allows a new trade each day. I will look at this over the weekend.
Code: Select all
int CountOpenTrendTrades()
{
//Counts the number of open trend trades
if (OrdersTotal() == 0) return(0);
int OpenTrades;
for (int cc = OrdersTotal() - 1; cc >= 0; cc--)
{
if (!OrderSelect(cc, SELECT_BY_POS) ) continue;
if (OrderSymbol() != Symbol() ) continue;
if (OrderMagicNumber() != TrendMagicNumber) continue;
OpenTrades++;
//We only want one trend trade a day
if (TimeDayOfWeek(OrderOpenTime()) == TimeDayOfWeek(TimeLocal()) ) TrendTradingDoneForToday = true;
}//for (int cc = OrdersTotal() - 1; cc >= 0; cc--)
return(OpenTrades);
}//End int CountOpenTrendTrades()
Code: Select all
if (CountOpenTrendTrades() <= MaxTrades)//3
Code: Select all
//Look for a long 10.2A trend trade
. . .
if (!TrendTradingDoneForToday)//8
Code: Select all
if (TimeDayOfWeek(OrderOpenTime()) == TimeDayOfWeek(TimeLocal()) ) TrendTradingDoneForToday = true;
Code: Select all
int OpenTrades = 0;
. . .
if (TimeDayOfWeek(OrderOpenTime()) == TimeDayOfWeek(TimeCurrent()) ) TrendTradingDoneForToday = true;
Code: Select all
//Look for a long 10.2A trend trade
. . .
if (CountOpenTrendTrades() <= MaxTrades)//3
. . .
if (!TrendTradingDoneForToday)//8
Thanks again.House Brick wrote:Can you spot the problem, #3 allows up to MaxTrades but #8 TrendTradingDoneForToday blocks after 1 trade. I suggest removing the !TrendTradingDoneForToday check in the Trade allowed filters as being the easiest thing to do.
I'm just guessing though.
Ta,
HouseBrick
Code: Select all
if (TimeDayOfWeek(OrderOpenTime()) == TimeDayOfWeek(TimeLocal()) ) TrendTradingDoneForToday = true;Code: Select all
if (TimeDayOfWeek(OrderOpenTime()) == TimeDayOfWeek(TimeCurrent()) ) TrendTradingDoneForToday = true;Would the error imply that the broker is ECN but the setting is not changed to true? Or would it mean the broker isn't ECN and the setting is set to true?ovisun wrote:case 130: Error Invalid stops
Check if broker is ecn or not