Experts: Self Optimizing RSI or MFI Trader

 

Self Optimizing RSI or MFI Trader:

This robot optimizes the values it uses for overbought and oversold based on what would have been profitable during the Optimization periods(bars) back. Using the strategy of selling when the index indicator crosses below overbought and buying when the index indicator crosses above oversold.

Author: John Davis

Self Optimizing RSI or MFI Trader
Self Optimizing RSI or MFI Trader
  • www.mql5.com
It is a dream of mine to have a robot that optimized itself, that way I would know that it was always working with the best values. This is my humble attempt to bring a piece of my dream into reality. The attached expert advisor optimizes the overbought and oversold levels that it uses to make trades. It is my wish that others could take this...
 

 First,thanks to Author for his efforts and contribution,it is really very explanatory code (brief descriptions at mostly important code lines inside code) for to better understanding,yes there is much room to be extended,for example some more needy features and possibility to apply best custom indicators (rsi/mfi) in place built in - time control and some kind filtering trade features.

regards

 
mntiwana:

 First,thanks to Author for his efforts and contribution,it is really very explanatory code (brief descriptions at mostly important code lines inside code) for to better understanding,yes there is much room to be extended,for example some more needy features and possibility to apply best custom indicators (rsi/mfi) in place built in - time control and some kind filtering trade features.

regards


Thank you mntiwanna for your comment.

I think you have a genius idea there with creating the ability to optimize custom indicators, I did not think of that before, but it seems to me to be a real possibility.

So, to sum up, your comment I have found three salient points.

  1. Add the ability to optimize custom indicators.
  2. Add some time of time controls, I presume for when to trade and when not to.
  3. Trade filtering features.

Could I request that you elaborate a little on the trade filtering features, what trade filtering features would you recommend? I am thinking of say using another indicator such as the Average Directional Index (ADX) to limit when a trade is taken or not. Something like if ADX is below 25 take trades that counter the current trend and if it is above 25 take trades with the trend. But I am sure I don't know what filtering methods are best.

Thanks again.

 
John Davis:

Thank you mntiwanna for your comment.

I think you have a genius idea there with creating the ability to optimize custom indicators, I did not think of that before, but it seems to me to be a real possibility.

So, to sum up, your comment I have found three salient points.

  1. Add the ability to optimize custom indicators.
  2. Add some time of time controls, I presume for when to trade and when not to.
  3. Trade filtering features.

Could I request that you elaborate a little on the trade filtering features, what trade filtering features would you recommend? I am thinking of say using another indicator such as the Average Directional Index (ADX) to limit when a trade is taken or not. Something like if ADX is below 25 take trades that counter the current trend and if it is above 25 take trades with the trend. But I am sure I don't know what filtering methods are best.

Thanks again.

Hi John Davis,

Nice work. I'm assuming you are training using brute force. You could implement the training using Particle Swarm, my favorite or the Genetic Algorithm, both significantly faster.  Both can be found on the forum by a quick search.

Shep

 
John Davis:

Thank you mntiwanna for your comment.

I think you have a genius idea there with creating the ability to optimize custom indicators, I did not think of that before, but it seems to me to be a real possibility.

So, to sum up, your comment I have found three salient points.

  1. Add the ability to optimize custom indicators.
  2. Add some time of time controls, I presume for when to trade and when not to.
  3. Trade filtering features.

Could I request that you elaborate a little on the trade filtering features, what trade filtering features would you recommend? I am thinking of say using another indicator such as the Average Directional Index (ADX) to limit when a trade is taken or not. Something like if ADX is below 25 take trades that counter the current trend and if it is above 25 take trades with the trend. But I am sure I don't know what filtering methods are best.

Thanks again.


Yes,ADX is pretty ok including 3 MA crossing addition - some experts advises to see in HTF what happening there as for one more additional confirmation

but i dont know about brute force and or particle swarm,can you explain shefard how it can be applied here when fixed values are already adapted

 
mntiwana:

Yes,ADX is pretty ok including 3 MA crossing addition - some experts advises to see in HTF what happening there as for one more additional confirmation

but i dont know about brute force and or particle swarm,can you explain shefard how it can be applied here when fixed values are already adapted

Hi mntiwana,

Brute force refers to a training method that goes through all the possible combinations in optimization. What method are you using?


Shephard

 

Can u give best settings you have found?


