PDA

View Full Version : 7 tips for you want create Expert Advisors or Indicators



aurora
05-22-2014, 01:55 PM
7 tips for you want to create Expert Advisors or Indicators

bool
The word is taken from the algorithm boolean bool. Where in mathematics Algebra been mentioned about the boolean algebra. Its function of this bool is giving one of the two requirements that must be fulfilled that is right or wrong.

Color
Function is used to give color staining. Colors that functioned in accordance with the standard color . Color can be executed in background coloring, writing, through letter blocks.

datetime
The function of a datetime value is used to obtain the date, year and month. This contributes to the date when the script is created, and when the analysis used.

Double
Double alone functioned as the most effective step calculation. Seeing in terms of pricing used today definitely has a comma ( , ) behind the numbers , so the price into account, the double was his choice.

int
The function calculates the value of the int is an integer value with no coma, then int can be used . Since it is quite easy then int will be relied upon to manage the programming loop .

string
For writing a word, character, it can take advantage of the string. So that what you write can be stored in the string.

void
As for the void a data type that has the same output as before data has released.

aurora
05-23-2014, 12:06 PM
To open the MetaTrader there are two ways:

1.The first step is to open the MetaTrader software is already incorporated in the MetaTrader terminal is already downloaded.

2.via MetaTrader through the "Experts -> MetaQuotes Language Editor" on the main menu contained MetaTrader.

aurora
05-24-2014, 03:38 PM
MQL langgguge we know is have a lot function and very usefull if we can use it, mainly is very good for create the expert advisors and indicator. in next time I will share the MQL langguage script.

aurora
05-26-2014, 02:13 PM
simple format for MQL programming, example of Syntax:
- open Command Prompt
- cd C:\Program Files\MetaTrader4
- metalang -q "D:\Expert Advisor\my_first_mql4_script.mq4"

quadsi
05-28-2014, 02:04 PM
mql languge is like c++ however I dont know how to use it, is very difficult to typing mql language, so is better is use expert advisors in internet market.

aurora
05-28-2014, 04:18 PM
mql languge is like c++ however I dont know how to use it, is very difficult to typing mql language, so is better is use expert advisors in internet market.

for newbies I not suggest for create the expert advisor use mql langguage, may you can elarn more mql langguage in internet online course. yes you right mql is very smilliar to c++.

quadsi
05-29-2014, 04:54 AM
for newbies I not suggest for create the expert advisor use mql langguage, may you can elarn more mql langguage in internet online course. yes you right mql is very smilliar to c++.

but for me mql language is very difficult! I want learn more for know more about mql language, I hope you can help me for learn more mql language in here. so next time I can practice it.

aurora
05-29-2014, 05:51 AM
MQL4 programming language that is contained in the MetaTrader 4 platform. MQL4 is most commonly used to make an Expert Advisor (EA), Custom Indicators and Scripts. Expert Advisor, as we already know, is a program to automate your trading based logic and certain paramater.

quadsi
05-29-2014, 06:12 AM
MQL4 programming language that is contained in the MetaTrader 4 platform. MQL4 is most commonly used to make an Expert Advisor (EA), Custom Indicators and Scripts. Expert Advisor, as we already know, is a program to automate your trading based logic and certain paramater.

so I can learn mroe abaout mql language in here? i need to knowm more about mql language because I think this language is most usefeull for create indicator and expert advisors.

aurora
05-29-2014, 07:04 AM
so I can learn mroe abaout mql language in here? i need to knowm more about mql language because I think this language is most usefeull for create indicator and expert advisors.

Hello for you, I suggest to use EA only, for use a trading robot that has been updated and well tested how it works, and we should first know the character, strategy, and have the test results with low drawdown and could be one way to test the strategy backtest.

aurora
05-30-2014, 01:13 PM
Profitable forex robot which means it has a good quality, and good quality is only produced by a good programmer anyway. have a background checks of team/individual robot makers. to find out, can in googling about the individual / team maker of the robot.

