By the way, tis is the function iam trying to translate (the function name is XAverage so it calls to itself):
{*******************************************************************
Description: Exponential Average
Provided By: Omega Research, Inc. (c) Copyright 1999
********************************************************************}
Inputs: Price(NumericSeries), Length(NumericSimple);
Variables: Factor(0);
If Length + 1 <> 0 Then Begin
If CurrentBar <= 1 Then Begin
Factor = 2 / (Length + 1);
XAverage = Price;
End
Else
XAverage = Factor * Price + (1 - Factor) * XAverage[1];
End;
{*******************************************************************
Description: Exponential Average
Provided By: Omega Research, Inc. (c) Copyright 1999
********************************************************************}
Inputs: Price(NumericSeries), Length(NumericSimple);
Variables: Factor(0);
If Length + 1 <> 0 Then Begin
If CurrentBar <= 1 Then Begin
Factor = 2 / (Length + 1);
XAverage = Price;
End
Else
XAverage = Factor * Price + (1 - Factor) * XAverage[1];
End;
For recursion you should do something like this sample:
/* ****************************************************************** */
/* Copyright and pricing */
/* */
/* This code was developed by coriFX 2005. */
/* */
/* You can use this code to make money as much as you wish without */
/* fee. If you have made your first million using my code, I would */
/* ask you to send me 10%. contact me at { corifx at o2go dot de }. */
/* I will send you the information for money transfer. */
/* */
/* ****************************************************************** */
extern int maxLoops = 100;
int start() {
Print( "recursiveFunction sample. Start recursion" );
recursiveFunction( 0 );
Print( "recursiveFunction sample. Ended" );
return( 0 );
}
// Implementation of XAverage. Doing it with recursion
// shift- is necessary for recursion
void recursiveFunction( int shift ) {
Print( "recursiveFunction called. shift: ", shift );
if ( shift < maxLoops ) {
recursiveFunction( shift + 1 );
}
}
Post the result, if you have it running.
have luck, cori
I have forgotten: this is a script
cori
cori
Thanks Cori,
I apreciate you help.
Regards
Alejandro Galindo
I apreciate you help.
Regards
Alejandro Galindo
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I started translating some TS indicators/signals/functions to MT4 and i need some advice, how can i manage the numeric series on MT4?
For example how could be the XAverage TS function translated to MT4?
Thanks for any help.
Regards
Alejandro Galindo