Login Page - Create Account

Support Board


Date/Time: Thu, 26 Dec 2024 13:17:52 +0000



C++ List and Maps

View Count: 1888

[2015-11-28 18:22:59]
FerroTrader - Posts: 70
Hello,

how can I use list (http://www.cplusplus.com/reference/list/list/) and maps (http://www.cplusplus.com/reference/map/map/) inside a ASCIL code ?
Where do I have to initialize them inside the code ?

Thanks
[2015-11-28 23:00:46]
Sierra Chart Engineering - Posts: 104368
Did you want these STL objects to persist even after the study function returns?
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2015-11-29 09:32:30]
FerroTrader - Posts: 70
Hello,

thank you for your response.
Yes, I want them to persist since I want to use them in my studies.

Actually, I just would like to use STL objects (vector, list, map, queue) like Sierra does in the "studies8.cpp" under "ACS_Source" directory (the line I am referring to is 6688 number, the *.cpp file is studies8.cpp itself).
Nevertheless, everytime I try to use list for instance, Visual Studio gives me incorrect compiling errors (I have installed all teh directories required by Sierra to compile and I have followed correctly the Sierra guide to use MS Visual Studio as a compiling environment)

Thanks, enjoy your sunday
Ferro
[2015-11-29 21:47:09]
Sierra Chart Engineering - Posts: 104368
Not sure what the compiler errors are, but be sure to include these header files at the very top of the source code file:
#include <iterator>
#include <vector>

You will need others when using the list, map, queue containers.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2015-11-29 21:47:40
[2015-11-29 22:22:38]
FerroTrader - Posts: 70
Hello,

thank you for your response.
I have added those headers to my code but Visual Studio does not compile: I have added the code reported by you under "studies8.cpp" but it still does not compile.
Where should I add the "std::vector<char*> Tokens;" code ?
Could you provide a simple code that compiles on your side ?

Thanks
[2015-11-29 22:51:49]
Sierra Chart Engineering - Posts: 104368
Have a look at the example in /ACS_Source/RequestValuesFromServerAndDraw.cpp

Also, we do not provide programming help. It is your responsibility to examine the compiler error messages and resolve the problem.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2015-11-29 22:57:05
[2015-11-30 06:36:47]
FerroTrader - Posts: 70
Thank you.

I have just seen that the STL expression must be in the form: vector<TypeHere> *MyVector...not vector<TypeHere> MyVector...

Have a good week
Andrew
[2015-11-30 07:05:35]
Sierra Chart Engineering - Posts: 104368
Only if you are defining a pointer to it and dynamically creating it.

Also be sure to prefix it with std::
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2015-12-12 12:54:39]
FerroTrader - Posts: 70
Hello, sorry for "re-opening" this thread...
Would you be so kind to provide and example of "dinamically creating" the vector ?

For instance, I create the pointer to the vector like this:

std::vector<int> *MyAttempt;

but once I try to write something like: MyAttempt = new std::vector<int>();
Visual Studio does not compile the solution...

Could you be so kind to help me please ?

Thanks
CP
[2015-12-12 22:09:30]
Sierra Chart Engineering - Posts: 104368
This should work:

std::vector<int> * VectorContainer = new std::vector<int>;

If it does not work, what are the Visual C++ error messages?

Also we see your Sierra Chart account is expired and we do not see a recent login to it. Log into this Support Board using Help >> Support Board, so we are aware of what account you are using. This is a requirement to receive support. The account does not necessarily have to be paid.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2015-12-12 22:11:12

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account