Convert MQ4 to LUA

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

Convert MQ4 to LUA

Postby fxwayne » Thu Nov 11, 2010 4:46 pm

I'd like to ask fxcodebase team if it is possible to have forex trend indicator mq4 converted to .lua
fxwayne
 
Posts: 3
Joined: Thu Nov 11, 2010 4:38 pm

Re: Convert MQ4 to LUA

Postby Apprentice » Thu Nov 11, 2010 5:01 pm

Can you tell us more about this indicator.
Attach code or add link to the webpage with described.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36476
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Convert MQ4 to LUA

Postby fxwayne » Thu Nov 11, 2010 5:03 pm

//+------------------------------------------------------------------+
//| SilverTrend .mq4 |
//| SilverTrend rewritten by CrazyChart |
//| http://viac.ru/ |
//| modified by Kalenzo bartlomiej.gorski@gmail.com |
//+------------------------------------------------------------------+
#property copyright "SilverTrend rewritten by CrazyChart"
#property link "http://viac.ru/ "

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Red //Red //Aqua
#property indicator_color2 Blue
#property indicator_width1 4
#property indicator_width2 4

extern int SSP=7;
extern double Kmax=50.6; //24 21.6 21.6
extern int CountBars=300;

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtHBuffer1[];
double ExtHBuffer2[];




//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(4);
SetIndexStyle(0,DRAW_HISTOGRAM,0,4); //Red
SetIndexBuffer(0,ExtHBuffer1);
SetIndexStyle(1,DRAW_HISTOGRAM,0,4); //Aqua
SetIndexBuffer(1,ExtHBuffer2);

SetIndexBuffer(2,ExtMapBuffer1);
SetIndexBuffer(3,ExtMapBuffer2);

IndicatorShortName("FxTrend v2("+SSP+")");

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{

return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{

if (CountBars>=Bars) CountBars=Bars;

SetIndexDrawBegin(0,Bars-CountBars+SSP);
SetIndexDrawBegin(1,Bars-CountBars+SSP);

int i, counted_bars=IndicatorCounted();
double SsMax, SsMin, smin, smax;

if(Bars<=SSP+1) return(0);

if(counted_bars<SSP+1)
{
for(i=1;i<=SSP;i++) ExtMapBuffer1[CountBars-i]=0.0;
for(i=1;i<=SSP;i++) ExtMapBuffer2[CountBars-i]=0.0;
}

for(i=CountBars-SSP;i>=0;i--) {


SsMax = High[Highest(NULL,0,MODE_HIGH,SSP,i-SSP+1)];
SsMin = Low[Lowest(NULL,0,MODE_LOW,SSP,i-SSP+1)];

smax = SsMax-(SsMax-SsMin)*Kmax/100;

ExtMapBuffer1[i-SSP+6]=smax;
ExtMapBuffer2[i-SSP-1]=smax;

}
for(int b=CountBars-SSP;b>=0;b--)
{
if(ExtMapBuffer1[b]>ExtMapBuffer2[b])
{
ExtHBuffer1[b]=1;
ExtHBuffer2[b]=0;
}
else
{
ExtHBuffer1[b]=0;
ExtHBuffer2[b]=1;
}

}

return(0);
}
fxwayne
 
Posts: 3
Joined: Thu Nov 11, 2010 4:38 pm

Re: Convert MQ4 to LUA

Postby fxwayne » Thu Nov 11, 2010 5:05 pm

I thought I had attached the code. If not please can you tell me how to attach it?

Do you want me to send it in notepad?
fxwayne
 
Posts: 3
Joined: Thu Nov 11, 2010 4:38 pm


Return to Indicator and Signal Requests

Who is online

Users browsing this forum: No registered users and 21 guests