Wildcard in ASCIL - Sierra Chart Programming | futures io social day trading
futures io futures trading


Wildcard in ASCIL
Updated: Views / Replies:843 / 3
Created: by vegasfoster Attachments:1

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
 

Wildcard in ASCIL

  #1 (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

Wildcard in ASCIL

Hi,

I have about 10 instruments that I follow and I would like to have certain default input parameters for several studies automatically change depending on the instrument I currently have selected. For example, change Pivot point times based upon the symbol's RTH. Because the contract names change periodically I am trying to use wildcards after the first two letters of the symbols so I don't have to update the code every month.

I found a wildcard function here Wildcard string compare (globbing) - CodeProject, but I am getting errors within the function that I don't how to resolve.

Any help would be appreciated. Thank you.

 
Code
***** Starting Build of Custom Studies Source File: CCITest.cpp *****	12:33:24
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(15): Warning! W665: col(40) temporary object used to initialize a non-constant reference
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(15): Note! N638: col(40) 'c_ArrayWrapper' defined in: sierrachart.h(1401) (col 7)
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(15): Note! N630: col(40) source conversion type is 'int'
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(15): Note! N631: col(40) target conversion type is 'c_ArrayWrapper<float> (lvalue)'
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(15): Error! E210: col(40) returning reference to function argument or to auto or register variable
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(15): Note! N638: col(40) 'c_ArrayWrapper' defined in: sierrachart.h(1401) (col 7)
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(27): Warning! W665: col(40) temporary object used to initialize a non-constant reference
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(27): Note! N638: col(40) 'c_ArrayWrapper' defined in: sierrachart.h(1401) (col 7)
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(27): Note! N630: col(40) source conversion type is 'int'
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(27): Note! N631: col(40) target conversion type is 'c_ArrayWrapper<float> (lvalue)'
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(27): Error! E210: col(40) returning reference to function argument or to auto or register variable
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(27): Note! N638: col(40) 'c_ArrayWrapper' defined in: sierrachart.h(1401) (col 7)
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(48): Warning! W665: col(24) temporary object used to initialize a non-constant reference
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(48): Note! N638: col(24) 'c_ArrayWrapper' defined in: sierrachart.h(1401) (col 7)
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(48): Note! N630: col(24) source conversion type is 'bool'
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(48): Note! N631: col(24) target conversion type is 'c_ArrayWrapper<float> (lvalue)'
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(48): Error! E210: col(24) returning reference to function argument or to auto or register variable
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(48): Note! N638: col(24) 'c_ArrayWrapper' defined in: sierrachart.h(1401) (col 7)
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(86): Error! E899: col(21) cannot convert expression to target type
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(86): Note! N630: col(21) source conversion type is 'c_ArrayWrapper<float> (lvalue)'
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(86): Note! N631: col(21) target conversion type is 'bool'
There were compilation errors.

***** Build Failed! *****	12:33:26

 
Code
#include "sierrachart.h"

SCDLLName("CCITest") 

/*==========================================================================*/
SCFloatArrayRef wildcmp_S(const char *wild, const char *string)
	{
	// Written by Jack Handy - <A href="mailto:jakkhandy@hotmail.com">jakkhandy@hotmail.com</A>
		const char *cp = NULL, *mp = NULL;

		while ((*string) && (*wild != '*')) 
		{
			if ((*wild != *string) && (*wild != '?')) 
			{
				return 0;
			}
			wild++;
			string++;
		}

		while (*string) 
		{
			if (*wild == '*') 
				{
					if (!*++wild) 
				{
				return 1;
				}
					mp = wild;
					cp = string+1;
				} 
				else if ((*wild == *string) || (*wild == '?')) 
				{
					wild++;
					string++;
				} 
				else 
				{
					wild = mp;
					string = cp++;
				}
		}

		while (*wild == '*') 
		{
			wild++;
		}
		return !*wild;
	}

/*==========================================================================*/