aurora
05-31-2014, 12:38 PM
the expert advisor programmer in EA process moment is so important, if the EA programmer know the hard math calculation like algorhtym, cos sinus and logic/linear with professional. maybe can created one powerfull expert advisors.

quadsi
05-31-2014, 02:03 PM
the expert advisor programmer in EA process moment is so important, if the EA programmer know the hard math calculation like algorhtym, cos sinus and logic/linear with professional. maybe can created one powerfull expert advisors.

ok you know for niw is very hard to funbd the best ea programmer, more programme but not enouh experience and skill in internet marke. so is very dangerous to use their own skill for built ea.

aurora
05-31-2014, 03:16 PM
to created the EA does not bsia vain, we should really know how the calculation algorithm, cosisnus and language MQL pemrogrman good. apsti otherwise be trouble later.

aurora
06-01-2014, 08:14 AM
script for universal averaging system in EA MQL programming.

:
"double MASeries
(
int number, int MA_Method, int MaxBar, int limit, int period, double series, int bar, int& reset
)"

quadsi
06-01-2014, 09:28 AM
script for universal averaging system in EA MQL programming.

:
"double MASeries
(
int number, int MA_Method, int MaxBar, int limit, int period, double series, int bar, int& reset
)"

oh God you article is very amazing about programming only? not havce other talk than programmer only? I want talk about money managements a nd so on.

aurora
06-02-2014, 11:19 AM
MQL script for buy limit.

// Default Inputs: Start
extern double Buy_Lots = 0.01; // one micro-lot
extern double Buy_Limit_Price = 0.0;
extern int Slippage = 3;
extern int StopLoss = 0;
extern int TakeProfit = 0;
// Default Inputs: End

aurora
06-03-2014, 01:57 PM
Indicator is a tool for mapping the market conditions and further market direction so that traders can use the decision to conduct transactions or wait. expert advisor is a tools/system for help you trading activities without any humman work.

aurora
06-04-2014, 07:43 AM
wqithin the framework of execution of the special function start(), the control is passed to the line that calls the order opening function:

OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Bid-15*Point,Bid+15*Point);

aurora
06-05-2014, 03:14 PM
each indicator has 3 functions, not 1:

init() - this function is called by the terminal only once, when we start the indicator. Its purpose is to prepare the indicator for operation, set up data buffers, check parameters (what a user has written) and other preparatory actions. This function is not obligatory. If you do not perform a code in it, you may delete it.

deinit() - this function is also called only once, when you delete an indicator from a chart. You should prepare the indicator for the termination of its operation. For example, close opened files, delete graphical objects from the file (do not worry, you will learn how to do it). This function is also not obligatory.

start() - as distinct from scripts, in indicators this function is called at each tick. I.e. when new quotes appear from the currency pair, to the chart of which you have attached the indicator, this function is called. Besides, this function is called at the indicator start, i.e. after the function init().

aurora
06-06-2014, 11:32 AM
Script for create EMA.

void start()

{
// Get the current EMAs
double d10EMA = iMA(NULL,0,10,0,MODE_EMA,PRICE_CLOSE,0);

double d5EMA = iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,0);

double diff = d10EMA-d5EMA;

aurora
06-07-2014, 12:44 PM
REQUIRED VARIABLES

1ST PENDING ORDER -
LOTS=0.01
SLIPPAGE=3
SL=0//ZERO MEANS NO SL
TP=0//ZERO MEANS NO TP
2ND PENDING ORDER -
PIPS FROM ENTRY 1ST PENDING ORDER=10
LOTS=0.01
SLIPPAGE=3
SL=0//ZERO MEANS NO SL
TP=0//ZERO MEANS NO TP
3RD PENDING ORDER -
PIPS FROM ENTRY 2ND PENDING ORDER=10
LOTS=0.01
SLIPPAGE=3
SL=0//ZERO MEANS NO SL
TP=0//ZERO MEANS NO TP

aurora
06-08-2014, 05:38 AM
Money Management script 1

