+1 888 340 6572 GET STARTED
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-2915

sellFromEntry.SendFromEntry(5, oNameLong) ignores number of lots (the first argument)

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

This is on latest 15 release .NET version.

submitting a sellFromEntry.SendFromEntry(5, oNameLong);

order will ignore the lots size (5 in the above) and pursue to liquidate all size submitted with oNameLong label.

Steps to reproduce this issue

Having:

private IOrderMarket longEOrder, longEOrderA, longEOrderB, longXOrder;
    private IOrderMarket sellFromEntry;

    protected override void Create()
{
        // create variable objects, function objects, order objects etc.
        longEOrder = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.UserSpecified, EOrderAction.Buy));
        longEOrderA = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.UserSpecified, EOrderAction.Buy));
        longEOrderB = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.UserSpecified, EOrderAction.Buy));
        longXOrder = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.UserSpecified, EOrderAction.Sell));

        sellFromEntry = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, "Sell", EOrderAction.Sell, OrderExit.FromEntry()));
    }
protected override void CalcBar()
{
        // strategy logic 
        dTime = Bars.TimeValue.Date;

        bool isSendingOrder = false;
        string oName = "";
        string oNameLong = "LongA";
        string oNameSort = "SortA";
        int lots = 0;
        if (Bars.CurrentBar == 100) { lots = 20; longEOrderA.Send(oNameLong, lots); isSendingOrder = true; oName = oNameLong; }
        if (Bars.CurrentBar == 150) { lots = 10; longEOrderA.Send(oNameLong, lots); isSendingOrder = true; oName = oNameLong; }
        if (Bars.CurrentBar == 200) { lots = 20; longEOrderB.Send(oNameLong+"B", lots); isSendingOrder = true; oName = oNameLong; }
        if (Bars.CurrentBar == 250) { lots = 20; longEOrderA.Send(oNameLong, lots); isSendingOrder = true; oName = oNameLong; }

        if (Bars.CurrentBar == 300) 
        { 
            lots = 15;
            sellFromEntry.SendFromEntry(5, oNameLong);
            isSendingOrder = true; 
            oName = oNameSort; 
        }

You get:

AdjustLotsFrom_mm:CalcBar, BarN: 100, Date: 2020-08-05, MkPos: 0, order LongA sent for lots: 20
AdjustLotsFrom_mm:CalcBar, BarN: 150, Date: 2020-10-15, MkPos: 20, order LongA sent for lots: 10
AdjustLotsFrom_mm:CalcBar, BarN: 200, Date: 2020-12-28, MkPos: 30, order LongA sent for lots: 20
AdjustLotsFrom_mm:CalcBar, BarN: 250, Date: 2021-03-11, MkPos: 50, order LongA sent for lots: 20
AdjustLotsFrom_mm:CalcBar, BarN: 300, Date: 2021-05-21, MkPos: 70, order SortA sent for lots: 15

AdjustLotsFrom_mm:CalcBar, LastBarOnChart: 1022, Date: 2024-04-05, MkPos: 20, order sent for lots: 0

and the Performance report showss all "LongA" labeled submissions (totalling 50 lots) are liquidated. Instead, there should have only been 5.

Comments (1)
#1
user-offline.png  MultiCharts Support (MultiCharts)
Apr 08, 2024 - 11:46
Hello,

In your case exits should have the OrderExit.Total parameter.

If you use Exit From Entry – OrderExit.FromEntryTotal(). But here the method’s parameter FromEntryTotal() specifies the entry from which to exit. For example: OrderExit.FromEntryTotal(longEOrder)

The Total parameter in both cases specifies that the exit should fill the amount of contracts specified when the order is sent.

You can reference the PowerLanguage help: https://www.multicharts.com/trading-software/index.php?title=Total

Changes:
  •   icon_status.pngStatus changed: Under Review => Not a bug
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 (1)
Commits (0)
There are no code checkins for this issue
Duplicate issues (0)
This issue does not have any duplicates