NexusFi: Find Your Edge


Home Menu

 





ACSIL - Getting the VPOC of a CUSTOM Volume Profile


Discussion in Sierra Chart

Updated
      Top Posters
    1. looks_one yonatan with 7 posts (0 thanks)
    2. looks_two ludvig with 2 posts (2 thanks)
    3. looks_3 ktrader with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 5,534 views
    2. thumb_up 2 thanks given
    3. group 4 followers
    1. forum 11 posts
    2. attach_file 0 attachments




 
Search this Thread

ACSIL - Getting the VPOC of a CUSTOM Volume Profile

  #1 (permalink)
 yonatan 
Haifa Israel
 
Experience: Beginner
Platform: sierra chart
Broker: Optimus Trading Group/Rithmic
Trading: es
Posts: 91 since Apr 2012
Thanks Given: 50
Thanks Received: 71

Does ACSIL have a way to get the VPOC of a Volume Profile that was drawn using the TOOLS >> Draw Volume Profile ?

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Are there any eval firms that allow you to sink to your …
Traders Hideout
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
Futures True Range Report
The Elite Circle
Exit Strategy
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
The Program
18 thanks
GFIs1 1 DAX trade per day journal
18 thanks
  #3 (permalink)
 yonatan 
Haifa Israel
 
Experience: Beginner
Platform: sierra chart
Broker: Optimus Trading Group/Rithmic
Trading: es
Posts: 91 since Apr 2012
Thanks Given: 50
Thanks Received: 71


Ok, so the solution is that this data can be approached using sc.GetStudyArrayUsingID. The VPOC data is held in the sc.Subgraph[1].Data array of the volume by price study.

Started this thread Reply With Quote
  #4 (permalink)
 yonatan 
Haifa Israel
 
Experience: Beginner
Platform: sierra chart
Broker: Optimus Trading Group/Rithmic
Trading: es
Posts: 91 since Apr 2012
Thanks Given: 50
Thanks Received: 71

I still need help here,

So far I understand that the VPOC data is held in the sc.Subgraph[1].Data array of the volume by price study, so my idea is to use sc.GetStudyArrayUsingID in order to get the Data of the first subgraph of the Volume by Price study.

What I still don't understand is - Once I pulled the VPOC Subgraph data into a SCFloatArray array I need to specify an Index for the SCFloatArray variable.
for an example:

SCFloatArray VPOC;
sc.GetStudyArrayUsingID(VP_ID.GetStudyID(),VPOC_SG.GetSubgraphIndex(),VPOC);
float POCatIndex = VPOC[Some Index];

(VP_ID, VPOC_SG are the inputs that specify the ID of the Volume Profile study and the SubGraph of the VPOC)

The VPOC is spanning through many bars so which Index should I use?

Started this thread Reply With Quote
  #5 (permalink)
 
ktrader's Avatar
 ktrader 
glostrup, denmark
 
Experience: Advanced
Platform: Custom platform
Broker: CQG
Trading: Futures, Options, Stocks
Posts: 249 since Aug 2011
Thanks Given: 152
Thanks Received: 275


yonatan View Post
I still need help here,

So far I understand that the VPOC data is held in the sc.Subgraph[1].Data array of the volume by price study, so my idea is to use sc.GetStudyArrayUsingID in order to get the Data of the first subgraph of the Volume by Price study.

What I still don't understand is - Once I pulled the VPOC Subgraph data into a SCFloatArray array I need to specify an Index for the SCFloatArray variable.
for an example:

SCFloatArray VPOC;
sc.GetStudyArrayUsingID(VP_ID.GetStudyID(),VPOC_SG.GetSubgraphIndex(),VPOC);
float POCatIndex = VPOC[Some Index];

(VP_ID, VPOC_SG are the inputs that specify the ID of the Volume Profile study and the SubGraph of the VPOC)

The VPOC is spanning through many bars so which Index should I use?


The volumebyprice study uses a structure which is available to your study too. You could consider using this structure directly: sc.VolumeAtPriceForBars.

more information: ACSIL Interface Members - Variables and Arrays - Sierra Chart


--ktrader

Reply With Quote
  #6 (permalink)
 yonatan 
Haifa Israel
 
Experience: Beginner
Platform: sierra chart
Broker: Optimus Trading Group/Rithmic
Trading: es
Posts: 91 since Apr 2012
Thanks Given: 50
Thanks Received: 71

Hi @ktrader, thanks for your help.

My understanding id that the sc.VolumeAtPriceForBars refers to the volumes at the prices of a specific bar but here I am trying to get the poc of a custom Volume profile that spans through many bars. Am I missing something ?

Started this thread Reply With Quote
  #7 (permalink)
 crazybears 
Alesia E.U.
 
Experience: Intermediate
Platform: Sierra chart
Trading: Futures
Posts: 168 since Feb 2011
Thanks Given: 146
Thanks Received: 115

Hi

take a look here
Using Drawing Tools from an Advanced Custom Study - Sierra Chart

hope can be useful

Reply With Quote
  #8 (permalink)
 yonatan 
Haifa Israel
 
Experience: Beginner
Platform: sierra chart
Broker: Optimus Trading Group/Rithmic
Trading: es
Posts: 91 since Apr 2012
Thanks Given: 50
Thanks Received: 71

Hi @crazybears, thanks.

I was surprised to find that the Volume Profile even appears on the TOOLS section because it is actually a study and not a tool. I will look into it although I doubt that the VPOC value will be there.
Thanks :-)