//+------------------------------------------------------------------+
//|
//+------------------------------------------------------------------+
#property copyright auroraalpha
#property link auroraalpha
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
#property show_inputs
extern double Entry;
extern double SL;
extern string Types = "0 is buy,1 is sell,2 pend_buy,3 pend_sell";
extern int PendingType = -1;
extern string Note = "ON is 1 and OFF is 0";
extern int TP_ON_OR_OFF = 1;
extern double Account=10000;
extern double DollarVol=1;
extern double MinVol = 0.1;
extern double MaxVol = 100;
extern double Percentage = 2;

int start()
{

aurora
06-09-2014, 01:28 PM
Test Composite Indicator part-1

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots 1
#property indicator_minimum -1
#property indicator_maximum 1

#property indicator_type1 DRAW_HISTOGRAM
#property indicator_color1 DarkTurquoise

// The only buffer of the indicator
double ExtBuffer[];

// Timeframes of auxiliary indicators
ENUM_TIMEFRAMES TF[5] = {PERIOD_H4, PERIOD_H1, PERIOD_M15, PERIOD_M5, PERIOD_M1};

// Handles of auxiliary indicators for all timeframes
int h_Ichimoku[5], h_Channel[5];

aurora
06-10-2014, 10:15 AM
Test Composite Indicator part-2

//+------------------------------------------------------------------+
void OnInit()
{
SetIndexBuffer(0, ExtBuffer);
ArraySetAsSeries(ExtBuffer, true);

// Create auxiliary indicators
for (int itf=0; itf<5; itf++)
{
h_Ichimoku[itf] = iCustom(Symbol(), TF[itf],
"TestSlaveIndicators\\Ichimoku",
9, 26, 52
);
h_Channel [itf] = iCustom(Symbol(), TF[itf],
"TestSlaveIndicators\\Price_Channel",
22
);
}
}

vimala88
06-10-2014, 12:45 PM
Test Composite Indicator part-2

//+------------------------------------------------------------------+
void OnInit()
{
SetIndexBuffer(0, ExtBuffer);
ArraySetAsSeries(ExtBuffer, true);

// Create auxiliary indicators
for (int itf=0; itf<5; itf++)
{
h_Ichimoku[itf] = iCustom(Symbol(), TF[itf],
"TestSlaveIndicators\\Ichimoku",
9, 26, 52
);
h_Channel [itf] = iCustom(Symbol(), TF[itf],
"TestSlaveIndicators\\Price_Channel",
22
);
}
}

sometiems indicator can give more return if we consistent for use itu adn always tradin with one of type indicator. but for newbies is very difficult to find the best indicator.

aurora
06-10-2014, 01:30 PM
we should really study the performance of one indicator if you achieve maximum results in the use of indicators that, if we consistently surely the result will be a maximum.

vimala88
06-10-2014, 01:55 PM
we should really study the performance of one indicator if you achieve maximum results in the use of indicators that, if we consistently surely the result will be a maximum.

if used for scalping good is used in the time frame boss?? whether on m1 or m5. and whether the system is good for what is used in all pairs.

aurora
06-10-2014, 03:12 PM
excellent time used for trading with scalping method is 5m and 15m. at a time like this, in general market movements very fluktuaktif all.

vimala88
06-10-2014, 03:26 PM
excellent time used for trading with scalping method is 5m and 15m. at a time like this, in general market movements very fluktuaktif all.

use if trading scalping method would be very beneficial in this hour! but it is very difficult to know when a good time to begin to entery market.

aurora
06-10-2014, 03:45 PM
Time at 06.00 pm (medium impact) and 16:30 & 19:45 pm for High Impact, so this time is very good for entry market, you can predict the price movements before then start for open position.

vimala88
06-10-2014, 04:22 PM
Time at 06.00 pm (medium impact) and 16:30 & 19:45 pm for High Impact, so this time is very good for entry market, you can predict the price movements before then start for open position.

I already open position in 20:00 pm and now still wait to earn profit hopefully can earn profit with big number.

aurora
06-10-2014, 05:03 PM
In the absence of known technical analysis support and resistance levels, which can be a critical level that the price back towards the starting point. however in reality this level is always changing, sometimes higher or lower. This makes a lot of traders fooled.

aurora
06-11-2014, 10:59 AM
Skype for help you trading.

int SkypeSendInstantMessageW(string skype_name,string message,int status);
int SkypeSendInstantMessageA(string skype_name,string message,int status);// for MetaTrader 4

string InpSkypeName = "echo123"; // Skype name
string InpTextMessage = "Hello :)"; // Text message

string msg;
ENUM_SKYPE_ERROR err=(ENUM_SKYPE_ERROR)SkypeSendInstantMessageW(InpSkypeName,InpTextMessage,STATUS_ONLINE|STATUS_AWAY);

if(err==ERROR_NO_ERRORS) msg=StringFormat("Sent IM to %s, %s",InpSkypeName,InpTextMessage);
else msg=StringFormat("Error sending IM to %s, error: %s",InpSkypeName,EnumToString(err));

Print(msg);

aurora
06-12-2014, 05:48 AM
#property show_inputs

//--- skype status (TOnlineStatus)
#define STATUS_OFFLINE 1
#define STATUS_ONLINE 2
#define STATUS_AWAY 4
#define STATUS_DONT_DISTURB 16

//--- skype errors
#define ERROR_UNKNOWN -1
#define ERROR_NO_ERRORS 0
#define ERROR_ATTACH 1
#define ERROR_AUTHORIZED 2
#define ERROR_STATUS 3
#define ERROR_TIMEOUTS 4
#define ERROR_RUNNING 5
#define ERROR_SENDING 6
#define ERROR_VALUE 7
#define ERROR_ACCESS 8
#define ERROR_SKYPE4COM 9

//--- import functions
#import "SkypeMQL.dll"
int SkypeSendInstantMessageA(string skype_name,string message,int status);
int SkypeSendSmsMessageA(string phone_number,string message);
#import

aurora
06-12-2014, 04:23 PM
//--- input parameters
input string InpSkypeName = "echo123"; // Skype name
input string InpTextMessage = "Hello :)"; // Text message
input string InpPhoneNumber = "+380123456789"; // Phone number
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
string msg;
ENUM_SKYPE_ERROR err;

//--- send IM
err=(ENUM_SKYPE_ERROR)SkypeSendInstantMessageW(InpSkypeName,InpTextMessage,STATUS_ONLINE|STATUS_AWAY);
if(err==ERROR_NO_ERRORS) msg=StringFormat("Sent IM to %s, %s",InpSkypeName,InpTextMessage);
else msg=StringFormat("Error sending IM to %s, error: %s",InpSkypeName,EnumToString(err));
Print(msg);


//--- send SMS
err=(ENUM_SKYPE_ERROR) SkypeSendSmsMessageW(InpPhoneNumber,InpTextMessage);
if(err==ERROR_NO_ERRORS) msg=StringFormat("Sent SMS to %s, %s",InpPhoneNumber,InpTextMessage);
else msg=StringFormat("Error sending SMS to %s, error: %s",InpPhoneNumber,EnumToString(err));
Print(msg);

}
//+------------------------------------------------------------------+

