Hi, I am trying to filter a MA Cross strategy using the MINMAX indicator
I have this and it makes some difference as it makes less trades now but it doesnt seem right, when I change the period for the minmax it makes no difference ? I am only at copy and paste level really
Any help would be most appreciated
double fastMA = indicators.sma(instrument, period, OfferSide.BID, IIndicators.AppliedPrice.CLOSE, fastMAPeriod, 0);
double fastMAonPreviousBar = indicators.sma(instrument, period, OfferSide.BID, IIndicators.AppliedPrice.CLOSE, fastMAPeriod, 1);
double slowMA = indicators.smma(instrument, period, OfferSide.BID, IIndicators.AppliedPrice.CLOSE, slowMAPeriod, 0);
double slowMAonPreviousBar = indicators.smma(instrument, period, OfferSide.BID, IIndicators.AppliedPrice.CLOSE, slowMAPeriod, 0);
double[] MM = null;
MM = indicators.minMax(instrument, myPeriod, OfferSide.BID,
AppliedPrice.CLOSE, 20, shift);
double Min = MM[0];
double Max = MM[0];
if (positionsTotal(instrument) == 0)
{
////////// --- Condition for BUY --- //////////
if (bidPrice > Max && fastMAonPreviousBar < slowMAonPreviousBar && fastMA > slowMA)
{
buy(instrument, engine, profitLimit, lossLimit, volume);
}
else
////////// --- Condition for Sell --- //////////
if (askPrice < Min && fastMAonPreviousBar > slowMAonPreviousBar && fastMA < slowMA)
{
sell(instrument, engine, profitLimit, lossLimit, volume);
}
}