Bug in GenerateStopLoss() during backtest

Questions about MultiCharts .NET and user contributed studies.
jules190
Posts: 20
Joined: 06 Aug 2014
Been thanked: 4 times

Bug in GenerateStopLoss() during backtest

Postby jules190 » 09 Apr 2020

The code below triggers a short entry at 170.23 on 08-04-2020 for contract DBM20 and places a 40 tick stop.

Code: Select all

using System; using System.Drawing; using System.Linq; using PowerLanguage.Function; using ATCenterProxy.interop; namespace PowerLanguage.Strategy { public class SL : SignalObject { private IOrderPriced sellToEnter; public SL(object _ctx):base(_ctx) { } protected override void Create() { this.sellToEnter = OrderCreator.Stop( new SOrderParameters(Contracts.Default, "EnterShort", EOrderAction.SellShort)); } protected override void CalcBar() { this.sellToEnter.Send(170.23); this.GenerateExitOnClose(); this.GenerateStopLossPt(40); } } }
If this code is attached to a daily chart, the signal takes a one tick winner on the close.

Image

However, if the signal is placed on a 60min chart, then the signal correctly hits the stop loss.

Image

I have submitted this to the bug tracker https://www.multicharts.com/pm/public/m ... es/MC-2644.

Please let me know if this usage isn't correct and it this isn't a bug.

User avatar
Anna MultiCharts
Posts: 560
Joined: 14 Jul 2017
Has thanked: 42 times
Been thanked: 140 times

Re: Bug in GenerateStopLoss() during backtest

Postby Anna MultiCharts » 14 Apr 2020

Hello jules190,

Please contact us by email directly on this matter.


Return to “MultiCharts .NET”