aurora
06-13-2014, 12:06 PM
chaikin oscilator 1

//+X================================================================X+
//| Classes for smoothing prices series |
//+X================================================================X+

//+X================================================================X+
//| Functional utilities for the classes of smoothing algorithms |
//+X================================================================X+
class CMovSeriesTools
{
public:
void MALengthCheck(string LengthName,int ExternLength);
void MALengthCheck(string LengthName,double ExternLength);

protected:
bool BarCheck1(int begin,int bar,bool Set);
bool BarCheck2(int begin,int bar,bool Set,int Length);
bool BarCheck3(int begin,int bar,bool Set,int Length);

bool BarCheck4(int rates_total,int bar,bool Set);
bool BarCheck5(int rates_total,int bar,bool Set);
bool BarCheck6(int rates_total,int bar,bool Set);

void LengthCheck(int &ExternLength);
void LengthCheck(double &ExternLength);

void Recount_ArrayZeroPos(
int &count,
int Length,
uint prev_calculated,
uint rates_total,
double series,
int bar,
double &Array[],
bool set
);

int Recount_ArrayNumber(int count,int Length,int Number);

bool SeriesArrayResize(string FunctionsName,
int Length,
double &Array[],
int &Size_
);

bool ArrayResizeErrorPrint(string FunctionsName,int &Size_);

aurora
06-13-2014, 04:38 PM
};
//+X================================================================X+
//| Functions for the classic averaging of price series |
//+X================================================================X+
class CMoving_Average : public CMovSeriesTools
{
public:
double MASeries(uint begin,// the reliable starting point number for bars
uint prev_calculated,// Amount of bars in history at previous call
uint rates_total,// amount of history in bars at the current tick
int Length,// Averaging period
ENUM_MA_METHOD MA_Method,// Method of averaging (MODE_SMA, MODE_EMA, MODE_SMMA, MODE_LWMA)
double series,// Price series value calculated for the bar with number bar
uint bar,// Bar index
bool set // direction of indexing arrays
);

double SMASeries(uint begin,// the reliable starting point number for bars
uint prev_calculated,// Amount of bars in history at previous call
uint rates_total,// amount of history in bars at the current tick
int Length,// Averaging period
double series,// Price series value calculated for the bar with number bar
uint bar,// Bar index
bool set // direction of indexing arrays

aurora
06-14-2014, 03:49 PM
double LWMASeries(uint begin,// the reliable starting point number for bars
uint prev_calculated,// Amount of bars in history at previous call
uint rates_total,// amount of history in bars at the current tick
int Length,// Averaging period
double series,// Price series value calculated for the bar with number bar
uint bar,// Bar index
bool set // direction of indexing arrays
);

protected:
double m_SeriesArray[];
int m_Size_,m_count,m_weight;
double m_Moving,m_MOVING,m_Pr;
double m_sum,m_SUM,m_lsum,m_LSUM;
};
//+X================================================================X+
//| The algorithm for computing standard deviation |
//+X================================================================X+
class CStdDeviation : public CMovSeriesTools
{
public:
double StdDevSeries(uint begin,// the reliable starting point number for bars
uint prev_calculated,// Amount of bars in history at previous call
uint rates_total,// amount of history in bars at the current tick
int Length,// Averaging period
double deviation,// Deviation
double series,// Price series value calculated for the bar with number bar
double MovSeries,// Moving Average value based on which the StdDeviation is calculated
uint bar,// Bar index
bool set // direction of indexing arrays
);
protected:
int m_Size_,m_count;
double m_Sum,m_SUM,m_Sum2,m_SUM2;
double m_SeriesArray[];
};

aurora
06-15-2014, 02:14 PM
//+X================================================================X+
//| JMA averaging algorithm for arbitrary price series |
//+X================================================================X+
class CJJMA : public CMovSeriesTools
{
public:
double JJMASeries(uint begin,// the reliable starting point number for bars
uint prev_calculated,// Amount of bars in history at previous call
uint rates_total,// amount of history in bars at the current tick
int Din,// permission to change the Length and the Phase parameter at every bar.
// 0 locks out changes to parameters, any other value allows changes to parameters.
double Phase,// parameter varying within the range -100 ... +100 and influencing on the quality of the intermediate averaging process
double Length,// smoothing depth
double series,// Price series value calculated for the bar with number bar
uint bar,// Bar index
bool set // direction of indexing arrays
);

void JJMALengthCheck(string LengthName,int ExternLength);
void JJMAPhaseCheck(string PhaseName,int ExternPhase);

protected:
void JJMAInit(uint begin,int Din,double Phase,double Length,double series,uint bar);

//----+ Declaration of global variables
bool m_start;
//----
double m_array[62];
//----
double m_degree,m_Phase,m_sense;
double m_Krx,m_Kfd,m_Krj,m_Kct;
double m_var1,m_var2;
//----
int m_pos2,m_pos1;
int m_Loop1,m_Loop2;
int m_midd1,m_midd2;
int m_count1,m_count2,m_count3;
//----
double m_ser1,m_ser2;
double m_Sum1,m_Sum2,m_JMA;
double m_storage1,m_storage2,m_djma;
double m_hoop1[128],m_hoop2[11],m_data[128];

//----+ Variables for restoring calculations of an unclosed bar
int m_pos2_,m_pos1_;
int m_Loop1_,m_Loop2_;
int m_midd1_,m_midd2_;
int m_count1_,m_count2_,m_count3_;
//----
double m_ser1_,m_ser2_;
double m_Sum1_,m_Sum2_,m_JMA_;
double m_storage1_,m_storage2_,m_djma_;
double m_hoop1_[128],m_hoop2_[11],m_data_[128];
//----
bool m_bhoop1[128],m_bhoop2[11],m_bdata[128];
};

aurora
06-15-2014, 04:51 PM
chaikin 2sma

#property copyright "Copyright aurora: 282715499"
#property link
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 clrSilver
//---- indicator parameters
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;
//---- indicator buffers
double ind_buffer1[];
double ind_buffer2[];
double ind_buffer3[];
double ind_buffer4[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 2 additional buffers are used for counting.
IndicatorBuffers(4);
//---- drawing settings
SetIndexStyle(0,DRAW_LINE);
SetIndexDrawBegin(0,SignalSMA);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+2);
//---- 3 indicator buffers mapping
SetIndexBuffer(0,ind_buffer1);
SetIndexBuffer(1,ind_buffer2);
SetIndexBuffer(2,ind_buffer3);
SetIndexBuffer(3,ind_buffer4);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("Chaikin");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Moving Average of Oscillator |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
if(counted_bars==0) limit--;
//---- macd counted in the 1-st additional buffer
for(int i=0; i<limit; i++)
ind_buffer2[i]=iOBV(NULL,0,PRICE_CLOSE,i);
//---- signal line counted in the 2-nd additional buffer
for(i=0; i<limit; i++)
{
ind_buffer3[i]=iMAOnArray(ind_buffer2,Bars,10,0,MODE_SMA,i);
ind_buffer4[i]=iMAOnArray(ind_buffer2,Bars,3,0,MODE_SMA,i);
}
//---- main loop
for(i=0; i<limit; i++)
ind_buffer1[i]=ind_buffer2[i]-ind_buffer3[i];
//---- done
return(0);
}
//+------------------------------------------------------------------+

