fxdaytrader wrote:I think I have found one more little bloop in CalculateStopLoss()
The logics is as follows:
Code: Select all
if (type == OP_BUY)
{
if (!CloseEnough(StopLoss, 0) )
{
if (OpenTrades == 0) stop = xyz
else stop = STACKstuff
The problem is, the function is called by insertstoploss() also. And of course, we do have at least 1 trade open then. So to make sure we treat the right trades, I suggest to have a look to the ordercomment().
V 2c is in post 1 with the fix for the bloop that fxdaytrader spotted.
Marc, when I settled in to look at this, I realised that LookdForTradingOpportunities() was sending stack trades with a stop loss because this is what we needed at the start of BASA's development. Then CountOpenTrads() removes the stop as soon as it discovers there is a stack basket open.
We still need BASA to calculate the sl for stack trades for traders using risk-based lot sizes, so I have left the sl calculation calls and added:
Code: Select all
//Do not send a sl with a stack trade
if (TradeComment == StackTradeComment) stop = 0;
at Scite line 1616.
CalculateStopLoss() is now a simplified snippet because we do not need the conditionals to separate Main from Stack trades.
We no longer need StackStopLossDivisor and it would muck up the risk based calculations, so I commented out the extern and deleted references to it where the error messages directed.
Look the code over and see if you can easily adapt it to your multi-trader.

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.