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)
Plotshapes in C++ dll
Updated September 20, 2015
trending_up
4,067 views
thumb_up
3 thanks given
group
3 followers
forum
10 posts
attach_file
0 attachments
Plotshapes in C++ dll
September 20th, 2015, 04:47 AM
Bangalore + India
Posts: 13 since Jan 2015
Thanks Given: 3
Thanks Received: 2
I am trying to call PlotShapes in C++ file. Here's the code.
AmiVar argPS[6];
argPS[0].type = VAR_FLOAT;
argPS[0].val = (float)1;
argPS[1].type = VAR_FLOAT;
argPS[1].val = (float)55;
argPS[2].val = EMPTY_VAL;
argPS[3].val = EMPTY_VAL;
argPS[4].val = EMPTY_VAL;
argPS[5].val = EMPTY_VAL;
gSite.CallFunction("PlotShapes", 6, argPS);
But, I dont see anny shapes being plotted in chart. May I know what I am missing here.
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
September 20th, 2015, 11:07 AM
Hungary
Posts: 72 since Nov 2014
Thanks Given: 118
Thanks Received: 46
raghavan
I am trying to call PlotShapes in C++ file. Here's the code.
AmiVar argPS[6];
argPS[0].type = VAR_FLOAT;
argPS[0].
val = (float)1;
argPS[1].type = VAR_FLOAT;
argPS[1].val = (float)55;
argPS[2].val = EMPTY_VAL;
argPS[3].val = EMPTY_VAL;
argPS[4].val = EMPTY_VAL;
argPS[5].val = EMPTY_VAL;
gSite.CallFunction("PlotShapes", 6, argPS);
But, I dont see anny shapes being plotted in chart. May I know what I am missing here.
just a quess: try to set the unused params .type as well to VAR_FLOAT.
September 20th, 2015, 11:08 AM
Zurich/Switzerland
Posts: 79 since Oct 2014
Yes, you are missing something. You are passing float where you should be passing array as some arguments.
If you are a beginner then first read a book about C programming. AmiBroker's C/C++ development kit is rather recommended for advanced programmers.
September 20th, 2015, 11:10 AM
Bangalore + India
Posts: 13 since Jan 2015
Thanks Given: 3
Thanks Received: 2
By changing above code to, I got the shapes as required.
AmiVar argPS[6];
argPS[0].type = VAR_FLOAT;
argPS[0].val = (float)1;
argPS[1].type = VAR_FLOAT;
argPS[1].val = (float)55;
argPS[2].val = 0;
argPS[3].type = VAR_ARRAY;
argPS[3].array = gSite.GetStockArray(3);
argPS[4].val = EMPTY_VAL;
argPS[5].val = EMPTY_VAL;
gSite.CallFunction("PlotShapes", 6, argPS);
September 20th, 2015, 11:12 AM
Bangalore + India
Posts: 13 since Jan 2015
Thanks Given: 3
Thanks Received: 2
prouser
Yes, you are missing something. You are passing float where you should be passing array to some parameters.
If you are a beginner then first read a book about C programming. AmiBroker's C/C++ development kit is rather recommended for advanced programmers.
Passing float was not a problem. When scalar variable passed as argument to array variable, Amibroker internally converts scalar variables to array with scalar values set to all the array elements. Setting 3rd/4th argument helped printing shapes. Thanks though.!
September 20th, 2015, 11:16 AM
Zurich/Switzerland
Posts: 79 since Oct 2014
raghavan
By changing above code to, I got the shapes as required.
AmiVar argPS[6];
argPS[0].type = VAR_FLOAT;
argPS[0].
val = (float)1;
argPS[1].type = VAR_FLOAT;
argPS[1].val = (float)55;
argPS[2].val = 0;
argPS[3].type = VAR_ARRAY;
argPS[3].val = gSite.GetStockArray(3);
argPS[4].val = EMPTY_VAL;
argPS[5].val = EMPTY_VAL;
gSite.CallFunction("PlotShapes", 6, argPS);
argPS[3].type = VAR_ARRAY;
argPS[3].val = gSite.GetStockArray(3);
This is wrong.
September 20th, 2015, 11:18 AM
Bangalore + India
Posts: 13 since Jan 2015
Thanks Given: 3
Thanks Received: 2
prouser
argPS[3].type = VAR_ARRAY;
argPS[3].
val = gSite.GetStockArray(3);
This is wrong.
Thanks for the correction. Edited code.
September 20th, 2015, 11:26 AM
Zurich/Switzerland
Posts: 79 since Oct 2014
raghavan
Passing float was not a problem. When scalar variable passed as argument to array variable, Amibroker internally converts scalar variables to array with scalar values set to all the array elements. Setting 3rd/4th argument helped printing shapes. Thanks though.!
So why has it not worked before then and why you have passed array in second try (as mentioned in post 3)?
September 20th, 2015, 11:49 AM
Bangalore + India
Posts: 13 since Jan 2015
Thanks Given: 3
Thanks Received: 2
prouser
So why has it not worked before then and why you have passed array in second try (as mentioned in post 3)?
My Guess: Sometime setting EMPTY_VAL to default arguments is enough. Sometimes, it's required that we set some value to these arguments though they are optional arguments. I am also looking for clarity on this. Someone else here can throw some light
September 20th, 2015, 02:29 PM
Zurich/Switzerland
Posts: 79 since Oct 2014
My question was a rhetorical one.
It's pretty obvious that you are a beginner. Get a programing book first & reading docs (if you haven't done so yet) otherwise your guesses will end up in disasters.
Last Updated on September 20, 2015