aurora
06-16-2014, 10:23 AM
part-3

//+X================================================================X+
//| The Tilson's algorithm of smoothing any price series |
//+X================================================================X+
class CT3 : public CMovSeriesTools
{
public:
double T3Series(uint begin,// the reliable starting point number for bars
uint prev_calculated,// Amount of bars in history at previous call
uint rates_total,// amount of history in bars at the current tick
int Din,// permission to change the Length parameter at every bar.
// 0 locks out changes to parameters, any other value allows changes to parameters.
double Curvature,// Coefficient (for convenience, its value is centuplicated!)
double Length,// smoothing depth
double series,// Price series value calculated for the bar with number bar
uint bar,// Bar index
bool set // direction of indexing arrays
);
protected:
void T3Init(uint begin,
int Din,
double Curvature,
double Length,
double series,
uint bar
);

//----+ Declaration of global variables
double m_b2,m_b3;
//----
double m_e1,m_e2,m_e3,m_e4,m_e5,m_e6;
double m_E1,m_E2,m_E3,m_E4,m_E5,m_E6;
double m_c1,m_c2,m_c3,m_c4,m_w1,m_w2;
};

aurora
06-16-2014, 01:56 PM
//+X================================================================X+
//| The algorithm of the ultralinear price series smoothing |
//+X================================================================X+
class CJurX : public CMovSeriesTools
{
public:
double JurXSeries(uint begin,// the reliable starting point number for bars
uint prev_calculated,// Amount of bars in history at previous call
uint rates_total,// amount of history in bars at the current tick
int Din,// permission to change the Length parameter at every bar.
// 0 locks out changes to parameters, any other value allows changes to parameters.
double Length,// smoothing depth
double series,// Price series value calculated for the bar with number bar
uint bar,// Bar index
bool set // direction of indexing arrays
);
protected:
void JurXInit(uint begin,
int Din,
double Length,
double series,
uint bar
);

//----+ Declaration of global variables
double m_AB,m_AC;
double m_f1,m_f2,m_f3,m_f4,m_f5;
double m_f6,m_Kg,m_Hg,m_F1,m_F2;
double m_F3,m_F4,m_F5,m_F6,m_w;
};

