NexusFi: Find Your Edge


Home Menu

 





Time and sales coding in ACSIL


Discussion in Sierra Chart

Updated
      Top Posters
    1. looks_one Trembling Hand with 34 posts (15 thanks)
    2. looks_two liboro with 28 posts (2 thanks)
    3. looks_3 bobwest with 2 posts (1 thanks)
    4. looks_4 trendisyourfriend with 1 posts (0 thanks)
      Best Posters
    1. looks_one Big Mike with 1 thanks per post
    2. looks_two bobwest with 0.5 thanks per post
    3. looks_3 Trembling Hand with 0.4 thanks per post
    4. looks_4 liboro with 0.1 thanks per post
    1. trending_up 10,660 views
    2. thumb_up 19 thanks given
    3. group 5 followers
    1. forum 64 posts
    2. attach_file 11 attachments




 
Search this Thread

Time and sales coding in ACSIL

  #1 (permalink)
liboro
Prague
 
Posts: 28 since Nov 2016
Thanks Given: 8
Thanks Received: 2

I need a code for Sierra Chart which is based on Time Sales data. The code would put ask/bid values on the relevant prices. The very same as volume at price, but based on TS. Only part of the code or help would be enough for me.

Anyone can help?

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Bigger Wins or Fewer Losses?
Traders Hideout
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Tao te Trade: way of the WLD
24 thanks
My NQ Trading Journal
14 thanks
HumbleTraders next chapter
11 thanks
GFIs1 1 DAX trade per day journal
11 thanks
  #2 (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

Have a look at the code for these studies,

scsf_VolumeAtPriceArrayTest
scsf_VolumeAtPriceThresholdAlert
scsf_VolumeAtPriceThresholdAlertV2

in C:\SierraChart\ACS_Source\Studies8.cpp

Follow me on Twitter Reply With Quote
  #3 (permalink)
liboro
Prague
 
Posts: 28 since Nov 2016
Thanks Given: 8
Thanks Received: 2


Thank you, but these studies are examples of VAP. I am trying to work with Time and Sales data in the way as VAP - put ASK/BID volume on the price levels in the current bar.


Trembling Hand View Post
Have a look at the code for these studies,

scsf_VolumeAtPriceArrayTest
scsf_VolumeAtPriceThresholdAlert
scsf_VolumeAtPriceThresholdAlertV2

in C:\SierraChart\ACS_Source\Studies8.cpp


Reply With Quote
  #4 (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


liboro View Post
Thank you, but these studies are examples of VAP. I am trying to work with Time and Sales data in the way as VAP - put ASK/BID volume on the price levels in the current bar.

So just to be clear what you are wanting is for example a bar that has a high of 105 and low of 100 you want to know how many bid trades at,
100,101,102,103,104,105

and the same for the ask trades?

Follow me on Twitter Reply With Quote
  #5 (permalink)
liboro
Prague
 
Posts: 28 since Nov 2016
Thanks Given: 8
Thanks Received: 2

Yes, this is correct.



Trembling Hand View Post
So just to be clear what you are wanting is for example a bar that has a high of 105 and low of 100 you want to know how many bid trades at,
100,101,102,103,104,105

and the same for the ask trades?


Reply With Quote
  #6 (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


liboro View Post
Yes, this is correct.

Well thats the function you need I would think,

 
Code
SCSFExport scsf_VolumeAtPriceTest(SCStudyInterfaceRef sc)
{


	if (sc.SetDefaults)
	{
		// Set the configuration and defaults

		sc.GraphName = "Volume At Price Test";
		sc.StudyDescription = "This study tests the sc.VolumeAtPriceForBars array.";
		sc.AutoLoop = 1;
		sc.MaintainVolumeAtPriceData = 1;  // true


		return;
	}

	SCString DataString;

	if ((int)sc.VolumeAtPriceForBars->GetNumberOfBars() < sc.ArraySize)
		return;


	// Get the sum of the volumes from all of the prices at this bar
	unsigned int TotalVolume = 0;

	const s_VolumeAtPriceV2* p_VolumeAtPrice = NULL;
	int VAPSizeAtBarIndex = sc.VolumeAtPriceForBars->GetSizeAtBarIndex(sc.Index);
	for (int VAPIndex = 0; VAPIndex < VAPSizeAtBarIndex; VAPIndex++)
	{
		if (!sc.VolumeAtPriceForBars->GetVAPElementAtIndex(sc.Index, VAPIndex, &p_VolumeAtPrice))
			break;

		TotalVolume += p_VolumeAtPrice->Volume;

		//Calculate the price.  This requires multiplying p_VolumeAtPrice->PriceInTicks by the tick size
		float Price = p_VolumeAtPrice->PriceInTicks * sc.TickSize;

		//Other members available:
		unsigned int AskVolume = p_VolumeAtPrice->AskVolume;
		unsigned int BidVolume = p_VolumeAtPrice->BidVolume;
		unsigned int NumberOfTrades = p_VolumeAtPrice->NumberOfTrades;

		DataString.Format("Index: %d,  Price: %f, AskVolume: %d, BidVolume: %d, NumberOfTrades: %d", sc.Index, Price, AskVolume, BidVolume, NumberOfTrades);
		sc.AddMessageToLog(DataString, 0);
	}

}


2021-02-12 10_54_53-Window

Follow me on Twitter Reply With Quote
Thanked by:
  #7 (permalink)
liboro
Prague
 
Posts: 28 since Nov 2016
Thanks Given: 8
Thanks Received: 2

This is great, thank you.

But I need the same system but data from TS as I mentioned earlier - I would like to code something like Large Volume Trade Indicator.

Do you think it is possible?

Reply With Quote
  #8 (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


liboro View Post
This is great, thank you.

But I need the same system but data from TS as I mentioned earlier - I would like to code something like Large Volume Trade Indicator.

Do you think it is possible?

Ok. So then you need one of these,

Time and Sales


Time and Sales for bar index

Follow me on Twitter Reply With Quote
  #9 (permalink)
liboro
Prague
 
Posts: 28 since Nov 2016
Thanks Given: 8
Thanks Received: 2

Thank you.

Do you have any idea how
scGetTimeSalesArrayIndexesForBarIndex
works or for which purposes I should use it?

I tried to work with - limit "for loop" only for the "begin" and "end" index,
but with no success.

My code looks like this:

int BeginIndex = 0, EndIndex = 0;
sc.GetTimeSalesArrayIndexesForBarIndex(sc.UpdateStartIndex, BeginIndex, EndIndex);

...

c_SCTimeAndSalesArray TimeSales;
sc.GetTimeAndSales(TimeSales);

if (TimeSales.Size() == 0)
return; // No Time and Sales data available for the symbol

// Loop through the Time and Sales
int OutputArrayIndex = sc.ArraySize;
for (int TSIndex = BeginIndex; TSIndex <= EndIndex; ++TSIndex)
{
//Adjust timestamps to Sierra Chart TimeZone
SCDateTime AdjustedDateTime = TimeSales[TSIndex].DateTime;
AdjustedDateTime += sc.TimeScaleAdjustment;
}

But with no success.

And do you believe that I can achieve TS data for price levels in the bar
with these two functions?

Thank you for your help!

Reply With Quote
  #10 (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


Yes I think it's very possible but I'm away from my computer til tomorrow I'll have another look then.

Follow me on Twitter Reply With Quote




Last Updated on February 21, 2021


© 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