A work in progress using RSI(13). By no means complete or perfect. The account the ea is attached to should allow simulaneous long & short trades. Zip file contains "every tick" backtest
Attached File(s)
Divergence and hidden Divergence 122 replies
Detecting Fake Price Movements - Convergence Divergence Indicator 74 replies
Relative Strength Average Convergence Difference indicator 4 replies
DislikedFor some reason, I cannot get your EA to test on my data. Testing was OOTB on the 4hr chart.Ignored
//external variables extern int TradePeriod =240; // chart period extern int RSIPeriod =13; // number of RSI bars (period) extern double Lots =0.1; // extern double LotMultiplier =15.0; // Base Lot = 0.01 per $1000.00 extern double SLMultiplier =0; // 0= no stop loss, else multiple of atr extern double TakeMultiplier =2.618; // multiple of atr extern double TrailMultiplier=0.618; // multiple of atr extern double ATRmultiplier =0.618; extern int ATRTimePeriod =10080; extern int ATRperiod =3; extern int ATRshift =1; extern int MagicNumber =10203;
DislikedHI,
Although the journal tab offers no clues, I would suspect it may have something to do with lot sizing.?.? Ebont74Ignored
DislikedGood point, does the account you've applied this to trade fractional lots? If not, set "Lots" to 1, and "LotMultiplier" to 1 for a quick fix. I'll work on a solution to distinguish between whole lot accounts, and fractional lot accounts.
The first attached screenshot shows divergence, the price trending higher and the indicator trending lower, using limit orders, sell the highs, exit all at a multiple of atr below the average sell price. This prevents lower priced shorts from becoming large losers should price not fall far enough to make them profitable.
The second attached screenshot shows convergence, the price trending lower and the indicator trending higher. Again using limit orders, buy the lows and exit all at a multiple of atr above the average buy price, with the same goal of preventing higher priced longs from becoming large losers should price fail to recover enough to make them profitable.
A larger TP multiple could be used, but there is a risk that the market will continue to trend against the current signal, and retracements will not close out earlier signals exposing the account to large drawdowns and potential collapse. I'm still searching for a suitable TS mechanism to allow the maximal "let profits run" goal, while minimizing risk exposure.
Thanks for the link... will research more and perhaps incorporate the two.Ignored
DislikedAnother approach would to not differentiate between mini, mico and normal accounts, by just using NormalizeDouble in something like this
extern double Lots = 0.1;
extern bool AutoMoneyMgmt= true;
extern double PercentRisk = 1;
extern double StopLoss = 40;
Start()
{
double risk = PercentRisk / 100;
// Auto money Management here
if ( AutoMoneyMgmt )
Lots = NormalizeDouble( AccountBalance()*risk/StopLoss/10,2);
}
This would give a lots size of 2 digits.
Of couse not seeing your code for how you are handling MM, this might be to simplistic, but it may help.Ignored
extern double Lots =0.05; //
extern double LotMultiplier =15.0; // Base Lot = 0.01 per $1000.00
//set lots
Margin=MathMin( MathMin(AccountBalance(),AccountEquity()) , AccountFreeMargin() );
if(Margin > Balance) { Balance = Margin; }
lots=NormalizeDouble( (Balance/100000)*(LotMultiplier) , 2);
if(lots<Lots) lots=Lots;
if(lots>10) lots=10; DislikedThanks SMJ,
The existing code is similar, instead of percent risk, it trades 0.01 lot per $1000.00 equity, with the option to increase based on the tolerances of the user...
Inserted Codeextern double Lots =0.05; // extern double LotMultiplier =15.0; // Base Lot = 0.01 per $1000.00 //set lots Margin=MathMin( MathMin(AccountBalance(),AccountEquity()) , AccountFreeMargin() ); if(Margin > Balance) { Balance = Margin; } lots=NormalizeDouble( (Balance/100000)*(LotMultiplier) , 2); if(lots<Lots) lots=Lots; if(lots>10) lots=10;Ignored
DislikedI tried your suggestion, but it is still not working. Sorry for the trouble, I really am trying to get it working. ...who is your broker? i use ibfx...
Quick note: when I attach it to a visual tester, all of the comments are up in the right hand side of the screen and are cut off so that I cannot read the whole word or see the value that it is displaying. Maybe this has something to do with it?? Corrupted? ...make sure chart is shifted to the left, look at attached screenshot...
Maybe for now, I will just put it on a chart on multiple pairs to see how it does. I can see that you have a input for timeframe, does it matter how low I go with this? I understand that as a general rule divergence is better on larger timeframes, but just for the sake of getting it to work. ...a setting of "0" for "TradePeriod" will use what ever period data the chart is open on.
Thanks for your explination of the function. I have been looking for an EA that does just as you described. I was actually going to try and build it around the indicator in the link, I mean somehow talk someone else into doing it. It seems that what youe call convergence, I was reffering to as reverse divergence....same difference. ...if during visual testing, you pause and apply the indicator (RSI(13),close prices) to the chart, trendlines should be plotted on both the price window, and indicator window.
Thanks, Ebont 74Ignored
DislikedThis is interesting I have never seen MM handled this way...
To me it seems a bit arbitrary. I mean the trade should determine the stop size or there should be an understanding of stop size before going into the trade and then the stop should be used it deternining the lots size based on the risk amount and the balance, or the margin, or the equity.
It could be that you have a different way of figuring stop loss. But for me this is what I want to know first and the lots size comes out of this knowledge...
Thanks for sharing this. You have educated me as to a different approach.
BTW, I especially like the use of the mathmin function.. I had not even thought of this..Ignored
//set lots
Margin=MathMin( MathMin(AccountBalance(),AccountEquity()) , AccountFreeMargin() );
if(Margin > Balance) { Balance = Margin; }
lots=NormalizeDouble( (Balance/100000)*LotMultiplier , 2);
if(lots<Lots) lots=Lots;
[color=navy]if(lots<MarketInfo(Symbol(),23) ) lots = MarketInfo(Symbol(),23); [/color][color=black]//min lot[/color]
[color=navy]if(lots>MarketInfo(Symbol(),25) ) lots = MarketInfo(Symbol(),25);[/color] //max lot Dislikedcan i know your broker ?
my broker doesnt have mini or micro lot , so i can not use this EX4 to back test !
ThanksIgnored