translate mql in lua...?
Posted:
Thu Aug 19, 2010 4:37 pm
by boursicoton
- Code: Select all
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 White
double g_ibuf_76[];
int init() {
IndicatorShortName("MoneyLine v1.2");
SetIndexBuffer(0, g_ibuf_76);
SetIndexLabel(0, "Yellow Bar v1.2");
SetIndexDrawBegin(0, 1);
SetIndexStyle(0, DRAW_LINE, STYLE_DOT, 1, White);
return (0);
}
int deinit() {
return (0);
}
int start() {
int li_4 = IndicatorCounted();
if (li_4 < 0) return (-1);
if (li_4 > 0) li_4--;
int li_0 = Bars - li_4;
for (int li_8 = 0; li_8 < li_0; li_8++) g_ibuf_76[li_8] = iMA(NULL, 0, 89, 0, MODE_LWMA, PRICE_CLOSE, li_8);
return (0);
}
similar to mme 40 ? i'm not sure....but interesting with next post...
Re: translate mql in lua...?
Posted:
Fri Aug 20, 2010 2:38 am
by Apprentice
Added to development cue.
Re: translate mql in lua...?
Posted:
Thu Aug 26, 2010 1:58 am
by Alexander.Gettinger
First indicator is a linear weighted moving average with period 89 for close prices.
Re: translate mql in lua...?
Posted:
Thu Aug 26, 2010 3:54 pm
by boursicoton
thanks alexander, i see that this indicator move with moving average..after some test of parametre...i stop my test...non coresponding exactly !
linear weighted. 89.. thnaks !
translate mql in lua...2ND TRUTH STOCHASTIC
Posted:
Fri Aug 27, 2010 1:15 pm
by piptopia
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 White
#property indicator_color2 Red
#property indicator_level1 0
//---- input parameters
extern int Period_Q=2;
extern int Period_R=8;
extern int Period_S=5;
extern int Signal=5;
//---- buffers
double SMI_Buffer[];
double Signal_Buffer[];
double SM_Buffer[];
double EMA_SM[];
double EMA2_SM[];
double EMA_HQ[];
double EMA2_HQ[];
double HQ_Buffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(8);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,SMI_Buffer);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,Signal_Buffer);
SetIndexLabel(0,"SMI");
SetIndexLabel(1,"SMI Signal");
SetIndexBuffer(2,SM_Buffer);
SetIndexBuffer(3,EMA_SM);
SetIndexBuffer(4,EMA2_SM);
SetIndexBuffer(5,EMA_HQ);
SetIndexBuffer(6,EMA2_HQ);
SetIndexBuffer(7,HQ_Buffer);
IndicatorShortName("SMI("+Period_Q+","+Period_R+","+Period_S+","+Signal+")");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int limit;
int i;
// double Median_Q[];
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-Period_Q-counted_bars;
if(counted_bars>0) counted_bars--;
for (i=limit;i>=0;i--)
{
HQ_Buffer[i]=High[Highest(NULL,0,MODE_HIGH,Period_Q,i)]-Low[Lowest(NULL,0,MODE_LOW,Period_Q,i)];
SM_Buffer[i]=Close[i]-(High[Highest(NULL,0,MODE_HIGH,Period_Q,i)]+Low[Lowest(NULL,0,MODE_LOW,Period_Q,i)])/2;//Median_Q[i];
}
for (i=limit-Period_R;i>=0;i--)
{
EMA_SM[i]=iMAOnArray(SM_Buffer,0,Period_R,0,MODE_EMA,i);
EMA_HQ[i]=iMAOnArray(HQ_Buffer,0,Period_R,0,MODE_EMA,i);
}
for (i=limit-Period_R-Period_S;i>=0;i--)
{
EMA2_SM[i]=iMAOnArray(EMA_SM,0,Period_S,0,MODE_EMA,i);
EMA2_HQ[i]=iMAOnArray(EMA_HQ,0,Period_S,0,MODE_EMA,i);
}
for (i=limit-Period_R-Period_S-Signal;i>=0;i--)
{
SMI_Buffer[i]=100*EMA2_SM[i]/0.5/EMA2_HQ[i];
}
for (i=limit-Period_R-Period_S;i>=0;i--)
{
Signal_Buffer[i]=iMAOnArray(SMI_Buffer,0,Signal,0,MODE_EMA,i);
}
//----
return(0);
}
//+------------------------------------------------------------------+
Re: translate mql in lua...?
Posted:
Sun Sep 05, 2010 10:55 pm
by Alexander.Gettinger
SMI indicator you may find here:
viewtopic.php?f=17&t=2071
Re: translate mql in lua...?
Posted:
Wed Sep 08, 2010 9:40 pm
by Alexander.Gettinger
USD Strength Effect indicator you may find here:
viewtopic.php?f=17&t=2099