Somehow I do not understnad how the ADX code can ever return anything else than flat:
Code: Select all
string checkAdxForTrendConfirmation(string symbol, int pairIndex)
{
//Read ADX to ascertain the direction and strength of the movement.
string strengthConfirmation = flat;//Default <---------------- FLAT
double strength = 0, plusD1 = 0, minusD1= 0;
strength = getADX(symbol, AdxTimeFrame, AdxPeriod, AdxApplyTo, MODE_MAIN, 0);
plusD1 = getADX(symbol, AdxTimeFrame, AdxPeriod, AdxApplyTo, MODE_PLUSDI, 0);
minusD1 = getADX(symbol, AdxTimeFrame, AdxPeriod, AdxApplyTo, MODE_MINUSDI, 0);
//Check long trade trigger
if (trigger == up)
{
if (plusD1 < minusD1 || strength < AdxMinimumForTrading || strength > AdxMaximumForTrading)
strengthConfirmation = flat; <---------------- FLAT should be up IMHO
}//if (trigger == up)
//Check short trade trigger
if (trigger == down)
{
if (plusD1 > minusD1 || strength < AdxMinimumForTrading || strength > AdxMaximumForTrading)
strengthConfirmation = flat; <---------------- FLAT should be down IMHO
}//if (trigger == down)
// TDesk code
if (SendToTDesk)
{
if(strengthConfirmation == up ) PublishTDeskSignal("ADX",AdxTimeFrame,symbol,LONG); else
if(strengthConfirmation == down ) PublishTDeskSignal("ADX",AdxTimeFrame,symbol,SHORT);else
PublishTDeskSignal("ADX",AdxTimeFrame,symbol,FLAT);
}//if (SendToTDesk)
return(strengthConfirmation); <---------------- FLAT
}//End string checkAdxForTrendConfirmation(string symbol, int pairIndex)
Function called via:
Code: Select all
//ADX
if (UseAdxForStrengthConfirmation)
{
strengthConfirmation = checkAdxForTrendConfirmation(symbol, pairIndex);
if (strengthConfirmation != up)
return(false);//Not a strong enough trigger for trading
}//if (UseAdxForStrengthConfirmation)
Is it a bug or am I not seeing the full picture?
It confused me that Woodlands set made trades while this can't confirm the strenght. But it shows that the setup does not care about ADX while it is enabled. Because is has also set AllTriggersMustAgree=true
Code: Select all
//Trend confirmation.
if (!AllTriggersMustAgree)//Te getTradeTrigger() function takes
//care of this if AllTriggersMustAgree is enabled.
if (!doStrengthConfirmation(symbol, pairIndex) )
return;
Or is the "empty" line 3 the reason for checking if (!doStrengthConfirmation(symbol, pairIndex) ) always?