Page 1 of 1

How to reopen indicator Template for Adding to the Indicator

PostPosted: Fri Mar 12, 2010 3:29 am
by LordTwig
Hi anyone,

Can someone please tell me how to reopen the SDK TEMPLATE to restructure existing indicator.

For example I have attempted to make an indicator using template, but later realised that I needed several more parameters & streams in indicator.

There does not seem to be any way I can reload indicator back into template.

So I either have to manually fill in all code details (without errors) or make a whole new indicator from scratch, which seems pretty silly. Especially if it was a large program & includes detailed user info.

I am new to this & trying to learn this programming language, so any help much appreciated.

Regards
LordTwig

Re: How to reopen indicator Template for Adding to the Indicator

PostPosted: Fri Mar 12, 2010 12:51 pm
by Nikolay.Gekht
Unfortunately no. The template can be used to create a new indicator only, not to change an existing indicator.

But you can easily add new parameters and/or streams using the appropriate methods. Look here for a list of the functions which are intended to create new parameters:
http://www.fxcodebase.com/documents/ind ... eters.html

You can use these functions in the Init() function, using the indicator.parameters table.
For example, if you want to add a new integer parameter, which has the default value 5 and can be changed between 1 and 10 put the following code into the Init function:

indicator.parameters:addInteger("MyP", "My Parameter", "", 5, 1, 10);

where
"MyP" is the name of the parameter how you will access it in the Prepare() and Update() functions.
"My Parameter" is the name of the parameter how you will be show to the user
5 is the default value of the parameter
1 is the minimal value of the parameter
and, finally, 10 - is the maximal value of the paramter.

To access the value which is entered by the user, you can use
instance.parameters.MyP

where MyP is the name which is specified in the first parameter of the add* function.

New streams can be added inside the Prepare() function using addStream method (http://www.fxcodebase.com/documents/ind ... tream.html)