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

  #21 (permalink)
mosalem2003
Toronto
 
Posts: 103 since Apr 2019
Thanks Given: 106
Thanks Received: 23

I didn't set the array for L2_Buyer in SC.default. Yes I need to store last Close when the last bar closed above the DI and the bar before was below it.. this is for L2 buyer array and if there is no condition then the array values doesn't change

Sent using the NexusFi mobile app

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
MC PL editor upgrade
MultiCharts
REcommedations for programming help
Sierra Chart
 
  #22 (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

Actually It's not the way I would go about it but it seems to be working.


2020-12-22 14_07_58-Message Log


 
Code
SCSFExport scsf_msalem_AccumulationTEST(SCStudyInterfaceRef sc)
{

    SCSubgraphRef DC_High = sc.Subgraph[0];
    SCSubgraphRef DC_Low = sc.Subgraph[1];
    SCSubgraphRef DemandIndex = sc.Subgraph[2];

    SCSubgraphRef L2_Buyer = sc.Subgraph[3];
    SCSubgraphRef L2_Seller = sc.Subgraph[4];
    SCSubgraphRef DI_Buyer = sc.Subgraph[5];
    SCSubgraphRef DI_Seller = sc.Subgraph[6];


	//Inputs 
	///Imported studies subgraph(s) input arrays
	SCInputRef Input_Subgraph_DC_High = sc.Input[0];
	SCInputRef Input_Subgraph_DC_Low = sc.Input[1];
	SCInputRef Input_Subgraph_DemandIndex = sc.Input[2];
	

	//Subgraphs 


	// Set configuration variables

	if (sc.SetDefaults)
	{
		//Generic system defaults
		sc.GraphName = "TEST MSalem Institutional Accumulation Trading Algo";
		sc.StudyDescription = "MSalem Institutional Accumulation Trading System";
		sc.GraphRegion = 0;
		sc.AutoLoop = 1;
		sc.CalculationPrecedence = VERY_LOW_PREC_LEVEL;

		//Inputs' Arrays defaults

		//*SET/IMPORT* studies' subgraph(s)from the current chart: defaults to study 0, subgraph 0: change from the study settings to select the studies/subgraphs
		Input_Subgraph_DC_High.Name = "DC: High";
		Input_Subgraph_DC_High.SetStudySubgraphValues(1, 0);

		Input_Subgraph_DC_Low.Name = "DC: Low";
		Input_Subgraph_DC_Low.SetStudySubgraphValues(1, 1);

		Input_Subgraph_DemandIndex.Name = "DemandIndex";
		Input_Subgraph_DemandIndex.SetStudySubgraphValues(2, 0);


		//Subgraphs' arrays defaults 

        DC_High.Name = "DC_High";
        DC_High.DrawStyle = DRAWSTYLE_BAR;
        DC_High.PrimaryColor = RGB(0, 200, 0);

        DC_Low.Name = "DC_Low";
        DC_Low.DrawStyle = DRAWSTYLE_BAR;
        DC_Low.PrimaryColor = RGB(200, 0, 0);


        DemandIndex.Name = "DemandIndex";
        DemandIndex.DrawStyle = DRAWSTYLE_BAR;
        DemandIndex.PrimaryColor = RGB(0, 0, 200);


        L2_Buyer.Name = "L2_Buyer";
        L2_Buyer.DrawStyle = DRAWSTYLE_IGNORE;
        L2_Buyer.PrimaryColor = RGB(0, 0, 200);

        L2_Seller.Name = "L2_Seller";
        L2_Seller.DrawStyle = DRAWSTYLE_IGNORE;
        L2_Seller.PrimaryColor = RGB(0, 0, 200);

        DI_Buyer.Name = "DI_Buyer";
        DI_Buyer.DrawStyle = DRAWSTYLE_IGNORE;
        DI_Buyer.PrimaryColor = RGB(0, 0, 200);

        DI_Seller.Name = "DI_Seller";
        DI_Seller.DrawStyle = DRAWSTYLE_IGNORE;
        DI_Seller.PrimaryColor = RGB(0, 0, 200);






		return;
	}

	// SYSTEM DATA Processing 

	//Setup for data processing 

	// **Get/IMPORT the array of the set studies(s) and corresponding subgraphs**

	//SCFloatArray DC_High;
	sc.GetStudyArrayUsingID(Input_Subgraph_DC_High.GetStudyID(), Input_Subgraph_DC_High.GetSubgraphIndex(), DC_High);


	//SCFloatArray DC_Low;
	sc.GetStudyArrayUsingID(Input_Subgraph_DC_Low.GetStudyID(), Input_Subgraph_DC_Low.GetSubgraphIndex(), DC_Low);

	//SCFloatArray DemandIndex;
	sc.GetStudyArrayUsingID(Input_Subgraph_DemandIndex.GetStudyID(), Input_Subgraph_DemandIndex.GetSubgraphIndex(), DemandIndex);



	// declare string to print log messages
	SCString SignalString;
	SCString LogString;


	// Process once per bar
	int& LastBarIndexProcessed = sc.GetPersistentInt(1);
	if (sc.Index == 0)
		LastBarIndexProcessed = -1;
	if (sc.Index == LastBarIndexProcessed)
		return;
	LastBarIndexProcessed = sc.Index;

	if (sc.IsFullRecalculation)
		return;


	// Create an s_SCNewOrder object. 

	/*SCFloatArray L2_Buyer;
	SCFloatArray L2_Seller;
	SCFloatArray DI_Buyer;
	SCFloatArray DI_Seller;*/

	if (sc.Close[sc.Index - 1] > DC_Low[sc.Index - 1] && sc.Close[sc.Index - 2] <= DC_Low[sc.Index - 2])
		//if ( sc.CrossOver(sc.Close, DC_Low) == CROSS_FROM_BOTTOM && sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_CLOSED) 

	{
		L2_Buyer[sc.Index - 1] = sc.Close[sc.Index - 1];
		DI_Buyer[sc.Index - 1] = DemandIndex[sc.Index - 1];
        LogString.Format("check 1 . sc.Close[sc.Index - 1]: %.2f, DemandIndex[sc.Index - 1]: %.2f", sc.Close[sc.Index - 1], DemandIndex[sc.Index - 1]);
		sc.AddMessageToLog("check 1 ", 0);

	}
	else
	{
		L2_Buyer[sc.Index - 1] = L2_Buyer[sc.Index - 2];
		DI_Buyer[sc.Index - 1] = DI_Buyer[sc.Index - 2];        
        LogString.Format("else. L2_Buyer[sc.Index - 1]: %.2f,  L2_Buyer[sc.Index - 2]: %.2f,  DI_Buyer[sc.Index - 1]: %.2f  DI_Buyer[sc.Index - 2]: %.2f", L2_Buyer[sc.Index - 1], L2_Buyer[sc.Index - 2], DI_Buyer[sc.Index - 1], DI_Buyer[sc.Index - 2]);
        sc.AddMessageToLog("check 2 ", 0);

	}


    sc.AddMessageToLog(LogString, 0);
    SignalString.Format("L2_Buyer[sc.Index - 1]: %.2f,  L2_Buyer[sc.Index - 2]: %.2f,   L2_Buyer[sc.Index - 3]: %.2f, DI_Buyer[sc.Index - 1]: %.2f  DI_Buyer[sc.Index - 2]: %.2f,  DI_Buyer[sc.Index - 3]: %.2f", L2_Buyer[sc.Index - 1], L2_Buyer[sc.Index - 2], L2_Buyer[sc.Index - 3],
        DI_Buyer[sc.Index - 1], DI_Buyer[sc.Index - 2], DI_Buyer[sc.Index - 3]);
    sc.AddMessageToLog(SignalString, 0);

}

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


