+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-2493

Portfolio Trader execution is totally unreliable (FlipFlop Strategy on 1min bars don't execute)

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

Using below strategy:

using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
using ATCenterProxy.interop;

namespace PowerLanguage.Strategy {
public class FlipFlop : SignalObject {
public FlipFlop(object _ctx):base(_ctx){}
private IOrderMarket buy_order, short_order;
private int lastSignal;
protected override void Create() {
// create variable objects, function objects, order objects etc.
buy_order = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, EOrderAction.Buy));
short_order = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, EOrderAction.SellShort));
lastSignal = 0;
}
protected override void StartCalc() {
// assign inputs
}
protected override void CalcBar(){
// strategy logic
if(/*CurrentPosition.Side == EMarketPositionSide.Flat && */(lastSignal != 1)){
buy_order.Send();
lastSignal = 1;
} else if(/*CurrentPosition.Side == EMarketPositionSide.Flat && */(lastSignal != -1))
{
short_order.Send();
lastSignal = -1;
}else {
//this.GenerateExitOnClose();
}
}
}
}

Set on a Portfolio Trader with 4 (or any) symbols, set on OEC Sim account - signal execution is totally unreliable, as seen in the below (with all other settings left on default):

https://youtu.be/7VEMTvRiQcs

Steps to reproduce this issue

see above

Comments (4)
#1
user-offline.png  andb (andb)
Aug 14, 2018 - 01:35
A file was uploaded. Untitled1.mp4icon_open_new.png
#2
user-offline.png  MultiCharts Support (MultiCharts)
Aug 28, 2018 - 09:33
andb, Please set Max Potential Loss in Portfolio Settings to 100%. If the orders are still not generated - verify the order generation logic by outputting the variables and conditions involved in order generation. Here is a sample code for that:  http://www.multicharts.com/trading-software/index.php/Why_an_Order_Was_or_Was_Not_Executed
Changes:
  •   icon_status.pngStatus changed: Under Review => Need Details
#3
user-offline.png  andb (andb)
icon_reply.pngSep 24, 00:25, in reply to comment #2
Hi Alex,

Have you watched the attached video?

1) if it was a Max Loss Portfolio Setting issue, orders would stop getting executed completely beyond a time T. Nonetheless, I've set it to 1 Mil. More than that ... these are 1 Minute Bars, meaning the impact on PNL is what ... $50 a trade AT MOST ... 2) In the video you see clearly each Minute that positions FAIL to flip from one side to anoyther.

Strategy code is so simple: if Long, go Short. If Short, go Long. That's it. Is it too hard to reproduce?

The video shows all you need to see ... I'm trying to understand what's not clear, you just have to spend 4 minutes and watch the video, copy the code above into a strategy and run it in a Portfolio Trader ... is that too much to ask ...

Alex MultiCharts wrote:
andb, Please set Max Potential Loss in Portfolio Settings to 100%. If the
orders are still not generated - verify the order generation logic by
outputting the variables and conditions involved in order generation. Here
is a sample code for that: 
http://www.multicharts.com/trading-software/index.php/Why_an_Order_Was_or_Was_Not_Executed


#4
user-offline.png  MultiCharts Support (MultiCharts)
icon_reply.pngOct 02, 08:27, in reply to comment #3
andb, we watched your video and used the code you have provided. This behavior was not replicated on our end. You will need to send us your Portfolio Workspace and export of the symbols (without data) that you are using for replicating it on your end. Or come to the Live Chat to demonstrate this behavior remotely.
History
Issue basics
  • Type of issue
    Bug report
  • Category
    Not determined
  • Targeted for
    Not determined
  • Status
    Need Details
  • 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