+1 888 340 6572
MultiCharts Project Management
Go to the previous open issue
Go to the previous issue (open or closed)
Please log in to bookmark issues
Open Bug report MC-2509

flip-flop strategy on 1 minute ES bars - even though I use just 1 contract (none specified) per side, orders quantity = 2 in Orders of Position Tracker

Go to the next issue (open or closed)
Go to the next open issue

Each new 1 minute bar, we should swap from long to short and from short to long, as per attached strategy code.
For some reason, we see Sell Quantity = 2 or Buy Quantity = 2 in the Order & Position Tracker.

See the attached avi for details.

Steps to reproduce this issue


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(lastSignal != 1){
            Output.WriteLine("Sending Long Entry.");
            lastSignal = 1;
        } else if(lastSignal != -1)
            Output.WriteLine("Sending Short Entry.");
            lastSignal = -1;


Attached the avi file showing the issue.

Comments (2)
user-offline.png  andb (andb)
Sep 24, 2018 - 19:25
A file was uploaded. FlipFlop.7zicon_open_new.png
user-offline.png  MultiCharts Support (MultiCharts)
Oct 03, 2018 - 02:33
Buy+SellShort is a reverse strategy. The reverse is done with a single order that both closes the existing position and opens the new one for the specified number of contracts: https://www.multicharts.com/trading-software/index.php/How_Scripts_Work
  •   icon_status.pngStatus changed: Under Review => Not a bug
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