3 registered members (Ayumi, Akow, AndrewAMD),
1,505
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Additional testing to be undertaken...
[Re: Hredot]
#471426
03/03/18 16:20
03/03/18 16:20
|
Joined: Feb 2017
Posts: 1,731 Chicago
AndrewAMD
Serious User
|
Serious User
Joined: Feb 2017
Posts: 1,731
Chicago
|
MAE stands for Maximum Adverse Excursion. It's a nice tool to visually determine if and where to place a stop.
Every trade made by your system is represented by a dot. If the trade was profitable, it is green and above zero. If it was unprofitable, it is red and below zero. So the higher the dot, the better.
The X axis is maximum excursion of a trade, in percentage of the trade's position.
The Y axis is profit/loss of a trade, in percentage of the trade's position.
Say you buy a stock at $100.00, it reaches a low of $99.00, and it sells at $120.00. Your trade will plot at (1.0,20.0). That is, 1% drawdown, 20% profit.
To see visually the effect of adding a percentage-based stop loss, draw a vertical line. Any greens to the right of the line become losses, and any reds become less unprofitable. Thus, it appears to be useful for 1ND1G0 and not for Hredot.
But we have Zorro, so we can easily optimize after using our visual cue.
Hredot: I like your plot, you have some very profitable trades. What I don't understand is why your system isn't profitable when it sees very small drawdowns (<=0.6% per trade). In any case, I don't think you need to add stop losses because it can hurt your profitability.
|
|
|
Re: Additional testing to be undertaken...
[Re: MatPed]
#471427
03/03/18 16:23
03/03/18 16:23
|
Joined: Feb 2017
Posts: 1,731 Chicago
AndrewAMD
Serious User
|
Serious User
Joined: Feb 2017
Posts: 1,731
Chicago
|
In case of use of oversampling the graph will plot the distribution of all trades or only of one sample? All trades. The code is in your profile.c header, so you can tweak it for your own purposes if necessary.
void plotMAEPercentGraph(int bars)
{
if(!is(TESTMODE)) return;
g->dwStatus |= PLOTSTATS;
if(is(EXITRUN))
{
if(!bars) bars = 50;
var vMaxMAE = 0;
for(all_trades) // calculate maximum MAE relative to open
vMaxMAE = max(vMaxMAE,(100.*TradeMAE/(TradePriceOpen)));
//printf("nMaxMAE: %.0f",vMaxMAE);
var vStep;
if(bars < 0) // bucket size in thousandths of percentage points (i.e. 0.001%)
vStep = (bars * (-1.) / (1000.));
else
vStep = max(0.05, roundto((vMaxMAE/bars),0.001));
printf(" Step: %.3f",vStep);
for(all_trades)
{
var vResult = (100*TradeProfit/(TradeUnits*TradePriceOpen));
var vMAE = (100.*TradeMAE/(TradePriceOpen))/vStep;
int n = floor(vMAE);
plotBar("Profit",n,n*vStep,0,AVG|BARS|LBL2,COLOR_DEV);
if(vResult > 0)
plotGraph("Win",vMAE,vResult,DOT,GREEN);
else
plotGraph("Loss",vMAE,vResult,DOT,RED);
}
}
}
|
|
|
Re: Additional testing to be undertaken...
[Re: AndrewAMD]
#471428
03/03/18 16:52
03/03/18 16:52
|
Joined: Sep 2017
Posts: 235
Hredot
Member
|
Member
Joined: Sep 2017
Posts: 235
|
Thanks for the explanation!
Btw, that plot was not from a real system. Rather an ideal one that strives to achieve optimal performance by using PEEK. It is actually surprising how hard it is to code an ideal system using only traditional indicators even when it knows the future... The idea is, if an approach does poorly when future is known, there is no chance it will succeed with only present information. A way to discard garbage ideas.
Last edited by Hredot; 03/03/18 16:54.
|
|
|
Re: Additional testing to be undertaken...
[Re: 1ND1G0]
#471432
03/03/18 18:03
03/03/18 18:03
|
Joined: Feb 2017
Posts: 1,731 Chicago
AndrewAMD
Serious User
|
Serious User
Joined: Feb 2017
Posts: 1,731
Chicago
|
I don't think that's how the Risk variable works. Anyways, I would take a different approach using trade management functions.Slightly modifying the code above, below is your percentage MAE...
//for a given trade...
var vPercentMAE = 100.*TradeMAE/(TradePriceOpen);
If you close a trade once the above variable reaches 1.0 or higher, you will have drawn a vertical line on your chart at 1.0. See how it affects your chart. And then attempt an optimization of this parameter, such as 0.5 to 1.5 in 0.1 increments, and see what you end up with on the chart. See also... (TMF, TradeMAE): http://zorro-project.com/manual/en/trade.htm(optimize): http://zorro-project.com/manual/en/optimize.htmEDIT: In retrospect, don't use TMF, use Stop.
Last edited by AndrewAMD; 03/04/18 23:34. Reason: Stop instead of TMF
|
|
|
Re: Additional testing to be undertaken...
[Re: AndrewAMD]
#471433
03/03/18 18:21
03/03/18 18:21
|
Joined: Feb 2018
Posts: 25
1ND1G0
OP
Newbie
|
OP
Newbie
Joined: Feb 2018
Posts: 25
|
Thanks again, Andrew. I'm probably doing something wrong but it seems to only make things worse when I try and add this type of trade management into the mix. I added your code to create the var, then the below:
for(open_trades)
if(vPercentMAE > 1.0)
exitTrade(ThisTrade);
Even optimising this parameter does not help. In any case, this is certainly very good to know and I will certainly use this (i.e. the MAE graph) in future development.
|
|
|
|