Login Page - Create Account

Support Board


Date/Time: Tue, 21 Jan 2025 07:37:42 +0000



Post From: Report Possible Bug: sc.SellEntry() Incorrectly Displays Order Fills

[2018-08-03 03:07:40]
Richard Chinn - Posts: 28
Please bear with me and give me a chance to show you what is happening! There is a bug!
I respect what you do and this is an EXCELLENT program. I am absolutely sure that you guys and girls are much smarter than I am about this stuff!
I know you are bombarded with lots of stuff. I do read the support board but,
I would not be so persistent if I wasn't sure myself that there is an erroneous action taking place.

From your last post:
If sc.SellEntry is giving an error, then there will have been no order submitted. We verified that.

The "bug" is NOT that an actual order was or was not placed, the bug is that the displayed information on the chart shows an order that did not happen.
I did not say an actual order was placed. I said an order is displayed on the chart. (Like a position was initiated. That is the bug I am referencing.)

My code has nothing to do with the issue I am talking about and I am not looking for any sort of debugging help. I am trying to help you understand an issue with SierraChart.

So here is what I did to prove it for you:

I deleted my Sierra Chart directory and downloaded the program again. It is version 1785. So I am working from a completely clean install.
The only changes I have made to the settings are:
Trade>>Show Order Fills
Trade>>Show Orders And Positions

The snippet below does make sure that sc.AllowOnlyOneTradePerBar is set to true.

I opened a 1 minute chart for the S&P500. I made NO changes to the chart or any of it's settings. I'm on Rythmic data service.
I wrote this short function (No fluff whatsoever) to prove what is happening:


#include "sierrachart.h"

SCDLLName("EntryTest")

SCSFExport scsf_EntryTest(SCStudyInterfaceRef sc)
{
  SCInputRef enabled sc.input[0];
  s_SCPositionData PositionData;
  sc.GetTradePosition(PositionData);

  if (sc.SetDefaults)
  {
    sc.AllowOnlyOneTradePerBar = true;
    sc.AutoLoop = 1;
    sc.FreeDLL = 0;
    
    enabled.Name = "Enabled";
    enabled.SetYesNo(false);
  }
  
  if (!enabled.GetBoolean())
    return;
    
  s_SCNewOrder NewOrder;    
  NewOrder.OrderQuantity = 1;
  NewOrder.OrderType = SCT_ORDERTYPE_MARKET;
  NewOrder.TimeInForce = SCT_TIF_DAY;

  if (PositionData.PositionQuantity == 0)
    sc.BuyEntry(NewOrder);

  else if (PositionData.PositionQuantity >= 1)
    sc.SellEntry(NewOrder);
}

I ran this on LIVE data, SIMULATION mode.
You can look at my chart, generated from the function above, http://www.sierrachart.com/image.php?Image=1533264496906.png
and tell this is clearly not correct, at most we should see no more than 2 fills per bar, 1 BUY and 1 SELL,
but PLEASE run the snippet for yourself, you can see it is a complete function with NO fluff whatsoever.
I noticed running this snippet without any type of delay that the program will momentarily display a "Not Responding" message which does clear after several seconds.

My Trade journal correctly shows orders as Order Sent | Open | Filled in the Order Status column.

The additional displayed but not real orders shown on the chart are NOT listed in the Trade Activity Log.
This is what I expect because an actual order was not made and should not have been made because only one trade per bar is set to true.

I hope this is clearly presented so you can understand the erroneous information displayed on the chart is the problem, not that an actual order was not placed.

Thanks
Richard