+1 888 340 6572
MultiCharts Project Management
previous_open_issue.png
Go to the previous open issue
previous_issue.png
Go to the previous issue (open or closed)
star_faded.png
Please log in to bookmark issues
bug_report_small.png
Open Bug report MC-2644

Stop loss does not always trigger when using GenerateStopLoss() during backtest

action_vote_minus_faded.png
1
Votes
action_vote_plus_faded.png
next_issue.png
Go to the next issue (open or closed)
next_open_issue.png
Go to the next open issue
Description

When using GenerateStopLoss() during a backtest, the stop does not always trigger.

Steps to reproduce this issue

Using the code below triggers a short entry at 170.23 on 08-04-2020 and places a 40 tick stop or exit on close. This code was tested on contract DBM20 from CQG.

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 signal is placed on a daily chart, the signal takes a one tick winner on the close.

However, if this signal is placed on a 60 minute chart, the trade hits the stop loss. Hitting the stop loss is correct as the stop price does trade.

Comments (1)
#1
user-offline.png  Matt (jules190)
Apr 29, 2020 - 10:14

Not a bug. Required Bar Magnifier to be enabled. Please close.

History
Issue basics
  • Type of issue
    Bug report
  • Category
    Not determined
  • Targeted for
    Not determined
  • Status
    Not a bug
  • Priority
    Not determined
User pain
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
Affected by this issue (0)
There are no items
People involved
Times and dates
  • Posted at
  • Last updated
Issue details
  • Reproducability
    Not determined
Attachments (0)
There is nothing attached to this issue
Commits (0)
There are no code checkins for this issue
Duplicate issues (0)
This issue does not have any duplicates