Login Page - Create Account

Support Board


Date/Time: Sun, 08 Sep 2024 01:20:30 +0000



[Programming Help] - Buttons for the Spreadsheet System for Trading Buy Exit Sell Exit formulas

View Count: 214

[2024-07-12 21:52:05]
User130696 - Posts: 75
Hello,

I have added two trail-long and trail-short ACS buttons based on two Trade Management by Study, respectively.
I also have the "Spreadsheet System for Trading" and Auto Trading enabled, and the spreadsheet formula for this study uses the Buy Exit and Sell Exit formulas.

When auto trading is enabled, sell-and-buy-exit logic interferes with the trailing study. I want an ACS button that, when pressed/toggled, allows me to activate or deactivate Buy or sell Exit formulas.
How can I add buttons for buy-sell exit formulas in the Spreadsheet System for Trading study?
Date Time Of Last Edit: 2024-07-12 21:53:12
[2024-07-15 13:32:04]
John - SC Support - Posts: 34254
There are no built-in options to have a control bar button that controls the "Buy/Sell Exit" formulas, cells. The closest you can come would be to turn on/off trading for that chart through a Control Bar button. Refer to the following:
Control Bar: Customize Control Bars >> Control Bar 1-12 (Global Settings)

We are not exactly certain of what you are wanting to do with regards to the cells, but you can create a custom study that can modify the data in a cell. Refer to the following:
sc.SetSheetCellAsDouble()

List of Third Party Sierra Chart Study and System Programmers
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2024-07-16 02:03:27]
User130696 - Posts: 75
Hello,

Let's suppose I want to access the current value of ID32.SG1 and assign this to Stop Price in the OCO Group 1; what code should I write so that it keeps the stop price and ID32.SG1 is in sync all the time, waiting for the order trigger.

The documentation below does not tell me or is hard to understand.


ACSIL Programming Concepts: Unique Study Instance Identifiers

This identifier can be accessed through ACSIL with the sc.StudyGraphInstanceID variable. This identifier is for the instance of the study that is accessing this value directly

The proper way to obtain this unique study instance identifier for a particular study, from another study is through the sc.Input[].SetStudyID() and sc.Input[].GetStudyID() Input functions or other Input functions which create a study Input and allow getting of a study identifier. sc.Input[].SetStudyID() creates a study Input with a list of studies on a chart and allow selecting one of them.

Also refer to sc.Input[].SetChartStudyValues(), sc.Input[].GetChartNumber() and sc.Input[].GetStudyID() Input functions.
Date Time Of Last Edit: 2024-07-16 02:04:51
[2024-07-16 22:00:35]
User130696 - Posts: 75
Is there an update on how to proceed ?
[2024-07-17 01:18:07]
ForgivingComputers.com - Posts: 928
Let's suppose I want to access the current value of ID32.SG1 and assign this to Stop Price in the OCO Group 1; what code should I write so that it keeps the stop price and ID32.SG1 is in sync all the time, waiting for the order trigger.

You can set up the trade to be any stop offset or price you want. If you want to have the stop move based on a subgraph, use the Trade Management by Study study and set the Controlling Subgraph Reference to ID32.SG1.
[2024-07-17 01:25:22]
User130696 - Posts: 75
I am already using Trade Management by Study for Buy and Sell entry and corresponding exits and its working fine. But I need control over when I want to use buy exit, sell exit vs auto trailing in long and short positions.

If the price starts to trend, then I do not want to use Buy Exit and Sell Exit which are basically hard coded logic. If the price has started to trend, then I want to quickly turn off Buy Exit, Sell Exit logic and enable auto trailing based on another study.

Hope I am able to convey the situation clearly.
Date Time Of Last Edit: 2024-07-17 01:26:10
[2024-07-17 02:22:01]
ForgivingComputers.com - Posts: 928
You would need a custom study to do that.
[2024-07-17 22:40:06]
User130696 - Posts: 75
I know that .

Thats why my previous post was relating ACSIL language.

Let's suppose I want to access the current value of ID32.SG1 and assign this to Stop Price in the OCO Group 1; what code should I write so that it keeps the stop price and ID32.SG1 is in sync all the time, waiting for the order trigger.

The documentation below does not tell me or is hard to understand.


ACSIL Programming Concepts: Unique Study Instance Identifiers

This identifier can be accessed through ACSIL with the sc.StudyGraphInstanceID variable. This identifier is for the instance of the study that is accessing this value directly

The proper way to obtain this unique study instance identifier for a particular study, from another study is through the sc.Input[].SetStudyID() and sc.Input[].GetStudyID() Input functions or other Input functions which create a study Input and allow getting of a study identifier. sc.Input[].SetStudyID() creates a study Input with a list of studies on a chart and allow selecting one of them.

Also refer to sc.Input[].SetChartStudyValues(), sc.Input[].GetChartNumber() and sc.Input[].GetStudyID() Input functions.
[2024-07-18 01:00:11]
ForgivingComputers.com - Posts: 928
This code demonstrates how to read the value of another study. You can use this to set and control the stop.


#include "sierrachart.h"
SCDLLName("Demo Get SG from Other Study")

SCSFExport scsf_TemplateFunction(SCStudyInterfaceRef sc)
{
  SCInputRef OtherStudyRef = sc.Input[0];

  SCSubgraphRef SG_Subgraph = sc.Subgraph[0];

  if (sc.SetDefaults)
  {
    sc.AutoLoop = 1;
    OtherStudyRef.Name = "Study ID/SG";
    OtherStudyRef.SetStudySubgraphValues(32, 0);   //ID32.SG1

    SG_Subgraph.Name = "Subgraph";

  }

  SCFloatArray OtherStudy;

  sc.GetStudyArrayUsingID(OtherStudyRef.GetStudyID(), OtherStudyRef.GetSubgraphIndex(), OtherStudy);

  // Result
  SG_Subgraph[sc.Index] = OtherStudy[sc.Index];



  
}

Date Time Of Last Edit: 2024-07-18 01:01:49
attachmentTest_OtherStudy.cpp - Attached On 2024-07-18 00:59:27 UTC - Size: 618 B - 73 views
[2024-07-18 01:36:09]
User130696 - Posts: 75
thank you

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account