I finally cracked open the source file and found that
Code: Select all
ShutDownForTheWeekend()Where should this be called...OnTimer?
Cheers,
BobbyT
Code: Select all
ShutDownForTheWeekend()Nice one BobbyT. Thanks.BobbyT » Sat Apr 14, 2018 11:43 pm wrote:I've been patiently waiting for the Friday closures to kick in over the past few weeks but it has never come despite having either individual pairs or the entire account in profit.
I finally cracked open the source file and found thatis never called.Code: Select all
ShutDownForTheWeekend()
Where should this be called...OnTimer?
Cheers,
BobbyT
But imbibing andSteveHopwood » Sat Apr 14, 2018 5:57 pm wrote: Nice one BobbyT. Thanks.![]()
![]()
I will correct this over the weekend. Damn, it is the weekend. I have imbibed at the time of writing this, so please nag if a fix does not appear tomorrow. Imbibing and coding do not mix. Nor do imbibing and promising to code.
![]()
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()
Code: Select all
//Can we shut down for the weekend
if (TotalOpenTrades > 0)
ShutDownForTheWeekend();
Thanks for bringing it up Dragonian. I had not noticed because SPB is doing his thingy on VPS so I have not used the display features.tomele wrote:Hi Steve.
Bill pointed me to that:
Looking through the code, I saw that tradingstatus[] is no more used and populated. ChartAutomation() and my view on tradable pairs have ceased to work. Shouldnt both use the new PeakyStatus?Dragonian wrote: Hello Thomas,
I've noticed that on the latest version of SPB the "Tradable Pairs Unrealized P/L" column seems to show all pairs, not just tradable pairs. Or am i missing something?
Cheers
Code: Select all
if (TotalCashUpl < MaxAllowableCashLoss)//MaxAllowableCashLoss is a negative number
CloseDelete = true;
Code: Select all
if (TotalCashUpl < 0)
{
if (TotalCashUpl >= MaxAllowableCashLoss)//MaxAllowableCashLoss is a negative number
CloseDelete = true;
} // End if (TotalCashUpl < 0)