Hello,
I have a profit stop based on the basic looping technique shown "Back
testing your trading ideas". To that code I've added a switch to
disable the stop when there is at strong uptrend, like this:
ADXprofitperiod = 3;//Optimize( "APP", 3, 2, 14, 1 );
NoProfitTrigger = ( PDI( ADXprofitperiod ) > MDI( ADXprofitperiod )
AND PDI( ADXprofitperiod ) > ADX( ADXprofitperiod ) );
While NoProfitTrigger is True, the profit stop is ignored. It doesn't
create a big gain, but UPI, for instance, is improved 4 - 6%.
I would like to explore whether having ADXprofitperiod vary by the ROC
or LinRegSlope of the Close would enhance the results over using a
fixed period for all trades. Of course I get an out of range error if
I try to use:
ADXprofitperiod = ROC( Close, 7 );
ADXprofitperiod = 3;//Optimize( "APP", 3, 2, 14, 1 );
NoProfitTrigger = ( PDI( ADXprofitperiod ) > MDI( ADXprofitperiod )
AND PDI( ADXprofitperiod ) > ADX( ADXprofitperiod ) );
I tried the following,
ADXprofitperiod = ROC( Close, 7 );
...start of loop code...
for(...
{
NoProfitTrigger = ( PDI( ADXprofitperiod[i]) >
MDI( ADXprofitperiod[i] ) AND PDI( ADXprofitperiod[i] ) >
ADX( ADXprofitperiod[i] ) );
//test for profitstop and NoProfitTrigger
}
...end of loop code...
but using the MDI/PDI/ADX indicators in the loop caused execution to
grind to a halt. Well, that's my assumption, there was no error
message - I had to use Task Manager to shut down AB.
Any ideas gratefully accepted.
Thanks,
Joe