Started this thread Reply With Quote
  #9 (permalink)
ludvig
russia kaliningrad
 
Posts: 19 since Jan 2011
Thanks Given: 0
Thanks Received: 21

This code is an example how to get any profile values.
 
Code
#include "C:\SierraChart\ACS_Source\sierrachart.h"
#include <map>
using namespace std;

SCDLLName("Custom Profile Values") 

struct s_VolumeAtPriceV3 : s_VolumeAtPriceV2
{
	s_VolumeAtPriceV3()
		: s_VolumeAtPriceV2(0, 0, 0, 0)
	{
	}
};

SCSFExport scsf_CustomProfileValues(SCStudyInterfaceRef sc)
{
	
	int& FirstIndex = sc.PersistVars->i1;
	int& LastIndex = sc.PersistVars->i2;
	
	SCSubgraphRef VolumePOCPrice = sc.Subgraph[0];
	SCSubgraphRef askVolumePOCPrice = sc.Subgraph[1];
	SCSubgraphRef bidVolumePOCPrice = sc.Subgraph[2];
	SCSubgraphRef POCVolume = sc.Subgraph[3];
	SCSubgraphRef askPOCVolume = sc.Subgraph[4];
	SCSubgraphRef bidPOCVolume = sc.Subgraph[5];
	
	SCInputRef iNumBarsForProfile  = sc.Input[1];
	SCInputRef iBeginProfileBarsBack  = sc.Input[2];
	
	if (sc.SetDefaults)
	{
		sc.GraphName = "POC Volume";

		sc.StudyDescription = "";

		sc.AutoLoop = 1;
		sc.GraphRegion = 0;

		sc.FreeDLL = 0;

		sc.MaintainVolumeAtPriceData = 1;  

		iNumBarsForProfile.Name = "Number of bars in profile";
		iNumBarsForProfile.SetInt(10);
		
		iBeginProfileBarsBack.Name = "Bars back start";
		iBeginProfileBarsBack.SetInt(20);

		return;
	}
	
	if (((int)sc.VolumeAtPriceForBars->GetNumberOfBars() < sc.ArraySize)||(sc.Index < iBeginProfileBarsBack.GetInt()))
		return;
	
	if (sc.UpdateStartIndex == 0)
	{
		FirstIndex = 0;
		LastIndex = 0;
	}
	
	if (sc.Index < iBeginProfileBarsBack.GetInt())
		return;
		
		FirstIndex = sc.ArraySize - 1 - iBeginProfileBarsBack.GetInt();
		
		LastIndex  = FirstIndex + iNumBarsForProfile.IntValue; 
	
		if (LastIndex >= sc.ArraySize)
			LastIndex = sc.ArraySize - 1;
				
		
		map<int,s_VolumeAtPriceV3> ProfileMap;
	
		for (int Index = FirstIndex; Index<=LastIndex; Index++)
		{
			int CurrentVAPPriceInTicks = INT_MIN ; 
			const s_VolumeAtPriceV2 *p_VolumeAtPrice;
	
			while (sc.VolumeAtPriceForBars->GetNextHigherVAPElement(Index, CurrentVAPPriceInTicks, &p_VolumeAtPrice))
			{
				ProfileMap[CurrentVAPPriceInTicks] += *p_VolumeAtPrice;
			}
		}
		
			int bidVolumeAtPriceLevel = 0;
			int askVolumeAtPriceLevel = 0;
			int VolumeAtPriceLevel = 0;
			float Price = 0;
		
		for (map<int,s_VolumeAtPriceV3>::iterator VapIt=ProfileMap.begin(); VapIt!=ProfileMap.end(); VapIt++)
		{
			
			Price = VapIt->first*sc.TickSize;
			bidVolumeAtPriceLevel = VapIt->second.BidVolume;
			askVolumeAtPriceLevel = VapIt->second.AskVolume;
			VolumeAtPriceLevel = VapIt->second.Volume;
			
			  if (POCVolume[sc.Index] < VolumeAtPriceLevel)
	  		{
	  			POCVolume[sc.Index] = (float)VolumeAtPriceLevel;
	  			VolumePOCPrice[sc.Index] = Price;
	  		}
	  		if (askPOCVolume[sc.Index] < askVolumeAtPriceLevel)
	  		{
	  			askPOCVolume[sc.Index] = (float)VolumeAtPriceLevel;
	  			askVolumePOCPrice[sc.Index] = Price;
	  		}
	  		if (bidPOCVolume[sc.Index] < bidVolumeAtPriceLevel)
	  		{
	  			bidPOCVolume[sc.Index] = (float)VolumeAtPriceLevel;
	  			bidVolumePOCPrice[sc.Index] = Price;
	  		}
	  		
		}

}

Reply With Quote
Thanked by:
  #10 (permalink)
 yonatan 
Haifa Israel
 
Experience: Beginner
Platform: sierra chart
Broker: Optimus Trading Group/Rithmic
Trading: es
Posts: 91 since Apr 2012
Thanks Given: 50
Thanks Received: 71


@ludvig, thank you very much for this code. There is a lot that i can learn from it.

My problem here is that this code requires inputs of the Number of bars in the profile and the beginning Bar. What I need is a code that will scan a chart for all existing profiles on the chart, calculate their POC values and then use those values for other purposes.

But still there is a A LOT that I can learn from your code and I appreciate it very much.

Yonatan.

Started this thread Reply With Quote




Last Updated on March 29, 2014


© 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