Hi everyone,
Would like to share with you below idea so that we can brainstorm together about optimizing it, if it makes sense to you.
The idea is to have a new module into the EA shell, to get automatically, based on the history :
- TP target(s)
- SL target(s)
- Trailing stop or JS
This module can either been used once a given EA has already generated a subsequent number of trades OR by looking at the chart history to look for trades that would have been triggered
Based on the history, the module tries to see what would have been the best values for above points (TP, SL, TS/JS). Then we will use those values for the coming trades to be opened.
I think technically speaking that could be feasible, since 2 indies have "part of the concept" :
- George's indi (DumpHistory with RunUp infos): http://www.stevehopwoodforex.com/phpBB3 ... 1760#p1760
- Squalou's sqDynamicBreakoutBox indi that calculates nbr of buys and sells that would have been trigerred, also the max number of pips that would have been pocketed, and an average of both values (see below snapshot)
Then to determine the best values we should go for, we could apply a kind of weighted average formula ??? I'm not that clear on this part, how best to get them ..
What I have no idea about, is how complex it would be to code the above into the future EAs, meaning : "check the entry signals and apply them to the history" (x days back)
Limitation about above reasonning : Is the history relevant enough to assess the coming trades ? (are the market conditions the same ? etc...)
What do you think ?
cheers
Olivier
Suggestions for a new module in EA Shell
- Gamma_gallus
- Trader
- Posts: 118
- Joined: Wed Nov 16, 2011 2:03 pm
- Location: France
Suggestions for a new module in EA Shell
You do not have the required permissions to view the files attached to this post.
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Re: Suggestions for a new module in EA Shell
I only just saw this, so sorry not to reply before.
I take it you mean my EA shell?
The shell contains the code that I customarily include in my ea's. By definition, your idea here is not customarily included and therefore has no part in my shell.

I take it you mean my EA shell?
The shell contains the code that I customarily include in my ea's. By definition, your idea here is not customarily included and therefore has no part in my shell.
Read the effing manual, ok?
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
- Gamma_gallus
- Trader
- Posts: 118
- Joined: Wed Nov 16, 2011 2:03 pm
- Location: France
Re: Suggestions for a new module in EA Shell
No worriesSteveHopwood wrote:I only just saw this, so sorry not to reply before.
You're right, I had this idea of a dynamic TP & SL, based on history, to include them into your EA shell. I have no coding logic, so I didn't know it can't be added to your shell.SteveHopwood wrote: I take it you mean my EA shell?
The shell contains the code that I customarily include in my ea's. By definition, your idea here is not customarily included and therefore has no part in my shell.
But if that makes sense to you, and provided this is not too complex to code, we can perhaps keep it in mind for some future EAs (where TP & SL are fixed values) !?!?
cheers
Olivier
-
Ribelo
- Trader
- Posts: 62
- Joined: Thu Nov 17, 2011 12:58 am
Re: Suggestions for a new module in EA Shell
I tried to calculate the take profit based on the RUN UP, but it does not make sense. RUN UP is always smaller than the take-profit, so every time Take Profit is reduced, which leads inevitably to a situation where TP = 0
IMHO a much better and simpler solution is ...
If the previous transaction was a profit and ended up on TP, the next Take Profit = SL * RR * 1.1
If the previous transaction was profitable but did not end up on TP, the next Take Profit = SL * RR * 0.9
EDIT
After thinking the matter again, I wrote some other code.
IMHO a much better and simpler solution is ...
If the previous transaction was a profit and ended up on TP, the next Take Profit = SL * RR * 1.1
If the previous transaction was profitable but did not end up on TP, the next Take Profit = SL * RR * 0.9
EDIT
After thinking the matter again, I wrote some other code.
Code: Select all
double stop.pip, take.profit.pip, calculated.rr;
double factor = 1;
int profit.count;
stop.pip = MathAbs(NormalizeDouble(open.price - stop.price, Digits ) );
if ( OrdersHistoryTotal() > 0 ) {
if ( OrdersHistoryTotal() >= 5 ) {
int count = 5;
} else {
count = OrdersHistoryTotal();
}
for ( int cc = OrdersHistoryTotal() - count; cc < OrdersHistoryTotal(); cc++ ) {
if ( OrderSelect( cc, SELECT_BY_POS, MODE_HISTORY ) ) {
if ( OrderType() == OP_BUY ) {
if ( OrderProfit() > 0 ) {
if ( OrderClosePrice() + hidden.pips * Point >= OrderTakeProfit() ) {
profit.count++;
}
if ( OrderClosePrice() + hidden.pips * Point < OrderTakeProfit() ) {
profit.count--;
}
}
}
if ( OrderType() == OP_SELL ) {
if ( OrderProfit() > 0 ) {
if ( OrderClosePrice() - hidden.pips * Point <= OrderTakeProfit() ) {
profit.count++;
}
if ( OrderClosePrice() - hidden.pips * Point > OrderTakeProfit() ) {
profit.count--;
}
}
}
}
}
if ( profit.count != 0 ) {
if ( profit.count > 0 ) {
factor = MathPow( 1.1, profit.count );
}
if ( profit.count < 0 ) {
factor = MathPow( 0.9, -profit.count );
}
}
}
Print("profit.count: ",profit.count);
calculated.rr = total.risk.reward * factor;
calculated.rr = MathMax( calculated.rr, min.rr );
Print("calculated.rr ",calculated.rr);
take.profit.pip = stop.pip * calculated.rr;
Print("take.profit.pip ",take.profit.pip / Point);
return( take.profit.pip );