My account is in Aussie dollars but messages are showing it in pounds.
It would be nice if it was true as it would be a nice increase
All of David's suggestions are clearly correct so I adopted them without hesitation.davista wrote:Hi Steve
I've noticed a couple of possible minor bloops in Desky v1r which, although I doubt have anything whatsoever to do with the problem with individual basket trading errant open/closing, I thought I'd flag 'em anyway.
On Oct 20th you posted a fix in //Hedging:
However in line 4170 of version 1r I notice it's still pairIndex++Subject: Desky. TDesk's trading drone.
Looking at the code and nothing to do with what we are discussing here, highlights a bloop. Line 3830 in V 1k is this: pairIndex++;
This should clearly be:
pairIndex--;
Is this correct or should it be pairIndex--?Code: Select all
if (hedged) { CanWeRemoveTheHedge(symbol, pairIndex); if (ForceTradeClosure) { pairIndex++; continue; }//if (ForceTradeClosure)
Also, in void CanPendingsBeDeleted(string symbol)
Line 2576 of version 1r is:
Should this be ArraySize(TDeskSymbols); ?Code: Select all
for (int PairIndex = 0; PairIndex < ArraySize(TDeskSignals); PairIndex++)
Cheers, David
Here we are developing the most sophisticated trading software in the entire history of Forex trading software, and you I think about this?Barcode » Tue Oct 30, 2018 10:48 pm wrote:Steve,
My account is in Aussie dollars but messages are showing it in pounds.
Nice spot. Thanks.Bruster400 » Wed Oct 31, 2018 1:48 pm wrote:Having great fun testing out different strategies with this EA.No big deal, one for a future updates maybe.... I've just tried switching "StopTrading" to "true" and it didn't do anything. I've looked and the bool isn't checked in the code anywhere - I might be out of date(version 1p), so if this is already fixed then delete this.
Thanks for that Thomas - most helpful.
I am used from stocks and options trading to set TPs and SLs in percent of price. For example a TP of 10% means a $20 stock has to move $2, while a $200 stock has to move $20.
This problem is to a smaller degree also existent in Forex. Lets take USDCAD with a price around 1.30 and NZDUSD with a price around 0.65. To achieve a 100 pips TP, NZDUSD would have to move twice as much than USDCAD in relation to the price.
A pip is defined as a change of ±1 at the 5th digit of price. Hence the 10000th (0.0001) fractions. 100 of these fractions equal 100 pips if the price is exactly 1.0.
For USDCAD (@1.30) 100 of these fractions equal 130 pips while for NZDUSD (@0.65) 100 of these fractions equal 65 pips. If we calculate SLs and TPs this way, each pair now has to move the same distance relative to its price.
Code: Select all
//Is there a trading signal?
if (OpenTrades == 0)
{
BuySignal = false;
SellSignal = false;
if ((TimeLocal() - TDeskTimes[pairIndex]) / 60 <= MaxSignalAgeMinutes)
{
if (signal == LONG)
BuySignal = true;
if (signal == SHORT)
SellSignal = true;
}//if (if ((TimeLocal() - TDeskTimes[pairIndex]) / 60 <= MaxSignalAgeMinutes))
}//if (OpenTrades == 0)
Code: Select all
if (UseGridTrading)
SM("Grid trading is enabled" + NL);
Code: Select all
void CountTradesForGlobalBasket()
{
//Counts all open trades when the user is trading an all-position basket
TotalPipsUpl = 0;//Global pips total
TotalCashUpl = 0;//Global cash total
ArrayFree(GlobalTickets);
ArrayResize(GlobalTickets, 0);
GlobalTradesTotal = 0;
int pips = 0;
int cc = 0;
if (OrdersTotal() == 0)
return;
for (cc = OrdersTotal() - 1; cc >= 0; cc--)
{
//bool TradeWasClosed = false;//See 'check for possible trade closure'
//Ensure the trade is still open
if (!BetterOrderSelect(cc, SELECT_BY_POS, MODE_TRADES) ) continue;
//Ensure the EA 'owns' this trade
if (OrderMagicNumber() != MagicNumber) continue;
if (OrderCloseTime() > 0) continue;
//We are only concerned with market trades here
if (OrderType() < 2)
{
TotalCashUpl+= OrderProfit() + OrderSwap() + OrderCommission();
pips = (int) CalculateTradeProfitInPips(OrderType());
TotalPipsUpl+= pips;
GlobalTradesTotal+= 1;
}//if (OrderType() < 2)
//Store the ticket numbers of all order types for closure/deletion
ArrayResize(GlobalTickets, GlobalTradesTotal + 1);
GlobalTickets[GlobalTradesTotal] = OrderTicket();
}//for (cc = OrdersTotal() - 1; cc >= 0; cc--)
//Sort ticket numbers for FIFO
if (ArraySize(GlobalTickets) > 0)
ArraySort(GlobalTickets, WHOLE_ARRAY, 0, MODE_DESCEND);
}//End void CountTradesForGlobalBasket()Code: Select all
//This came from DigitalCrypto. Thanks David.
if (TreatAllPairsAsBasket)
{
sizingInfo = "Global basket take profit is active. Market trades count = " + IntegerToString(GlobalTradesTotal);
if (BasketTargetCash > 0)
sizingInfo += ": All pair basket cash take profit = " + AccountCurrency() + " " + DoubleToStr(BasketTargetCash, 2)
+ ": Current = " + DoubleToStr(TotalCashUpl, 2) + ": Highest = " + DoubleToStr(HighestCashUpl, 2);
if (BasketTargetPips > 0)
sizingInfo += ": All pair basket take profit pips = " + IntegerToString(BasketTargetPips)
+ ": Highest = " + IntegerToString(HighestPipsUpl);
}
SM(sizingInfo + NL);