tomele » Sun Jun 23, 2019 12:06 pm wrote:Hi again.
All global variables that start with TD..., but not TDTRADE... (signals for trading drones) or TDSIG... (signals from drone indicators) are internal variables, mainly for remembering TDesk states after a crash or restart. They are not meant to be used or tampered with by other programs. I will not discuss them.
I strongly advise to only use TDesk.mqh (for sending signals to TDesk) and TDeskSignals.mqh (for reading signals from TDesk). They keep things consistent and there is no additional information that could get derived from reading global variables directly. You will rather mess up the whole system. There will be no support from my side for such problems.
Cheers
Thomas
Hi Thomas,
I did not ask without a reason. Tdesk + Partner EA in combination in specific situations and configurations generate an incorrect purchase or sale signal.
This happens against the logic and setup of my strategy set in TDesk.
The error is difficult to see if you use many drones. You have to sit all the time and control each newly opened transaction to notice the problem.
Even on the M5 occurs only once for a dozen new open transactions or every few hours. Less inquisitive Trader can ignore such an incorrect position and take SL.
For me, this is a mistake that undermines my strategy, but someone else can say that everything is OK - that was the idea for TDesk.
I wrote an amendment to Partner EA that completely eliminates the problem.
I do not know the TDesk code so the following description of the cause of the error is just my hypothesis. For simplicity only BUY - an example simplified description.
In EA Partner, I have set: MaxSignalAgeMinutes = 3
Tdesk
1. Input only SOLO +100 - the new position opens - OK
2. The VetoSignal and the drone with ForceExit are shown closing the position - OK
3. After a few more minutes, Veto disappears - OK
3. At this point, ValueSolo has, for example, only +33.
4. At this point, SuperSignal returns from the VETO state to its previous state - that is, LONG and simultaneously updates the SuperSignal time variable in GLOBAL - an error is likely to occur here.
! Tdesk does not check if LONG is still valid. - Error
The EA partner sees the change of time in Global for SuperSignal and treats it as a new signal to open (renew) the new position - !!! wrong position, because at this moment SoloValue already has a value of only +33 and the assumption of the entry strategy is not met.
The hypothetical error is that after the disappearance of VETO SuperSignal returns to the previous status (for example LONG) without checking if it is still valid.
Perhaps this is also the case in other cases, such as blocking by SPREAD or NEWS and others?
In my strategy, I generate the VETO signal just to use ForceEXIT - in VETO and ForceEXIT I have the same Drones reported.
A simple amendment to Partner EA completely eliminates the problem.
The original TdeskSignal.mqh gets
Code: Select all
int TDeskSValues []; // Array holding the Solo Signal values
int TDeskMValues []; // Array holding the Multi Signal values
so we can use them directly in the EA Partner.
We add the following Code to the EA Partner:
Code: Select all
//1.34
extern string gen1="----General inputs OPEN SOLO/Multi Signal first New Position----";
extern string gen11="--------";
extern string gen12="----Only one option can be -TRUE- SOLO or MultiAndSolo----";
extern string gen13="----If both Option -FALSE- EA use orginal TDesk signals----";
extern bool UseDirectSoloValueSignalEntryThreshold = false;
extern bool UseDirectSoloAndMultiValueSignalEntry = false;
extern string gen14="---- SOLO Value ----";
extern int BuySoloValueEntryThreshold = 95;
extern int SellSoloValueEntryThreshold = -95;
extern string gen15="----MULTI Value ----";
extern int UseBUYMultiSignalEntryThreshold = 10;
extern int UseSELLMultiSignalEntryThreshold = -10;
//END 1.34
The original section of the position opening code
Code: Select all
void detectTradingSignal(int pairIndex, int signal)
{
if (openTrades == 0)
{
buySignal = false;
sellSignal = false;
if ((TimeLocal() - TDeskTimes[pairIndex]) / 60 <= MaxSignalAgeMinutes || MaxSignalAgeMinutes == 0)
{
if (signal == LONG)
buySignal = true;
if (signal == SHORT)
sellSignal = true;
}//if (if ((TimeLocal() - TDeskTimes[pairIndex]) / 60 <= MaxSignalAgeMinutes))
}//if (openTrades == 0)
}//End void detectTradingSignal(int pairIndex, int signal)
we replace
Code: Select all
//1.34 open first new position to work Direct with SOLO/Multi Signal
void detectTradingSignal(int pairIndex, int signal )
{
if (UseDirectSoloValueSignalEntryThreshold)
{
if (openTrades == 0)
{
buySignal = false;
sellSignal = false;
if ((TimeLocal() - TDeskTimes[pairIndex]) / 60 <= MaxSignalAgeMinutes || MaxSignalAgeMinutes == 0)
{
if (TDeskSValues[pairIndex] > BuySoloValueEntryThreshold)
buySignal = true;
if (TDeskSValues[pairIndex] < SellSoloValueEntryThreshold)
sellSignal = true;
}//if (if ((TimeLocal() - TDeskTimes[pairIndex]) / 60 <= MaxSignalAgeMinutes))
}//if (openTrades == 0)
} // if (UseDirectSoloValueSignalEntryThreshold)
else
if (UseDirectSoloAndMultiValueSignalEntry)
{
if (openTrades == 0)
{
buySignal = false;
sellSignal = false;
if ((TimeLocal() - TDeskTimes[pairIndex]) / 60 <= MaxSignalAgeMinutes || MaxSignalAgeMinutes == 0)
{
if ((TDeskSValues[pairIndex] > BuySoloValueEntryThreshold) && (TDeskMValues[pairIndex] > UseBUYMultiSignalEntryThreshold))
buySignal = true;
if ((TDeskSValues[pairIndex] < SellSoloValueEntryThreshold) && (TDeskMValues[pairIndex] < UseSELLMultiSignalEntryThreshold))
sellSignal = true;
}//if (if ((TimeLocal() - TDeskTimes[pairIndex]) / 60 <= MaxSignalAgeMinutes))
}//if (openTrades == 0)
} // if (UseDirectSoloAndMultiValueSignalEntry)
else
// Orginal System
if (openTrades == 0)
{
buySignal = false;
sellSignal = false;
if ((TimeLocal() - TDeskTimes[pairIndex]) / 60 <= MaxSignalAgeMinutes || MaxSignalAgeMinutes == 0)
{
if (signal == LONG)
buySignal = true;
if (signal == SHORT)
sellSignal = true;
}//if (if ((TimeLocal() - TDeskTimes[pairIndex]) / 60 <= MaxSignalAgeMinutes))
}//if (openTrades == 0)
}//End void detectTradingSignal(int pairIndex, int signal)
//End 1.34
and that's all.
Now if we use only SOLO or MultiAndSOLO to open a new position, everything works without a problem - At least for ME
Of course, you must correlate SOLO and MULTI values in Tdesk and ParterEA.
The above changes only for those users who have the same problem and understand what they are doing and why. The fact that it works with me does not mean that it will work with your strategy.
! I hope I will not get a lifetime Ban for the above entry.
Regards,
Wojtek