Support Board
Date/Time: Mon, 24 Feb 2025 19:03:12 +0000
Post From: Example for sc.VolumeAtPriceForStudy
[2021-02-13 23:19:18] |
Nicolas Hervé - Posts: 14 |
I tried this: #include "sierrachart.h" SCDLLName("Volume By Price For Study Demo") SCSFExport scsf_VolumeByPriceForStudyDemo(SCStudyInterfaceRef sc) { if(sc.SetDefaults) { sc.GraphName = "Volume by Price For Study Demo."; sc.StudyDescription = "This study creates arbitrary Volume by Price Data to demonstrate " "the use of sc.VolumeByPriceForStudy() function."; sc.GraphRegion = 0; sc.AutoLoop = 0; sc.MaintainVolumeAtPriceData = 1; } c_VAPContainer * c_VAP_for_study; c_VAP_for_study = sc.VolumeAtPriceForStudy; s_VolumeAtPriceV2 vap = s_VolumeAtPriceV2 ( 100, // Volume 60, // BidVolume 40, // AskVolume 10 // NumberOfTrades ); c_VAP_for_study -> AddVolumeAtPrice ( 3920 * 4, // PriceInTicks (this will be 3920.00 points for ES 0, // BarIndex (try to use always BarIndex 0 for VolumeByPriceForStudy vap ); } But get those compilation error, which I don't know how to fix. -- Starting remote build of Custom Studies Source files: VolumeAtPriceForStudyDemo.cpp. 64-bit -- 00:11:21
Allow time for the server to compile the files and build the DLL. The remote build did not succeed. Result: In file included from scstructures.h:104, from sierrachart.h:22, from VolumeAtPriceForStudyDemo.cpp:1: VAPContainer.h: In instantiation of 'void c_VAPContainerBase<t_VolumeAtPrice>::Clear() [with t_VolumeAtPrice = s_VolumeAtPriceV2]': VolumeAtPriceForStudyDemo.cpp:31:29: required from here VAPContainer.h:390:2: error: cannot bind non-const lvalue reference of type 'c_VAPContainerBase<s_VolumeAtPriceV2>&' to an rvalue of type 'c_VAPContainerBase<s_VolumeAtPriceV2>' 390 | Swap(c_VAPContainerBase<t_VolumeAtPrice>(m_InitialAllocationElements)); | ^~~~ VAPContainer.h:462:23: note: initializing argument 1 of 'void c_VAPContainerBase<t_VolumeAtPrice>::Swap(c_VAPContainerBase<t_VolumeAtPrice>&) [with t_VolumeAtPrice = s_VolumeAtPriceV2]' 462 | ( c_VAPContainerBase& r_That | ~~~~~~~~~~~~~~~~~~~~^~~~~~ -- End of Build -- 00:11:24 |