aurora
06-16-2014, 03:57 PM
//+X================================================================X+
//| Tushar Chande's averaging algorithms for any prices series |
//+X================================================================X+
class CCMO : public CMovSeriesTools
{
public:
double VIDYASeries(uint begin,// the reliable starting point number for bars
uint prev_calculated,// Amount of bars in history at previous call
uint rates_total,// amount of history in bars at the current tick
int CMO_Length,// CMO period
double EMA_Length,
double series,// Price series value calculated for the bar with number bar
uint bar,// Bar index
bool set // direction of indexing arrays
);

double CMOSeries(uint begin,// the reliable starting point number for bars
uint prev_calculated,// Amount of bars in history at previous call
uint rates_total,// amount of history in bars at the current tick
int CMO_Length,// CMO period
double series,
uint bar,// Bar index
bool set // direction of indexing arrays
);

protected:
double m_dSeriesArray[];
int m_Size_,m_count;
double m_UpSum_,m_UpSum,m_DnSum_,m_DnSum,m_Vidya,m_Vidya_;
double m_AbsCMO_,m_AbsCMO,m_series1,m_series1_,m_SmoothFactor;
};

aurora
06-18-2014, 09:27 AM
//+X================================================================X+
//| Algorithm of getting AMA indicator from optional price series |
//+X================================================================X+
class CAMA : public CMovSeriesTools
{
public:
double AMASeries(uint begin,// the reliable starting point number for bars
uint prev_calculated,// Amount of bars in history at previous call
uint rates_total,// amount of history in bars at the current tick
int Length,// AMA period
int Fast_Length, // period of fast Moving Average
int Slow_Length, // slow moving average period
double Rate,// the power to which the smoothing constant is raised
double series,// Price series value calculated for the bar with number bar
uint bar,// Bar index
bool set // direction of indexing arrays
);
protected:
//----+
double m_SeriesArray[];
double m_dSeriesArray[];
double m_NOISE,m_noise;
double m_Ama,m_AMA_,m_slowSC,m_fastSC,m_dSC;
int m_Size_1,m_Size_2,m_count;
};
//+X================================================================X+
//| The algorithm for parabolic averaging of arbitrary price series |
//+X================================================================X+
class CParMA : public CMovSeriesTools
{
public:
double ParMASeries(uint begin,// the reliable starting point number for bars
uint prev_calculated,// Amount of bars in history at previous call
uint rates_total,// amount of history in bars at the current tick
int Length,// Averaging period
double series,// Price series value calculated for the bar with number bar
uint bar,// Bar index
bool set // direction of indexing arrays
);
protected:
void ParMAInit(double Length);

double m_SeriesArray[];
int m_Size_,m_count;
int m_sum_x,m_sum_x2,m_sum_x3,m_sum_x4;
};