SCSFExport scsf_CCITest(SCStudyInterfaceRef sc)
{
	SCSubgraphRef Plot1 = sc.Subgraph[0];
	
	SCSubgraphRef CCI1 = sc.Subgraph[11];
	
	SCInputRef period1 = sc.Input[0];
	
	if (sc.SetDefaults)
	{
		// Set the configuration and defaults
		
		sc.GraphName = "CCITest";
		sc.StudyDescription = "Testing Symbol based inputs";
						
		//During development set this flag to 1, so the DLL can be modified. When development is completed, set it to 0 to improve performance.
		sc.AutoLoop = true;
		sc.FreeDLL = 1;
				
		Plot1.Name = "Plot1";
		Plot1.DrawZeros = true;
		Plot1.LineWidth = 1;
		
		//period1.Name = "Period 1";
		//period1.SetInt(6);
		//period1.SetIntLimits(1, 10000);

		return;
	}
	
	const char* p_Symbol;
	p_Symbol = sc.Symbol.GetChars();
	
	if(wildcmp_S("CL*", p_Symbol))
	{
		period1.Name = "Period 1";
		period1.SetInt(20);
		period1.SetIntLimits(1, 10000);
	}
	else
	{
		period1.Name = "Period 1";
		period1.SetInt(6);
		period1.SetIntLimits(1, 10000);
	}

	
	// Do data processing
	sc.DataStartIndex = period1.GetInt();

	sc.CCI(sc.Close, CCI1, period1.GetInt(), 0.015f);
		
	Plot1[sc.Index] = CCI1[sc.Index];
	
}

Attached Files
Register to download File Type: cpp CCITest.cpp (2.1 KB, 7 views)
Reply With Quote
 
  #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)
Elite Member
glostrup, denmark
 
Futures Experience: Advanced
Platform: Custom platform
Broker/Data: CQG
Favorite Futures: Futures, Options, Stocks
 
ktrader's Avatar
 
Posts: 249 since Aug 2011
Thanks: 151 given, 274 received



vegasfoster View Post
Hi,

I have about 10 instruments that I follow and I would like to have certain default input parameters for several studies automatically change depending on the instrument I currently have selected. For example, change Pivot point times based upon the symbol's RTH. Because the contract names change periodically I am trying to use wildcards after the first two letters of the symbols so I don't have to update the code every month.

I found a wildcard function here Wildcard string compare (globbing) - CodeProject, but I am getting errors within the function that I don't how to resolve.

Any help would be appreciated. Thank you.

 
Code
***** Starting Build of Custom Studies Source File: CCITest.cpp *****	12:33:24
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(15): Warning! W665: col(40) temporary object used to initialize a non-constant reference
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(15): Note! N638: col(40) 'c_ArrayWrapper' defined in: sierrachart.h(1401) (col 7)
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(15): Note! N630: col(40) source conversion type is 'int'
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(15): Note! N631: col(40) target conversion type is 'c_ArrayWrapper<float> (lvalue)'
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(15): Error! E210: col(40) returning reference to function argument or to auto or register variable
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(15): Note! N638: col(40) 'c_ArrayWrapper' defined in: sierrachart.h(1401) (col 7)
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(27): Warning! W665: col(40) temporary object used to initialize a non-constant reference
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(27): Note! N638: col(40) 'c_ArrayWrapper' defined in: sierrachart.h(1401) (col 7)
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(27): Note! N630: col(40) source conversion type is 'int'
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(27): Note! N631: col(40) target conversion type is 'c_ArrayWrapper<float> (lvalue)'
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(27): Error! E210: col(40) returning reference to function argument or to auto or register variable
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(27): Note! N638: col(40) 'c_ArrayWrapper' defined in: sierrachart.h(1401) (col 7)
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(48): Warning! W665: col(24) temporary object used to initialize a non-constant reference
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(48): Note! N638: col(24) 'c_ArrayWrapper' defined in: sierrachart.h(1401) (col 7)
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(48): Note! N630: col(24) source conversion type is 'bool'
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(48): Note! N631: col(24) target conversion type is 'c_ArrayWrapper<float> (lvalue)'
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(48): Error! E210: col(24) returning reference to function argument or to auto or register variable
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(48): Note! N638: col(24) 'c_ArrayWrapper' defined in: sierrachart.h(1401) (col 7)
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(86): Error! E899: col(21) cannot convert expression to target type
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(86): Note! N630: col(21) source conversion type is 'c_ArrayWrapper<float> (lvalue)'
C:\SierraChart - Velocity\ACS_Source\CCITest.cpp(86): Note! N631: col(21) target conversion type is 'bool'
There were compilation errors.

