As I told you just use TMA-slope add this to functions:theforexedge » Fri May 30, 2014 9:23 am wrote:Tommaso
Do you mean that there is an easier way of doing this?
I guess as my coding skills are quite limited and I used to use the CSS code from Steve's shell i've just cut and pasted the libCSS..
I was using the CSS weighing all the currency pairs, but I found that there are two conditions I wanted to make sure are happening:
1. There is s currency cross
2. Top or bottom reversal
and I found just weighing the symbols on the charts worked..
Anyway thinks for all your help..![]()
Jason
Code: Select all
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double GetSlope(string symbol,int tf,int shift)
{
double atr=iATR(symbol,tf,TMA_ATR_MA,shift+10)/10;
double gadblSlope=0.0;
if(atr!=0)
{
double dblTma = iMA( symbol, tf, 21, 0, MODE_LWMA, PRICE_CLOSE, shift);
double dblPrev = ( iMA( symbol, tf, 21, 0, MODE_LWMA, PRICE_CLOSE, shift + 1 ) * 231 + iClose( symbol, tf, shift ) * 20 ) / 251;
gadblSlope=(dblTma-dblPrev)/atr;
}
return ( gadblSlope );
}
//+------------------------------------------------------------------+
//| calcTma() |
//+------------------------------------------------------------------+
double calcTma(string symbol,int tf,int shift)
{
double dblSum = iClose(symbol, tf, shift) * 21;
double dblSumw = 21;
int jnx,knx;
for(jnx=1,knx=20; jnx<=20; jnx++,knx--)
{
dblSum += ( knx * iClose(symbol, tf, shift + jnx) );
dblSumw += knx;
if(jnx<=shift)
{
dblSum += ( knx * iClose(symbol, tf, shift - jnx) );
dblSumw += knx;
}
}
return( dblSum / dblSumw );
}
//+------------------------------------------------------------------+
Code: Select all
TMASlopeVal[0]= GetSlope(Symbol(),TMASlopeTF,0);
TMASlopeVal[1]= GetSlope(Symbol(),TMASlopeTF,m_bar+1);
TMASlopeVal[2]= GetSlope(Symbol(),TMASlopeTF,m_bar+2);Tommaso