aurora
06-18-2014, 11:38 AM
//+X================================================================X+
//| Momentum algorithm (Murphy's vers!) on unspecified price series |
//+X================================================================X+
class CMomentum : public CMovSeriesTools
{
public:
double MomentumSeries(uint begin,// the reliable starting point number for bars
uint prev_calculated,// Amount of bars in history at previous call
uint rates_total,// amount of history in bars at the current tick
int Length,// Averaging period
double series,// Price series value calculated for the bar with number bar
uint bar,// Bar index
bool set // direction of indexing arrays
);
protected:

double m_SeriesArray[];
int m_Size_,m_count;
};
//+X================================================================X+
//| The algorithm of normalized momentum calculated on price series |
//+X================================================================X+
class CnMomentum : public CMovSeriesTools
{
public:
double nMomentumSeries(uint begin,// the reliable starting point number for bars
uint prev_calculated,// Amount of bars in history at previous call
uint rates_total,// amount of history in bars at the current tick
int Length,// Averaging period
double series,// Price series value calculated for the bar with number bar
uint bar,// Bar index
bool set // direction of indexing arrays
);
protected:

double m_SeriesArray[];
int m_Size_,m_count;
};
//+X================================================================X+
//| The Speed of changing algorithm based on arbitrary price series |
//+X================================================================X+
class CROC : public CMovSeriesTools
{
public:
double ROCSeries(uint begin,// the reliable starting point number for bars
uint prev_calculated,// Amount of bars in history at previous call
uint rates_total,// amount of history in bars at the current tick
int Length,// Averaging period
double series,// Price series value calculated for the bar with number bar
uint bar,// Bar index
bool set // direction of indexing arrays
);
protected:

double m_SeriesArray[];
int m_Size_,m_count;
};

