Backtesting equity chart problem (API v3.5)
Backtesting equity chart problem (API v3.5)
29 Jun 2019, 02:41
Hi there,
I wanted to report that after the API update while i'm using this custome Trailing Stop from click algo tutorials, the equity chart fails to produce the correct equity drawdown although i believe the maximum equity drawdown in Trade Statics is correct but i need to see the individual equity drawdown of each trade.
i would be glad to hear if anyone has any suggestions on adepting this code to the new API since i cannot undrestand the problem myself and there are no warnings while compiling the code.
[Parameter("Trailing Stop Trigger (pips) :", DefaultValue = 26)] public int TrailingStopTrigger { get; set; } [Parameter("Trailing Stop Step (pips) : ", DefaultValue = 5)] public int TrailingStopStep { get; set; } ------------------------------------------------------------------------------------------------------------------------------ var sellPositions = Positions.FindAll(InstanceName, Symbol, TradeType.Sell); foreach (Position position in sellPositions) { double distance = position.EntryPrice - Symbol.Ask; if (distance < TrailingStopTrigger * Symbol.PipSize) continue; double newStopLossPrice = Symbol.Ask + TrailingStopStep * Symbol.PipSize; if (position.StopLoss == null || newStopLossPrice < position.StopLoss) { ModifyPosition(position, newStopLossPrice, position.TakeProfit); } } var buyPositions = Positions.FindAll(InstanceName, Symbol, TradeType.Buy); foreach (Position position in buyPositions) { double distance = Symbol.Bid - position.EntryPrice; if (distance < TrailingStopTrigger * Symbol.PipSize) continue; double newStopLossPrice = Symbol.Bid - TrailingStopStep * Symbol.PipSize; if (position.StopLoss == null || newStopLossPrice > position.StopLoss) { ModifyPosition(position, newStopLossPrice, position.TakeProfit); } }
this code gets called on tick
this is the chart while using trailing stop
and this is the chart without the trailing stop
Replies
pejman101
01 Jul 2019, 23:18
RE:
Panagiotis Charalampous said:
Hi Pezhman Ghavami,
We are aware of the issue and we will fix it in an upcoming update.
Best Regards,
Panagiotis
I see, thank you for your answer!
@pejman101
PanagiotisCharalampous
01 Jul 2019, 12:44
Hi Pezhman Ghavami,
We are aware of the issue and we will fix it in an upcoming update.
Best Regards,
Panagiotis
@PanagiotisCharalampous