Let's teach Sierra Chart how to talk - Sierra Chart Programming | futures io social day trading
futures io futures trading


Let's teach Sierra Chart how to talk
Updated: Views / Replies:1,458 / 3
Created: by Nicolas11 Attachments:3

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
 

Let's teach Sierra Chart how to talk

  #1 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received

Let's teach Sierra Chart how to talk

The title of this thread is a tribute to the thread "Let's Teach NinjaTrader how to talk" thanks to which I have learnt that Windows has built-in speech generation capability, and which gives some code example for NinjaTrader.

Objective: have Sierra Chart speak "New Candle" at each new candle
Of course, this is not very useful. But the idea is that the code may be adapted for other uses, as sophisticated alerts.

Important disclaimer. I am a total newbie in C++, .NET, Windows programming, etc. I have solved all my Windows-related problems by Googling. And I am not sure to have understood what I have done. What follows is experimental, may be dirty and non-optimal. If another futures.io (formerly BMT) member wants to improve this solution, she/he shall not hesitate!

1. Open a new solution in Visual C++ with the 40-line code below.
Do not forget to adapt the first line to reflect the exact directory of your sierrachart.h
Do not forget to update the output .DLL directory (as usual)

2. Try to build the solution.
You should obtain the following error message: fatal error C1190: managed targeted code requires a '/clr' option
Go to Properties of the solution >> Configuration Properties >> General >> Common Language Runtime Support
Choose "Common Language Runtime Support (/clr)"

Reference : managed targeted code requires a /clr option
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


3. Try to build the solution.
You should obtain the following error message: Command line error D8016 : '/MT' and '/clr' command-line options are incompatible
Go to Properties of the solution >> Configuration Properties >> C++ >> Code Generation >> Runtime Library
Choose "Multi-threaded DLL (/MD)"

References : '/MT' and '/clr' command-line options are incompatible and /MD, /MT, /LD (Use Run-Time Library)
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


4. Try to build the solution.
You should obtain the following error message: fatal error C1107: could not find assembly 'System.Speech.dll': please specify the assembly search path using /AI or by setting the LIBPATH environment variable
Go to Properties of the solution >> Configuration Properties >> C++ >> General >> Resolve #using References
Add the directory of System.Speech.dll

On my computer, this directory is:
C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\
Reference: /AI (Specify Metadata Directories) (C++)
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


5. Try to build the solution: should be OK!
Then add the study "Voice" to your chart, as usual.
You should hear "Hello" once or twice.
And "New candle" at each new candle.

6. Some links for my own reference:
On #pragma managed: managed type or function cannot be used in an unmanaged function - .NET Framework and Mixing Managed and Unmanaged code - CodeProject
On managed global variable: compile error: may not declare a global or static variable, or a member of a native type that refers to objects in the gc heap
On gcnew and ^ : C3673: class does not have a copy-constructor
"A Very Easy Introduction to Microsoft .NET Speech Synthesis (VB, C#, C++)": A Very Easy Introduction to Microsoft .NET Speech Synthesis (VB, C#, C++) - CodeProject
Reference of Microsoft Speech API: Microsoft Speech API (SAPI) 5.3 and System.Speech Namespaces ()


Once more, the above is experimental. It may exist cleaner solutions.

Nicolas

 
Code
#include "C:\Sierrachart-IQFeed\ACS_Source\sierrachart.h"

#using <System.dll>
#using <System.Speech.dll>
using namespace System::Speech::Synthesis;

SCDLLName("Voice")

#pragma managed
public ref class Globals abstract sealed {
public:
   static SpeechSynthesizer^ speaker = gcnew SpeechSynthesizer();
};

#pragma managed
SCSFExport scsf_Voice(SCStudyGraphRef sc)
{

	// Persistent variable:
	int& LastScIndex = sc.PersistVars->i1;

	if ( sc.SetDefaults )
	{	
		sc.GraphName = "Voice";
		sc.StudyDescription = "Voice";
		sc.AutoLoop = 1;
		sc.FreeDLL = 1;

		Globals::speaker->SpeakAsync("Hello");

		return;
	}

	if ( sc.Index == 0 ) LastScIndex = -1;

	// If new candle...
	if ( sc.Index != LastScIndex ) {
		LastScIndex = sc.Index;
		// If in real-time, let's talk!
		if ( sc.Index == sc.ArraySize-1 ) {
			Globals::speaker->SpeakAsync("New candle");
		}
	}
}

Reply With Quote
The following 7 users say Thank You to Nicolas11 for this post:
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,353 given, 83,234 received


Dude, you are on a roll!

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following user says Thank You to Big Mike for this post:
 
  #4 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received

A code a little bit cleaner. I have put in bold all the specific parts related to the voice.

 
Code
#include "C:\Sierrachart-IQFeed\ACS_Source\sierrachart.h"

#using <System.dll>
#using <System.Speech.dll>

using namespace System;
using namespace System::Speech::Synthesis;

#pragma managed
public ref class Globals abstract sealed {
public:
   static SpeechSynthesizer^ speaker = gcnew SpeechSynthesizer();
};

SCDLLName("Voice")

SCSFExport scsf_Voice(SCStudyGraphRef sc)
{

	// Persistent variable:
	int& LastScIndex = sc.PersistVars->i1;

	if ( sc.SetDefaults ) {	
		sc.GraphName = "Voice";
		sc.StudyDescription = "Voice";
		sc.AutoLoop = 1;
		sc.FreeDLL = 1;

		return;
	}

	if ( sc.LastCallToFunction ) {
		delete Globals::speaker;
	}

	if ( sc.Index == 0 ) LastScIndex = -1;

	// If new candle...
	if ( sc.Index != LastScIndex ) {
		LastScIndex = sc.Index;
		// If in real-time, let's talk!
		if ( sc.Index == sc.ArraySize-1 ) {
			Globals::speaker->SpeakAsync("New candle");
		}
	}
}

Reply With Quote
The following 2 users say Thank You to Nicolas11 for this post:

Reply



futures io > > > > > Let's teach Sierra Chart how to talk

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
Sierra Chart TPO chart + composite volume profile Big Mike Sierra Chart 10 August 2nd, 2016 09:15 AM
Let's Teach NinjaTrader how to talk Zondor NinjaTrader Programming 45 May 15th, 2016 02:31 PM
How to disable top most status line of chart in Sierra Chart Big Mike Sierra Chart 9 April 16th, 2013 07:07 PM
Windows 8 and Sierra Chart Big Mike Sierra Chart 5 December 1st, 2012 05:59 PM
Sierra chart and dual monitoring dallasdesi2008 Sierra Chart 9 February 3rd, 2012 09:58 AM


All times are GMT -4. The time now is 05:25 AM.

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-16 in 0.09 seconds with 20 queries on phoenix via your IP 54.160.245.121