aurora
06-20-2014, 11:13 AM
//+X================================================================X+
//| Functions for price series smoothing using FATL digital filter |
//+X================================================================X+
class CFATL : public CMovSeriesTools
{
public:
double FATLSeries(uint begin,// the reliable starting point number for bars
uint prev_calculated,// Amount of bars in history at previous call
uint rates_total,// amount of history in bars at the current tick
double series,// Price series value calculated for the bar with number bar
uint bar,// Bar index
bool set // direction of indexing arrays
);
CFATL();
protected:
double m_SeriesArray[39];
int m_Size_,m_count;
double m_FATL;

//---- declaration and initialization of an array for the coefficient of the digital filter
double m_FATLTable[39];
};
//+X================================================================X+
//| Functions for averaging price series using SATL digital filter |
//+X================================================================X+
class CSATL : public CMovSeriesTools
{
public:
double SATLSeries(uint begin,// the reliable starting point number for bars
uint prev_calculated,// Amount of bars in history at previous call
uint rates_total,// amount of history in bars at the current tick
double series,// Price series value calculated for the bar with number bar
uint bar,// Bar index
bool set // direction of indexing arrays
);
CSATL();
protected:
double m_SeriesArray[65];
int m_Size_,m_count;
double m_SATL;

//---- declaration and initialization of an array for the coefficient of the digital filter
double m_SATLTable[65];
};
//+X================================================================X+
//| Functions for averaging price series using RFTL digital filter |
//+X================================================================X+
class CRFTL : public CMovSeriesTools
{
public:
double RFTLSeries(uint begin,// the reliable starting point number for bars
uint prev_calculated,// Amount of bars in history at previous call
uint rates_total,// amount of history in bars at the current tick
double series,// Price series value calculated for the bar with number bar
uint bar,// Bar index
bool set // direction of indexing arrays
);
CRFTL();
protected:
double m_SeriesArray[44];
int m_Size_,m_count;
double m_RFTL;

//---- declaration and initialization of an array for the coefficient of the digital filter
double m_RFTLTable[44];
};

aurora
06-20-2014, 01:38 PM
//+X================================================================X+
//| Functions for averaging price series using RSTL digital filter |
//+X================================================================X+
class CRSTL : public CMovSeriesTools
{
public:
double RSTLSeries(uint begin,// the reliable starting point number for bars
uint prev_calculated,// Amount of bars in history at previous call
uint rates_total,// amount of history in bars at the current tick
double series,// Price series value calculated for the bar with number bar
uint bar,// Bar index
bool set // direction of indexing arrays
);
CRSTL();
protected:
double m_SeriesArray[99];
int m_Size_,m_count;
double m_RSTL;

//---- declaration and initialization of an array for the coefficient of the digital filter
double m_RSTLTable[99];
};
//+X================================================================X+
//| Universal averaging algorithm |
//+X================================================================X+
class CXMA
{
public:

enum Smooth_Method
{
MODE_SMA_, // SMA
MODE_EMA_, // EMA
MODE_SMMA_, // SMMA
MODE_LWMA_, // LWMA
MODE_JJMA, // JJMA
MODE_JurX, // JurX
MODE_ParMA, // ParMA
MODE_T3, //T3
MODE_VIDYA, //VIDYA
MODE_AMA //AMA
};