Create a new study by modifying an existing .cpp...help needed - Sierra Chart | futures io social day trading
futures io futures trading


Create a new study by modifying an existing .cpp...help needed
Updated: Views / Replies:866 / 6
Created: by boze man Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Create a new study by modifying an existing .cpp...help needed

  #1 (permalink)
Elite Member
South Jersey
 
Futures Experience: Advanced
Platform: Sierra
Broker/Data: IB
Favorite Futures: ES, CL
 
Posts: 98 since Apr 2011
Thanks: 19 given, 57 received

Create a new study by modifying an existing .cpp...help needed

Hey all

I am trying to learn how to modify some existing studies but i keep getting some build errors...

1) I create a new cpp file called 'TestOHLC.cpp' via the analysis> New/Open Custom Studies File
2) Copy the existing 'DailyOHLC' code from the studies7.cpp (line7398-7613)
3) #include "sierrachart.h" along with SCDLLName("TestOHLC")
4) save and close
5) Analysis> Build Custom Studies DLL
6) Build Output:

-- Starting build of Custom Studies Source File: TestOHLC.cpp. -- 16:00:10
"C:\SierraChart\CPPCompiler\bin\g++.exe" "C:\SierraChartTESTING\ACS_Source\TestOHLC.cpp" -march=i686 -mtune=i686 -O2 -shared -static -static-libgcc -static-libstdc++ -s -fno-rtti -fno-exceptions -o "C:\SierraChartTESTING\Data\TestOHLC.dll"

C:\SierraChartTESTING\ACS_Source\TestOHLC.cpp: In function 'void scsf_DailyOHLC(SCStudyInterfaceRef)':
C:\SierraChartTESTING\ACS_Source\TestOHLC.cpp:161:5: error: 'CalculateDailyOHLC' was not declared in this scope
-- End of Build -- 16:00:11

I have succesfully built some easy custom studies by modifying some examples but here i am not modifying anything? What am i doing wrong?

Am i missing some references which i have seen in some more advanced code?
#include <iterator>
#include <windows.h>
#include "scstudyfunctions.h"

I was able to create and modify a test study by copying the 'round tick' study from studies6.cpp (lines 3053-3078) and it complied just fine...

so not sure where i am going wrong on these more complex studies?

thanks
b

Reply With Quote
 
  #2 (permalink)
Elite Member
Georgia, US
 
Futures Experience: None
Platform: Various
Favorite Futures: Various
 
josh's Avatar
 
Posts: 4,897 since Jan 2011
Thanks: 5,143 given, 11,242 received

You are attempting to call a function which has not been declared. Look in scstudyfunctions.cpp and you will find the CalculateDailyOHLC code there, and the declaration in the corresponding header file.

Reply With Quote
The following 2 users say Thank You to josh for this post:
 
  #3 (permalink)
Elite Member
South Jersey
 
Futures Experience: Advanced
Platform: Sierra
Broker/Data: IB
Favorite Futures: ES, CL
 
Posts: 98 since Apr 2011
Thanks: 19 given, 57 received



josh View Post
You are attempting to call a function which has not been declared. Look in scstudyfunctions.cpp and you will find the CalculateDailyOHLC code there, and the declaration in the corresponding header file.

thanks for the reply josh...

looks like i needed
#include "scstudyfunctions.h

