NexusFi: Find Your Edge


Home Menu

 





Plotshapes in C++ dll


Discussion in Platforms and Indicators

Updated
    1. trending_up 4,067 views
    2. thumb_up 3 thanks given
    3. group 3 followers
    1. forum 10 posts
    2. attach_file 0 attachments




 
Search this Thread

Plotshapes in C++ dll

  #1 (permalink)
raghavan
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.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
Exit Strategy
NinjaTrader
Online prop firm The Funded Trader (TFT) going under?
Traders Hideout
Deepmoney LLM
Elite Quantitative GenAI/LLM
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
60 thanks
Funded Trader platforms
37 thanks
NexusFi site changelog and issues/problem reporting
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #2 (permalink)
JohniFx
Hungary
 
Posts: 72 since Nov 2014
Thanks Given: 118
Thanks Received: 46


raghavan View Post
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.

Reply With Quote
Thanked by:
  #3 (permalink)
 prouser 
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.

Reply With Quote
  #4 (permalink)
raghavan
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);

Reply With Quote
Thanked by:
  #5 (permalink)
raghavan
Bangalore + India
 
Posts: 13 since Jan 2015
Thanks Given: 3
Thanks Received: 2


prouser View Post
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.!

Reply With Quote
Thanked by:
  #6 (permalink)
 prouser 
Zurich/Switzerland
 
Posts: 79 since Oct 2014


raghavan View Post
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.

Reply With Quote
  #7 (permalink)
raghavan
Bangalore + India
 
Posts: 13 since Jan 2015
Thanks Given: 3
Thanks Received: 2


prouser View Post
argPS[3].type = VAR_ARRAY;
argPS[3].val = gSite.GetStockArray(3);

This is wrong.

Thanks for the correction. Edited code.

Reply With Quote
  #8 (permalink)
 prouser 
Zurich/Switzerland
 
Posts: 79 since Oct 2014


raghavan View Post
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)?

Reply With Quote
  #9 (permalink)
raghavan
Bangalore + India
 
Posts: 13 since Jan 2015
Thanks Given: 3
Thanks Received: 2


prouser View Post
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

Reply With Quote
  #10 (permalink)
 prouser 
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.

Reply With Quote




Last Updated on September 20, 2015


© 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