Thanks a lot for the prompt response. I will think why the normal arrays cannot execute as a subgraph. I am thinking also how to draw a line between the last two points of L2_Buyer and DI_Buyer when there is an input condition to show the divergences between the lines ..

Sent using the NexusFi mobile app

Reply With Quote
  #24 (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
Thanks a lot for the prompt response. I will think why the normal arrays cannot execute as a subgraph. I am thinking also how to draw a line between the last two points of L2_Buyer and DI_Buyer when there is an input condition to show the divergences between the lines ..

Sent using the NexusFi mobile app

You would be better off re-writing the Donchian Channel Study in a separate study outside of your trading system and just import the signal once you have all the features you want.

It makes for clearer separation of the different functions for debugging and performance.

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

I am wondering how to draw a line from L2_Buyer[Index-1] to L2_Buyer[Index-2] and another line from DI_Buyer[Index-1] and DI_Buyer[Index-2] at the condition of buy entry.
I think this will be need a new subgraph declared within the body not as an input and will need to set it as draw_style to line but how to define the start and end point statement .. Not sure where is that documented ?

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


Trembling Hand View Post
You would be better off re-writing the Donchian Channel Study in a separate study outside of your trading system and just import the signal once you have all the features you want.

It makes for clearer separation of the different functions for debugging and performance.

There is no reason that SCFloatArray cannot work -- as u stated it is all zeroed all the time -- the array of the imported study subgraph may be defined in another type . I will check the code of the Donchain study as well

Reply With Quote
  #27 (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
There is no reason that SCFloatArray cannot work -- as u stated it is all zeroed all the time -- the array of the imported study subgraph may be defined in another type . I will check the code of the Donchain study as well

Nah they are all float arrays. Last guess is that they are being re-written on every call. Just make them a SCSubgraphRef. Why are you not doing that??

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

I did and it is working but I was just wondering the reason !
I am now in the stage of drawing the lines ...

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

What is really interesting -- I coded the same system in the spreadsheets and it provides more signals that are confirmed with visual reviews ! this is what is really making me wonder what is the root cause of that discrepancy ~

I found a proof that there is wrong computation - by viewing L2_Buyer and L2_Seller there is missed ones from the system calculation as shown in the rectangles in the chart attached ...
I tried every possible combination of the Index-x comparisons but it didn't help --- I think the import of the Donchian study subgraphs is not correct for some reason ~

I did attach how the L2_Buyer and L2_Seller should look as indicated from the spreadsheet system calculation ... what is wrong with our ACSIL code ?



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


It worked as the spreadsheet when I copied and pasted the dochian channel code within the trading system.
The idea is get price divergences with demand index or any other study line that I need to import ..so importing should work to be independent from the study to compare with... I will not copy and paste each study code within the system.
I think there might be an issue with the Get function to import the arrays .. this is not what I expected from ACSIl... This is too basic and we need to work it around !!!

Sent using the NexusFi mobile app

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