Thank you

 
hi friends i am a newbe , i installed this EA and its smily in now smilying , and i checked live trading , but this did not started a single trade by itself. i used it on many charts but no trading yet. do i have to do something else
 

Hi, looking good!


i tried settings on eur/usd 5 min chart and got only winning results. from 100 eur to 5000+ with 1 year backtest. Next ill test it on demo trading next week to see real results.

magic=4376

magic,F=1

magic,1=4376

magic,2=0

magic,3=0

optomizingPeriods=360

optomizingPeriods,F=1

optomizingPeriods,1=360

optomizingPeriods,2=1

optomizingPeriods,3=1490

inAggressive=1

inAggressive,F=0

inAggressive,1=1

inAggressive,2=-1

inAggressive,3=0

inTradeReverse=0

inTradeReverse,F=0

inTradeReverse,1=1

inTradeReverse,2=-1

inTradeReverse,3=0

inOneOrderAtATime=0

inOneOrderAtATime,F=0

inOneOrderAtATime,1=0

inOneOrderAtATime,2=1

inOneOrderAtATime,3=1

Lot_sizing_dynamic_invalidates_static=

Lots=0.01000000

Lots,F=0

Lots,1=0.01000000

Lots,2=0.00000000

Lots,3=0.00000000

inUseDynamicLotSize=1

inUseDynamicLotSize,F=0

inUseDynamicLotSize,1=1

inUseDynamicLotSize,2=-1

inUseDynamicLotSize,3=0

inPercentageOfRisk=2.00000000

inPercentageOfRisk,F=0

inPercentageOfRisk,1=2.00000000

inPercentageOfRisk,2=0.00000000

inPercentageOfRisk,3=0.00000000

Index_Indicator_Values=

index=1

index,F=0

index,1=0

index,2=0

index,3=0

IndicatorTopValue=100

IndicatorTopValue,F=0

IndicatorTopValue,1=100

IndicatorTopValue,2=0

IndicatorTopValue,3=0

IndicatorBottomValue=0

IndicatorBottomValue,F=0

IndicatorBottomValue,1=0

IndicatorBottomValue,2=0

IndicatorBottomValue,3=0

IndyTimeframe=1440

IndyTimeframe,F=0

IndyTimeframe,1=0

IndyTimeframe,2=0

IndyTimeframe,3=0

inIndyPeriods=14

inIndyPeriods,F=0

inIndyPeriods,1=36

inIndyPeriods,2=1

inIndyPeriods,3=149

IndyAppPrice=0

IndyAppPrice,F=0

IndyAppPrice,1=0

IndyAppPrice,2=0

IndyAppPrice,3=0

SL_TP_Dynamic_invalidates_static_values=

iStoploss=1000

iStoploss,F=0

iStoploss,1=1000

iStoploss,2=0

iStoploss,3=0

iTakeprofit=2000

iTakeprofit,F=0

iTakeprofit,1=2000

iTakeprofit,2=0

iTakeprofit,3=0

inDynamic=1

inDynamic,F=0

inDynamic,1=0

inDynamic,2=1

inDynamic,3=1

inStoplossMultiple=2.00000000

inStoplossMultiple,F=0

inStoplossMultiple,1=2.00000000

inStoplossMultiple,2=0.00000000

inStoplossMultiple,3=0.00000000

inTakeProfitMultiple=7.00000000

inTakeProfitMultiple,F=0

inTakeProfitMultiple,1=7.00000000

inTakeProfitMultiple,2=0.00000000

inTakeProfitMultiple,3=0.00000000

Break_Even_Settings=

bUseBreakEven=0

bUseBreakEven,F=0

bUseBreakEven,1=0

bUseBreakEven,2=1

bUseBreakEven,3=1

inTrigger=200

inTrigger,F=0

inTrigger,1=200

inTrigger,2=0

inTrigger,3=0

inPadding=100

inPadding,F=0

inPadding,1=100

inPadding,2=0

inPadding,3=0


 

Hello John,

i just downloaded ur EA, launched on EUR/USD Pair on the 1 Minute Chart, it gives a looooooooot of loss trades, and only very very few Profit ones, upon seting up, i left default parameters, should i correct something to make it work properly ? i mean to work for profits not losses.


Thnx a lot

 
There is a coding  bug in lines 137 to 142. Because of missing brackets the conditional expressions don't evaluate as intended. As the effect the EA always uses the RSI indicator for the previous bar, regardless the settings.