added then compiled but now get this...
C:\Windows\ccN89V29.o:TestOHLC.cpp.text+0x1d19): undefined reference to `CalculateDailyOHLC(s_sc&, int, int, int, int, int, int, SCGraphData&, SCDateTimeArray&, int, float&, float&, float&, float&)'
collect2.exe: error: ld returned 1 exit status
-- End of Build -- 07:26:20

Reply With Quote
 
  #4 (permalink)
Elite Member
Georgia, US
 
Futures Experience: None
Platform: Various
Favorite Futures: Various
 
josh's Avatar
 
Posts: 4,897 since Jan 2011
Thanks: 5,143 given, 11,242 received

Yes, this is because you are giving the compiler a reference to the definition of the function, as it's found in the header file--but where does the compiler find the code in what you're giving it? It's not there, so you would need to include the other studyfunctions.cpp file in the line to the compiler. You can do this manually by copying the gcc output and executing the gcc command and putting the studyfunctions.cpp in the line as well, or just copy the code from the file into your own file.

Reply With Quote
 
  #5 (permalink)
Elite Member
South Jersey
 
Futures Experience: Advanced
Platform: Sierra
Broker/Data: IB
Favorite Futures: ES, CL
 
Posts: 98 since Apr 2011
Thanks: 19 given, 57 received


josh View Post
You can do this manually by copying the gcc output and executing the gcc command and putting the studyfunctions.cpp in the line as well, or just copy the code from the file into your own file.

thanks for the help!...i was able to get it compiled...the easiest choice for me was to copy the dailyohlc code from the stdyfunctions.cpp into my own file as i had no clue what 'copying gcc output and executing the gcc command' means lol

i am hoping this will enable me to be able to modify some more complex existing studies

thanks again for the help

Reply With Quote
 
  #6 (permalink)
Elite Member
las vegas
 
Futures Experience: Intermediate
Platform: Sierra Chart
Broker/Data: Velocity/IB
Favorite Futures: 6E
 
Posts: 1,147 since Feb 2010
Thanks: 304 given, 836 received


josh View Post
Yes, this is because you are giving the compiler a reference to the definition of the function, as it's found in the header file--but where does the compiler find the code in what you're giving it? It's not there, so you would need to include the other studyfunctions.cpp file in the line to the compiler. You can do this manually by copying the gcc output and executing the gcc command and putting the studyfunctions.cpp in the line as well, or just copy the code from the file into your own file.

Hi @josh,

I understand the concept but I am not understanding the specifics of how to do it. Can you maybe give an example? I always copy the code over too, but I am thinking your way is probably easier.

Thank you!

Reply With Quote
 
  #7 (permalink)
Elite Member
Georgia, US
 
Futures Experience: None
Platform: Various
Favorite Futures: Various
 
josh's Avatar
 
Posts: 4,897 since Jan 2011
Thanks: 5,143 given, 11,242 received


vegasfoster View Post
Hi @josh,

I understand the concept but I am not understanding the specifics of how to do it. Can you maybe give an example? I always copy the code over too, but I am thinking your way is probably easier.

Thank you!

@vegasfoster, I am going strictly from memory here so I hope I am not wrong about this. This is the command line that Sierra runs as copied straight from the build window:

 
Code
"C:\SierraChart\CPPCompiler\bin\g++.exe" "C:\SierraChartCTS\ACS_Source\JoshStudies.cpp" -march=i686 -mtune=i686 -O2 -shared -static -static-libgcc -static-libstdc++ -s -fno-rtti -fno-exceptions  -o "C:\SierraChartCTS\Data\JoshStudies.dll"
I believe you should be able to copy that output, and insert the other file that you want to include in the DLL so the compiler can do its job, like so:

 
Code
"C:\SierraChart\CPPCompiler\bin\g++.exe" "C:\SierraChartCTS\ACS_Source\JoshStudies.cpp" "C:\SierraChartCTS\ACS_Source\scstudyfunctions.cpp" -march=i686 -mtune=i686 -O2 -shared -static -static-libgcc -static-libstdc++ -s -fno-rtti -fno-exceptions  -o "C:\SierraChartCTS\Data\JoshStudies.dll"
You could do a quick test to verify. It would not work if the scstudyfunctions.cpp will not compile on its own (i.e., if it also references code external to the file), which is actually quite possible now that I think about it. If it does work, the resulting DLL would probably be substantially larger, but that really shouldn't matter much. Let me know if it works as expected!

Reply With Quote
The following user says Thank You to josh for this post:

Reply



futures io > > > > Create a new study by modifying an existing .cpp...help needed

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to create a study Mickey Caine Sierra Chart Programming 15 December 4th, 2013 12:37 AM
Color bar study always outputting 0 to spreadsheet study vegasfoster Sierra Chart 2 January 3rd, 2013 01:30 PM
Programming skills needed to create, modify, or improve NinjaTrader 7 indicators? datahogg NinjaTrader Programming 7 October 9th, 2012 10:15 AM
PriorDayOHLC and CurrentDay - help in modifying the display inmax NinjaTrader 1 July 22nd, 2011 10:43 AM
NT 7 Trade Volume Study Needed marin NinjaTrader Programming 5 July 18th, 2011 11:29 AM


All times are GMT -4. The time now is 08:54 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-13 in 0.11 seconds with 19 queries on phoenix via your IP 54.160.245.121