Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Updated February 21, 2021
February 13th, 2021, 06:47 AM
Prague
Posts: 28 since Nov 2016
Thanks Given: 8
Thanks Received: 2
Could you build Large Volume Trade Indicator based on VAP function?
I do not think so and this is the reason why I am trying to do this.
Trembling Hand
I think you have a fundamental misunderstanding of what is going on here.
TS data is not a different data set from "other" data.
Could you explain why you think it is? Where does it come from?
February 13th, 2021, 07:40 AM
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
Could you build Large Volume Trade Indicator based on VAP function?
Yes. But as your details of exactly what you want are missing or confusing we are going in circles.
For example my post at #4 and yours at #17 are the same thing.
February 13th, 2021, 07:45 AM
Prague
Posts: 28 since Nov 2016
Thanks Given: 8
Thanks Received: 2
Ok, could you please share with me how achieve filtering orders by their size in VAP?
I dont think that we are in the circles, maybe it is my fault that I wrongly assumed that I
cant filter order size in VAP. Sorry for that.
Trembling Hand
Yes. But as your details of exactly what you want are missing or confusing we are going in circles.
For example my post at #4 and yours at #17 are the same thing.
February 13th, 2021, 08:02 AM
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
Ok, could you please share with me how achieve filtering orders by their size in VAP?
I dont think that we are in the circles, maybe it is my fault that I wrongly assumed that I
cant filter order size in VAP. Sorry for that.
Firstly that's not what my post at 4 and yours at #17 is asking to do but rather break down ask/bid volume.
But
Filter order size by what? A threshold amount? A descending/ascending amount?
It may help if you can say what the SC large volume Trader study doesn't do what you want it to do.
February 13th, 2021, 09:02 AM
Prague
Posts: 28 since Nov 2016
Thanks Given: 8
Thanks Received: 2
Here is my post #1:
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.
So your post #4 is relevant to describe and understand price levels. The same is the #17, I always mentioned that volume on this levels should be from the TS, not VAP.
Filter order by threshold amount, that means for example only orders bigger than 5.
Trembling Hand
Firstly that's not what my post at 4 and yours at #17 is asking to do but rather break down ask/bid volume.
But
Filter order size by what? A threshold amount? A descending/ascending amount?
It may help if you can say what the SC large volume Trader study doesn't do what you want it to do.
February 13th, 2021, 05:15 PM
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
Here is my post #1:
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.
So your post #4 is relevant to describe and understand price levels. The same is the #17, I always mentioned that volume on this levels should be from the TS, not VAP.
Filter order by threshold amount, that means for example only orders bigger than 5.
LOL!!
So back to my code at #12 all you have to do is decide how you want to represent that on the chart rather than save to txt
February 13th, 2021, 05:23 PM
Prague
Posts: 28 since Nov 2016
Thanks Given: 8
Thanks Received: 2
In this code I do not see any part which assign Ask/Bid volume to the prices.
In my opinion it is only the tape , trade by trade.
The crucial thing how to sum all ask/bid volume on the relevant prices,
think about it like you have reversal chart, price ticks one up, one down
and you need to sum all A/B volume on the concrete levels.
Code
SCSFExport scsf_Save_TimeNSales(SCStudyGraphRef sc) {
SCInputRef OutputFile = sc.Input[0];
if (sc.SetDefaults) {
// https://www.sierrachart.com/SupportBoard.php?ThreadID=36979
sc.GraphName = "Save_TimeNSales";
sc.StudyDescription = "Save Time and sales to file";
sc.GraphRegion = 0;
//sc.AutoLoop=true;
sc.FreeDLL = 1;
OutputFile.Name = "The storage link";
SCString OutputFileDefaultName;
OutputFileDefaultName.Format("C:\\SierraChart\\Data\\1_%s.txt", sc.Symbol.GetSubString(2, 0).GetChars());
OutputFile.SetString(OutputFileDefaultName);
}
std::ofstream file(OutputFile.GetString(), std::ios_base::app);
if (!file) {
SCString Buffer;
Buffer.Format("Unable to open file %s", OutputFile.GetString());
sc.AddMessageToLog(Buffer, 1);
//return;
}
if (sc.Index == sc.ArraySize - 1)
{
__int64& LastProcessedSequence = sc.GetPersistentInt64(1);
c_SCTimeAndSalesArray TimeSales;
sc.GetTimeAndSales(TimeSales);
if (TimeSales.Size() == 0)
return;
if (LastProcessedSequence != 0)
{
for (int TSIndex = 0; TSIndex < TimeSales.Size(); ++TSIndex)
{
if (TimeSales[TSIndex].Sequence < LastProcessedSequence)
continue;
if (TimeSales[TSIndex].Type == SC_TS_BID || TimeSales[TSIndex].Type == SC_TS_ASK)
{
//int AskVol = TimeSales[TSIndex].AskSize;
//int TotalAsks = TimeSales[TSIndex].TotalAskDepth;
//int BidVol = TimeSales[TSIndex].BidSize;
//int TotalBids = TimeSales[TSIndex].TotalBidDepth;
float Price = TimeSales[TSIndex].Price;
int Vol = TimeSales[TSIndex].Volume;
int TradeType = TimeSales[TSIndex].Type; // at bid or ask
int ValueFormat = sc.BaseGraphValueFormat;
SCString formatString = " %i/%02i/%02i %02i:%02i:%02i: %03i , Index: %i, Price: %0.4f, Vol: %i BidAsk: %i";
SCDateTime TradeDateTime = TimeSales[TSIndex].DateTime;
TradeDateTime += sc.TimeScaleAdjustment;
int Year, Month, Day, Hour, Minute, Second, MilliSecond;
TradeDateTime.GetDateTimeYMDHMS_MS(Year, Month, Day, Hour, Minute, Second, MilliSecond);
SCString BarDataString;
BarDataString.Format(formatString, Year, Month, Day, Hour, Minute, Second, MilliSecond, TSIndex, Price, Vol, TradeType);
file << BarDataString << std::endl;
}
}
}
LastProcessedSequence = TimeSales[TimeSales.Size() - 1].Sequence;
}
}
Trembling Hand
LOL!!
So back to my code at #12 all you have to do is decide how you want to represent that on the chart rather than save to txt
February 13th, 2021, 07:48 PM
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
In this code I do not see any part which assign Ask/
Bid volume to the prices.
Mate I think you are lost here! This is the code that identifies the trade at bid or ask,
Code
int TradeType = TimeSales[TSIndex].Type; // at bid or ask
This is the code that identifies the price for that trade.
Code
float Price = TimeSales[TSIndex].Price;
liboro
In my opinion it is only the
tape , trade by trade.
The crucial thing how to sum all ask/bid volume on the relevant prices,
think about it like you have reversal chart, price ticks one up, one down
and you need to sum all A/B volume on the concrete levels.
Its up to you to either make it clearer what magic you want to happen with it. You are now talking about what I did in the first study code!!
February 13th, 2021, 07:52 PM
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
I'll give it one more shot to figure out what you are trying to do here.
Can I have an picture of a chart well annotated with what data/subgraphs/etc you want from what data. Use data like this and draw it on a chart,
liboro
PRICE 69.60 AV (from TS) = XY, BV (from TS) = XY
PRICE 69.61 AV (from TS) = XY, BV (from TS) = XY
PRICE 69.62 AV (from TS) = XY, BV (from TS) = XY
PRICE 69.63 AV (from TS) = XY, BV (from TS) = XY
February 14th, 2021, 12:02 AM
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
Because I like banging my head against a wall....
2021-02-14 15_48_55-Window
Here is an example code that will mark on each bar where the largest volume bid and ask trade occur. Not the greatest of studies nor the most efficient but just an example of using T&S data on a chart. And remember sc.GetTimeAndSales() only works on live connections & replay.
Code
SCSFExport scsf_TimeNSales(SCStudyGraphRef sc) {
SCSubgraphRef BidHighVol = sc.Subgraph[0];
SCSubgraphRef AskHighVol = sc.Subgraph[1];
if (sc.SetDefaults) {
sc.GraphName = "Highest_Bid_ASk_Vol";
sc.StudyDescription = "Mark on each bar the highest bid & ask trade";
sc.GraphRegion = 0;
sc.AutoLoop=0; //Use manual looping
BidHighVol.Name = "Bid High Vol";
BidHighVol.DrawStyle = DRAWSTYLE_TRIANGLE_RIGHT;
BidHighVol.DrawZeros = 0;
BidHighVol.PrimaryColor = RGB(255, 147, 147);
BidHighVol.LineWidth = 4;
AskHighVol.Name = "AskHighVol";
AskHighVol.DrawStyle = DRAWSTYLE_TRIANGLE_LEFT;
AskHighVol.DrawZeros = 0;
AskHighVol.PrimaryColor = RGB(128, 255, 128);
AskHighVol.LineWidth = 4;
}
int& HigestBidVol = sc.GetPersistentInt(1);
int& HigestAskVol = sc.GetPersistentInt(2);
int& PriorArraySize = sc.GetPersistentInt(3);
float& HigestBidVolPrice = sc.GetPersistentFloat(1);
float& HigestAskVolPrice = sc.GetPersistentFloat(2);
int64_t& LastProcessedSequence = sc.GetPersistentInt64(1);
//This code depends upon manual looping being set
for (int Index = sc.UpdateStartIndex; Index < sc.ArraySize; Index++)
{
if (Index == 0)
{
PriorArraySize = sc.ArraySize;
}
// If there are new bars added
if (PriorArraySize < Index)
{
HigestAskVol = 0;
HigestAskVolPrice = 0.0;
HigestBidVol = 0;
HigestBidVolPrice = 0.0;
// sc.AddMessageToLog("******** NEW BAR *******************************************************************", 0);
PriorArraySize = Index;
}
//reset the sequence number on a full recalculation so we start fresh for each full recalculation.
if (sc.IsFullRecalculation && sc.UpdateStartIndex == 0) {
BidHighVol[Index] = 0.0;
AskHighVol[Index] = 0.0;
LastProcessedSequence = 0;
}
// Get the Time and Sales
c_SCTimeAndSalesArray TimeSales;
sc.GetTimeAndSales(TimeSales);
if (TimeSales.Size() == 0)
return; // No Time and Sales data available for the symbol
//Set the initial sequence number
if (LastProcessedSequence == 0)
LastProcessedSequence = TimeSales[TimeSales.Size() - 1].Sequence;
// Loop through the Time and Sales.
for (int TSIndex = 0; TSIndex < TimeSales.Size(); ++TSIndex)
{
//do not reprocess previously processed sequence numbers.
if (TimeSales[TSIndex].Sequence <= LastProcessedSequence)
continue;
//only interested in trade records
if (TimeSales[TSIndex].Type == SC_TS_BID || TimeSales[TSIndex].Type == SC_TS_ASK)
{
/*int AskVol = TimeSales[TSIndex].AskSize;
//int TotalAsks = TimeSales[TSIndex].TotalAskDepth;
//int BidVol = TimeSales[TSIndex].BidSize;
//int TotalBids = TimeSales[TSIndex].TotalBidDepth;
float BidPrice = TimeSales[TSIndex].Bid;
float AskPrice = TimeSales[TSIndex].Ask;
SCDateTime RecordAdjustedDateTime = TimeSales[TSIndex].DateTime;
// Apply the time zone offset for the chart. This will result in the actual date-time of the record in the charts time zone.
RecordAdjustedDateTime += sc.TimeScaleAdjustment;*/
float Price = TimeSales[TSIndex].Price;
int Vol = TimeSales[TSIndex].Volume;
int TradeType = TimeSales[TSIndex].Type; // at bid or ask
// if last trade volume is the higest for current bar
if (TimeSales[TSIndex].Type == SC_TS_BID && Vol > HigestBidVol) {
HigestBidVol = Vol;
HigestBidVolPrice = Price;
}
if (TimeSales[TSIndex].Type == SC_TS_ASK && Vol > HigestAskVol) {
HigestAskVol = Vol;
HigestAskVolPrice = Price;
}
/*SCString LargevolString;
LargevolString.Format("LastProcessedSequence: %d, BarIndex: %d, TSIndex: %d, Largest Bid Vol: %d Price: %0.2f", LastProcessedSequence, sc.Index, TSIndex, HigestBidVol, HigestBidVolPrice);
sc.AddMessageToLog(LargevolString, 0);*/
LastProcessedSequence = TimeSales[TimeSales.Size() - 1].Sequence;
}
}
BidHighVol[Index] = HigestBidVolPrice;
AskHighVol[Index] = HigestAskVolPrice;
}
}
Last Updated on February 21, 2021