V 3u is in post 1.
I do not fully understand mastercool's post here
http://www.stevehopwoodforex.com/phpBB3 ... 56#p168756 but this sort of post always sends me to look at the code in case I have missed something.
I have missed an entire function, so none of the Friday/Saturday close all inputs would have any effect. I have no idea if this is the cause of mastercool's problem, but it is better to have functions that I describe in the user guide
actually available.
DIYers and code checkers, a teensy bit of housekeeping first. Do a search and replace for Friday
closeAllHour, replacing it with Friday
CloseAllHour. Repeat this process with SaturdaycloseAllHour.
Copy this function wherever you want it to go. I always add new functions immediately above OnTick(), but that is just me:
Code: Select all
void shutDownForTheWeekend()
{
//Close/delete all trades to be flat for the weekend.
int day = TimeDayOfWeek(TimeLocal() );
int hour = TimeHour(TimeLocal() );
bool CloseDelete = false;
//Friday
if (day == 5)
{
if (hour >= FridayCloseAllHour)
if (totalCashUpl >= MaxAllowableCashLoss)//MaxAllowableCashLoss is a negative number
CloseDelete = true;
}//if (day == 5)
//Saturday
if (day == 6)
{
if (hour >= SaturdayCloseAllHour)
if (totalCashUpl >= MaxAllowableCashLoss)//MaxAllowableCashLoss is a negative number
CloseDelete = true;
}//if (day == 6)
if (CloseDelete)
{
closeAllTrades(allSymbols, allTrades);
if (forceTradeClosure)
closeAllTrades(allSymbols, allTrades);
if (forceTradeClosure)
closeAllTrades(allSymbols, allTrades);
}//if (CloseDelete)
}//End void shutDownForTheWeekend()
Then go to void OnTimer(). Scroll down to/search for: }//if (haveWeReachedOurTarget(PERIOD_D1) )
Copy this code block underneath:
Code: Select all
//Can we shut down for the weekend?
int d = TimeDayOfWeek(TimeLocal() );
if (d > 4)//Thursday = 4
{
if (OrdersTotal() > 0)
{
countTradesForGlobalBasket();
if (globalTradesTotal > 0)
{
shutDownForTheWeekend();
if (forceTradeClosure)
closeAllTrades(allSymbols, allTrades);
if (forceTradeClosure)
closeAllTrades(allSymbols, allTrades);
}//if (globalTradesTotal > 0)
}//if (OrdersTotal() > 0)
}//if (d > 4)

Read the effing manual, ok?
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed
Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.