Quote:
Originally Posted by Neo
Ok, Don...here's how to sort the trend filtering:
extern int MAPeriod = 1200;
double Trend = iMA(NULL, 0, MAPeriod, 0, MODE_LWMA, MODE_CLOSE, 0);
should be...
double Trend = iMA(NULL, PERIOD_M1, MAPeriod, 0, MODE_LWMA, MODE_CLOSE, 0);
as your existing code uses 1200 periods of the current chart timeframe
And for the Buy and Sell routines, you're missing some brackets so the logic is currently wrong so these:
if (Ask < LowestBuy-(Spacing*Point) || Ask > HighestBuy + (TrendSpacing * Point) && Ask > Trend)
if (Bid > HighestSell + (Spacing * Point) || Bid < LowestSell - (TrendSpacing * Point) && Bid < Trend)
should be replaced with:
if ((Ask < LowestBuy-(Spacing*Point) || Ask > HighestBuy + (TrendSpacing * Point)) && Ask > Trend)
if ((Bid > HighestSell + (Spacing * Point) || Bid < LowestSell - (TrendSpacing * Point)) && Bid < Trend)
Good luck, Neo
|
According to the help file:
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
By putting in PERIOD_M1, you are locking in the 1M timeframe no matter what. I was even thinking of having a couple of externs so people could customize the MA, like one for TF and one for type of MA.
Nice catch on the brackets. I didn't think that would matter.
The closes are still not 100% doing what they are supposed to doing. Same situation above buys and below sells not closing out the losing opposite order all the time.
Don