PureBytes Links
Trading Reference Links
|
Hi,,,,
i found this MQL4 code give a good signal in Metatrader platform.
if anyone could convert this code to be metastock programing code
it will be usefull for me.
//+------------------------------------------------------------------+
//| SHI_SilverTrendSig.mq4 |
//| Copyright © 2003, VIAC.RU, OlegVS, GOODMAN, 2005 Shurka |
//| |
//| |
//| |
//| Ïèøó ïðîãðàììû íà çàêàç |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Shurka"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
#define SH_BUY 1
#define SH_SELL -1
//---- Âõîäíûå ïàðàìåòðû
extern int AllBars=0;//Äëÿ ñêîëüêè áàðîâ ñ÷èòàòü. 0 - äëÿ âñåõ.
extern int Otstup=30;//Îòñòóï.
extern double Per=9;//Ïåðèîä.
extern bool UseAlert = true;
int SH,NB,i,UD;
double R,SHMax,SHMin;
double BufD[];
double BufU[];
//+------------------------------------------------------------------+
//| Ôóíêöèÿ èíèöèàëèçàöèè |
//+------------------------------------------------------------------+
int init()
{
if (Bars<AllBars+Per || AllBars==0) NB=Bars-Per; else NB=AllBars;
IndicatorBuffers(2);
IndicatorShortName("SHI_SilverTrendSig");
SetIndexStyle(0,DRAW_ARROW,0,1);
SetIndexStyle(1,DRAW_ARROW,0,1);
SetIndexArrow(0,159);
SetIndexArrow(1,159);
SetIndexBuffer(0,BufU);
SetIndexBuffer(1,BufD);
SetIndexDrawBegin(0,Bars-NB
SetIndexDrawBegin(1,Bars-NB);
ArrayInitialize(BufD,0.0
ArrayInitialize(BufU,0.0);
return(0);
}
//+------------------------------------------------------------------+
//| Ôóíêöèÿ äåèíèöèàëèçàöèè |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Ñîáñíà èíäèêàòîð |
//+------------------------------------------------------------------+
int start()
{
int CB=IndicatorCounted();
if(CB<0) return(-1); else if(NB>Bars-CB) NB=Bars-CB;
for (SH=1;SH<NB;SH++)//Ïðî÷¸ñûâàåì ãðàôèê îò 1 äî NB
{
for (R=0,i=SH;i<SH+10;i++) {R+=(10+SH-i)*(High[i]-Low
[i]);} R/=55;
SHMax = High[Highest(NULL,0,MODE_HIGH,Per,SH)];
SHMin = Low[Lowest(NULL,0,MODE_LOW,Per,SH)];
if (Close[SH]<SHMin+(SHMax-SHMin)*Otstup/100 && UD!=SH_SELL) {
BufU[SH]=Low[SH]-R*0.5; UD=SH_SELL; DoAlert(UD);}
if (Close[SH]>SHMax-(SHMax-SHMin)*Otstup/100 && UD!=SH_BUY) {
BufD[SH]=High[SH]+R*0.5; UD=SH_BUY; DoAlert(UD);}
}
return(0);
}
void DoAlert(int UD)
{
if (!NewBar() || !UseAlert)
return;
string sAction = "Buy";
if (UD == SH_BUY) // Think there is a problem in the indicator.
using Buy instead of sell
sAction = "Sell";
Alert(Symbol(), " ",Period()," alert!! ", sAction);
}
bool NewBar()
{
static datetime dt = 0;
if (dt != Time[0])
{
dt = Time[0];
return(true);
}
return(false);
}
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/equismetastock/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:equismetastock-digest@xxxxxxxxxxxxxxx
mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|