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...
Code:
//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.htm

EDIT: In retrospect, don't use TMF, use Stop.

Last edited by AndrewAMD; 03/04/18 23:34. Reason: Stop instead of TMF