NexusFi: Find Your Edge


Home Menu

 





Questions and discussion for Sierra Chart ACSIL for Beginners


Discussion in Sierra Chart

Updated
      Top Posters
    1. looks_one Trembling Hand with 43 posts (35 thanks)
    2. looks_two mosalem2003 with 40 posts (0 thanks)
    3. looks_3 1m1k3 with 20 posts (0 thanks)
    4. looks_4 bradhouser with 6 posts (9 thanks)
      Best Posters
    1. looks_one bobwest with 3.5 thanks per post
    2. looks_two bradhouser with 1.5 thanks per post
    3. looks_3 brach with 1 thanks per post
    4. looks_4 Trembling Hand with 0.8 thanks per post
    1. trending_up 27,901 views
    2. thumb_up 53 thanks given
    3. group 30 followers
    1. forum 119 posts
    2. attach_file 25 attachments




 
Search this Thread

Questions and discussion for Sierra Chart ACSIL for Beginners

  #61 (permalink)
 Trembling Hand 
Melbourne, Land of Oz
 
Experience: Advanced
Platform: Sierra Chart, CQG
Broker: CQG
Trading: HSI
Posts: 246 since Jun 2011
Thanks Given: 28
Thanks Received: 360


mosalem2003 View Post
The donchian channel study as it prints on the subgraph is the correct behavior. It is supposed to switch its value when we make a new high for the range at the next bar after the last.... Will check if they do this by shifting the graph as was shown in the code or it is inherent in the logic.

I will need to change the code reference indexes to align with that shift in the Donchian Channel study from Sierra

Just rewrite a custom Donchian Channel study without the Subgraph_HighestHigh.GraphicalDisplacement= 1 line.

I would be very careful of using systems with a Displacement in an array. That rings a thousand alarm bells.

Follow me on Twitter Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
MC PL editor upgrade
MultiCharts
Better Renko Gaps
The Elite Circle
Cheap historycal L1 data for stocks
Stocks and ETFs
 
  #62 (permalink)
mosalem2003
Toronto
 
Posts: 103 since Apr 2019
Thanks Given: 106
Thanks Received: 23

I was defining arrays or variables within the system body which is not an input or a subgraph at the input/subgraph sections and these variable or array doesn't have initialization. I noticed that the trading logic will not recognize the changes of these variables or arrays.
After many phases of debugging, I assume this is expected behavior and for any variables or arrays it should be initially defined in the beginning of the system, even if it's not an input and will change due to the inputs of the system.
For example, if a cross over takes place I was trying to set a variable or a boolean to true or false but this variable was declaring in he system body and wasn't defined at the start as an input or subgraph. So I would assume that rather than declaring in the body , we must define it as a subgraph to the system and initiate it at the set default by SetYesNo(). Is my assumption correct?

Sent using the NexusFi mobile app

Reply With Quote
  #63 (permalink)
mosalem2003
Toronto
 
Posts: 103 since Apr 2019
Thanks Given: 106
Thanks Received: 23


sc.CancelAllOrdersOnEntriesAndReversals = true;

What is the parameter to use in order to cancel all non-filled orders Except Open attached orders ?

Reply With Quote
  #64 (permalink)
 Trembling Hand 
Melbourne, Land of Oz
 
Experience: Advanced
Platform: Sierra Chart, CQG
Broker: CQG
Trading: HSI
Posts: 246 since Jun 2011
Thanks Given: 28
Thanks Received: 360


mosalem2003 View Post
sc.CancelAllOrdersOnEntriesAndReversals = true;

What is the parameter to use in order to cancel all non-filled orders Except Open attached orders ?

Have a look at this section,
https://www.sierrachart.com/index.php?page=doc/ACSILTrading.html
and
https://www.sierrachart.com/index.php?page=doc/ACSILTrading.html

 
Code
// This is an example of iterating the order list in Sierra Chart for orders
// matching the Symbol and Trade Account of the chart, and finding the orders
// that have a Status of Open and are not Attached Orders.

int Index = 0;
s_SCTradeOrder OrderDetails;
while( sc.GetOrderByIndex (Index, OrderDetails) != SCTRADING_ORDER_ERROR)
{
    Index++; // Increment the index for the next call to sc.GetOrderByIndex
  
    if (OrderDetails.OrderStatusCode !=  SCT_OSC_OPEN)
        continue;

    if (OrderDetails.ParentInternalOrderID != 0)//This means this is an Attached Order
      continue;

    //Get the internal order ID
    int InternalOrderID = OrderDetails.InternalOrderID;

}
Once you have the InternalOrderID in that loop you can modify or cancel it/them

 
Code
 int Result = sc.CancelOrder(InternalOrderID );

