Max Drawdown need to be limited to 200 ticks.
I want to inform you that I want to create a limitation to my Max Daily Drawdown so I will exit my strategy when my strategy hits my input Daily drawdown input per ticks
I found this code, but I do not know if it is working well.
private double averageDrawDown = 199;
protected override void OnBarUpdate()
{
if (! Historical)
{
averageDrawDown =
0 == averageDrawDown
? Performance.AllTrades.TradesPerformance.Currency.D rawDown
: (Performance.AllTrades.TradesPerformance.Currency. DrawDown + averageDrawDown) / 2
;
DrawHorizontalLine("AverageDrawDown", averageDrawDown, Color.RoyalBlue);
//}
// code here
}
Can you help me with the subject, Please.
I really need a clear example if possible as I am a basic coder.
The drawdown is calculated at the end of each trading day, So How can I call the past data and link it to my average DrawDown input?
Thank you
Comment