***** Build Failed! *****	12:33:26

 
Code
#include "sierrachart.h"

SCDLLName("CCITest") 

/*==========================================================================*/
SCFloatArrayRef wildcmp_S(const char *wild, const char *string)
	{
	// Written by Jack Handy - <A href="mailto:jakkhandy@hotmail.com">jakkhandy@hotmail.com</A>
		const char *cp = NULL, *mp = NULL;

		while ((*string) && (*wild != '*')) 
		{
			if ((*wild != *string) && (*wild != '?')) 
			{
				return 0;
			}
			wild++;
			string++;
		}

		while (*string) 
		{
			if (*wild == '*') 
				{
					if (!*++wild) 
				{
				return 1;
				}
					mp = wild;
					cp = string+1;
				} 
				else if ((*wild == *string) || (*wild == '?')) 
				{
					wild++;
					string++;
				} 
				else 
				{
					wild = mp;
					string = cp++;
				}
		}

		while (*wild == '*') 
		{
			wild++;
		}
		return !*wild;
	}

/*==========================================================================*/

SCSFExport scsf_CCITest(SCStudyInterfaceRef sc)
{
	SCSubgraphRef Plot1 = sc.Subgraph[0];
	
	SCSubgraphRef CCI1 = sc.Subgraph[11];
	
	SCInputRef period1 = sc.Input[0];
	
	if (sc.SetDefaults)
	{
		// Set the configuration and defaults
		
		sc.GraphName = "CCITest";
		sc.StudyDescription = "Testing Symbol based inputs";
						
		//During development set this flag to 1, so the DLL can be modified. When development is completed, set it to 0 to improve performance.
		sc.AutoLoop = true;
		sc.FreeDLL = 1;
				
		Plot1.Name = "Plot1";
		Plot1.DrawZeros = true;
		Plot1.LineWidth = 1;
		
		//period1.Name = "Period 1";
		//period1.SetInt(6);
		//period1.SetIntLimits(1, 10000);

		return;
	}
	
	const char* p_Symbol;
	p_Symbol = sc.Symbol.GetChars();
	
	if(wildcmp_S("CL*", p_Symbol))
	{
		period1.Name = "Period 1";
		period1.SetInt(20);
		period1.SetIntLimits(1, 10000);
	}
	else
	{
		period1.Name = "Period 1";
		period1.SetInt(6);
		period1.SetIntLimits(1, 10000);
	}

	
	// Do data processing
	sc.DataStartIndex = period1.GetInt();

	sc.CCI(sc.Close, CCI1, period1.GetInt(), 0.015f);
		
	Plot1[sc.Index] = CCI1[sc.Index];
	
}


Hi,

You can change the return type of the wildcmp to int or bool:

 
Code
bool wildcmp_S(const char *wild, const char *string)
--ktrader

Reply With Quote
The following 2 users say Thank You to ktrader for this post:
 
  #4 (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

I actually understand that, YAY! Thanks a bunch.

Reply With Quote

Reply



futures io > > > > > Wildcard in ASCIL

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     


All times are GMT -4. The time now is 09:50 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-12 in 0.07 seconds with 19 queries on phoenix via your IP 54.221.93.187