Follow me on Twitter Started this thread Reply With Quote
Thanked by:
  #65 (permalink)
 Trembling Hand 
Melbourne, Land of Oz
 
Experience: Advanced
Platform: Sierra Chart, CQG
Broker: CQG
Trading: HSI
Posts: 246 since Jun 2011
Thanks Given: 28
Thanks Received: 360

The above code will return attached orders so if you wan orders that are not attached to a parent order change this line to,

 
Code
if (OrderDetails.ParentInternalOrderID == 0)//This means this is an Attached Order
      continue;
If the s_SCTradeOrder::ParentInternalOrderID structure member is nonzero, then the order is an Attached Order.

Follow me on Twitter Started this thread Reply With Quote
Thanked by:
  #66 (permalink)
mosalem2003
Toronto
 
Posts: 103 since Apr 2019
Thanks Given: 106
Thanks Received: 23

Thanks a lot @Trembling Hand for your great support as usual

 
Code
if (OrderDetails.ParentInternalOrderID != 0)//This means this is  an Attached Order
		 continue;
This works perfectly as it will skip all the open attached orders and I will move to cancel only the pending non-filled orders.

 
Code
//Get the internal order ID
						int InternalOrderID = OrderDetails.InternalOrderID;
						int Result_cancel = sc.CancelOrder(InternalOrderID );
I also switched this to false at the beginning of the set defaults block

 
Code
sc.CancelAllOrdersOnEntriesAndReversals = false;

Reply With Quote
  #67 (permalink)
Emotion
Netherlands
 
Posts: 2 since Feb 2021
Thanks Given: 0
Thanks Received: 0

Great two threads, I really picked up a lot of information for setting up with VS.

Now I would like to create my own class to separate the stuff a little bit but I'm more a C# guy than C++ and I constantly get an error on the initiating of my class. I just can't figure out how I can get such simple code to work. I hope anyone would like to help me? Writing studies without using my own class works without any problems. But I don't like the big functions.

The error I get on my constructor: references must be initialized

 
Code
class My_Tradingsystem_01
{
public:
	SCStudyInterfaceRef sc;
	SCString Version;
	SCInputRef Enabled;
        SCSubgraphRef Subgraph_SellEntry;
        My_Tradingsystem_01(SCStudyInterfaceRef sc, SCInputRef Enabled, SCSubgraphRef Subgraph_SellEntry);
}

SCSFExport scsf_CH_Tradingsystem_01(SCStudyInterfaceRef sc)
{
	My_Tradingsystem_01 ts(sc, sc.Input[0], sc.Subgraph[0]);
}

My_Tradingsystem_01::My_Tradingsystem_01(SCStudyInterfaceRef sc, SCInputRef Enabled, SCSubgraphRef Subgraph_SellEntry)
{
	this->sc = sc;
	this->Enabled = Enabled;
        this->Subgraph_SellEntry = Subgraph_SellEntry;
}

 
Code
Severity	Code	Description	Project	File	Line	Suppression State
Error (active)	E0366	"My_Tradingsystem_01::My_Tradingsystem_01(SCStudyInterfaceRef sc, SCInputRef Enabled, SCSubgraphRef Subgraph_SellEntry)" provides no initializer for:	SC_My_Tradingsystem	

Severity	Code	Description	Project	File	Line	Suppression State
Error	C2530	'My_Tradingsystem_01::sc': references must be initialized	SC_My_Tradingsystem

Reply With Quote
  #68 (permalink)
bradhouser
Northern California where the girls are warm
 
Posts: 122 since Nov 2010
Thanks Given: 15
Thanks Received: 72

I am not sure if this is the problem, but your cpp file needs this at the top:

 
Code
#include "sierrachart.h"

Reply With Quote
  #69 (permalink)
 Trembling Hand 
Melbourne, Land of Oz
 
Experience: Advanced
Platform: Sierra Chart, CQG
Broker: CQG
Trading: HSI
Posts: 246 since Jun 2011
Thanks Given: 28
Thanks Received: 360

Not in front of my computer at the mo but C++ classes finish with a semicolon at the end..

Follow me on Twitter Started this thread Reply With Quote
  #70 (permalink)
Emotion
Netherlands
 
Posts: 2 since Feb 2021
Thanks Given: 0
Thanks Received: 0


Thanks guys, the both of you are correct, I stripped my code (624 lines) from the non essentials that's where they got lost.

Reply With Quote




Last Updated on April 23, 2024


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts