-
In Profit
Baixar Expert Adisors aqui
Copie e cole em seu meta editor os eas, e boa sorte
-
-
In Profit
Range
-
-
In Profit
Window
//+------------------------------------------------------------------+
//| |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright 2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
#property indicator_separate_window
#property indicator_minimum -100
#property indicator_maximum 100
#property indicator_buffers 4
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_color3 Lime
#property indicator_color4 Red
//---- indicator parameters
extern int ExtDepth=12;
extern int ExtDeviation=5;
extern int ExtBackstep=3;
//---- indicator buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double zz[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(7);
//---- drawing settings
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,119);
SetIndexBuffer(0,ExtMapBuffer3);
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,119);
SetIndexBuffer(1,ExtMapBuffer4);
SetIndexEmptyValue(1,0.0);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,ExtMapBuffer5);
SetIndexEmptyValue(2,0.0);
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3,ExtMapBuffer6);
SetIndexEmptyValue(3,0.0);
//---- indicator buffers mapping
SetIndexBuffer(4,ExtMapBuffer1);
SetIndexBuffer(5,ExtMapBuffer2);
SetIndexBuffer(6,zz);
SetIndexEmptyValue(0,0.0);
SetIndexEmptyValue(1,0.0);
SetIndexEmptyValue(2,0.0);
ArraySetAsSeries(ExtMapBuffer1,true);
ArraySetAsSeries(ExtMapBuffer2,true);
//---- indicator short name
IndicatorShortName("Its life Jim, but not as we know it... ");
//---- initialization done
return(0);
}
int deinit() {return(0);}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int shift, back,lasthighpos,lastlowpos;
double val,res;
double curlow,curhigh,lasthigh,lastlow;
bool signal;
int i;
for(shift=Bars-ExtDepth; shift>=0; shift--)
{
val=Low[Lowest(NULL,0,MODE_LOW,ExtDepth,shift)];
if(val==lastlow) val=0.0;
else
{
lastlow=val;
if((Low[shift]-val)>(ExtDeviation*Point)) val=0.0;
else
{
for(back=1; back<=ExtBackstep; back++)
{
res=ExtMapBuffer1[shift+back];
if((res!=0)&&(res>val)) ExtMapBuffer1[shift+back]=0.0;
}
}
}
ExtMapBuffer1[shift]=val;
//--- high
val=High[Highest(NULL,0,MODE_HIGH,ExtDepth,shift)];
if(val==lasthigh) val=0.0;
else
{
lasthigh=val;
if((val-High[shift])>(ExtDeviation*Point)) val=0.0;
else
{
for(back=1; back<=ExtBackstep; back++)
{
res=ExtMapBuffer2[shift+back];
if((res!=0)&&(res<val)) ExtMapBuffer2[shift+back]=0.0;
}
}
}
ExtMapBuffer2[shift]=val;
}
// final cutting
lasthigh=-1; lasthighpos=-1;
lastlow=-1; lastlowpos=-1;
for(shift=Bars-ExtDepth; shift>=0; shift--)
{
curlow=ExtMapBuffer1[shift];
curhigh=ExtMapBuffer2[shift];
if((curlow==0)&&(curhigh==0)) continue;
//---
if(curhigh!=0)
{
if(lasthigh>0)
{
if(lasthigh<curhigh) ExtMapBuffer2[lasthighpos]=0;
else ExtMapBuffer2[shift]=0;
}
//---
if(lasthigh<curhigh || lasthigh<0)
{
lasthigh=curhigh;
lasthighpos=shift;
}
lastlow=-1;
}
//----
if(curlow!=0)
{
if(lastlow>0)
{
if(lastlow>curlow) ExtMapBuffer1[lastlowpos]=0;
else ExtMapBuffer1[shift]=0;
}
//---
if((curlow<lastlow)||(lastlow<0))
{
lastlow=curlow;
lastlowpos=shift;
}
lasthigh=-1;
}
}
for(shift=Bars-1; shift>=0; shift--)
{
if(shift>=Bars-ExtDepth) {ExtMapBuffer1[shift]=0.0;ExtMapBuffer2[shift]=0.0;}
else
{
if (ExtMapBuffer1[shift]>0) {signal=true;}
res=ExtMapBuffer2[shift];
if(res!=0.0) {ExtMapBuffer1[shift]=res;signal=false;}
}
if (signal)
{
zz[shift]=-1;
}
else
{
zz[shift]=1;
}
}
//
for(shift=Bars-4; shift>=0; shift--)
{
if (zz[shift]<0)
{
if (zz[shift+2]>0)
{
if (zz[shift+1]>0)
{
ExtMapBuffer4[shift+1]=-70;
ExtMapBuffer6[shift+1]=-70;
ExtMapBuffer4[shift]=-90;
ExtMapBuffer6[shift]=-90;
ExtMapBuffer3[shift]=-90;
ExtMapBuffer5[shift]=-90;
}
else
{
ExtMapBuffer3[shift]=-30;
ExtMapBuffer5[shift]=-30;
}
}
else
{
if (zz[shift+1]>0)
{
ExtMapBuffer3[shift]=-90;
ExtMapBuffer5[shift]=-90;
ExtMapBuffer4[shift]=-90;
ExtMapBuffer6[shift]=-90;
}
else
{
ExtMapBuffer3[shift]=0.001;
ExtMapBuffer5[shift]=0.001;
}
}
}
else
{
if (zz[shift+2]>0)
{
if (zz[shift+1]>0)
{
ExtMapBuffer4[shift]=0.001;
ExtMapBuffer6[shift]=0.001;
}
else
{
ExtMapBuffer3[shift]=90;
ExtMapBuffer5[shift]=90;
ExtMapBuffer4[shift]=90;
ExtMapBuffer6[shift]=90;
}
}
else
{
if (zz[shift+1]>0)
{
ExtMapBuffer4[shift]=30;
ExtMapBuffer6[shift]=30;
}
else
{
ExtMapBuffer3[shift+1]=70;
ExtMapBuffer5[shift+1]=70;
ExtMapBuffer3[shift]=90;
ExtMapBuffer5[shift]=90;
ExtMapBuffer4[shift]=90;
ExtMapBuffer6[shift]=90;
}
}
}
}
}
-
-
In Profit
Gravit
//+------------------------------------------------------------------+
//| #MTF Center of Gravity.mq4 |
//| Copyright 2005, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Chartreuse
#property indicator_color2 Red
//---- input parameters
/************************************************** ***********************
PERIOD_M1 1
PERIOD_M5 5
PERIOD_M15 15
PERIOD_M30 30
PERIOD_H1 60
PERIOD_H4 240
PERIOD_D1 1440
PERIOD_W1 10080
PERIOD_MN1 43200
You must use the numeric value of the timeframe that you want to use
when you set the TimeFrame' value with the indicator inputs.
************************************************** ************************/
extern int TimeFrame=0;
extern double Per=9;
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(0,DRAW_LINE);
SetIndexArrow(0,159);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(1,DRAW_LINE);
SetIndexArrow(1,159);
//---- name for DataWindow and indicator subwindow label
switch(TimeFrame)
{
case 1 : string TimeFrameStr="Period_M1"; break;
case 5 : TimeFrameStr="Period_M5"; break;
case 15 : TimeFrameStr="Period_M15"; break;
case 30 : TimeFrameStr="Period_M30"; break;
case 60 : TimeFrameStr="Period_H1"; break;
case 240 : TimeFrameStr="Period_H4"; break;
case 1440 : TimeFrameStr="Period_D1"; break;
case 10080 : TimeFrameStr="Period_W1"; break;
case 43200 : TimeFrameStr="Period_MN1"; break;
default : TimeFrameStr="Current Timeframe";
}
IndicatorShortName("MTF Center of Gravity ("+TimeFrameStr+")");
}
//----
return(0);
//+------------------------------------------------------------------+
//| MTF Parabolic Sar |
//+------------------------------------------------------------------+
int start()
{
datetime TimeArray[];
int i,limit,y=0,counted_bars=IndicatorCounted();
// Plot defined time frame on to current time frame
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeF rame);
limit=Bars-counted_bars;
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;
/************************************************** *********
Add your main indicator loop below. You can add the full
indicator code or you can just reference an existing
indicator with its iValue or iCustom.
Rule 1: Add extern inputs above for all neccesary values
Rule 2: Use 'TimeFrame' for the indicator time frame
Rule 3: Use 'y' for your indicator's shift value
************************************************** ********/
ExtMapBuffer1[i]=iCustom(NULL,TimeFrame,"Center of Gravity",0,y);
ExtMapBuffer2[i]=iCustom(NULL,TimeFrame,"Center of Gravity",1,y);
}
//
return(0);
}
//+------------------------------------------------------------------+
-
-
In Profit
Wpr
//+------------------------------------------------------------------+
//| MTF_Williams Percentage Range.mq4 |
//| Copyright 2006, Keris2112 |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright 2006, Keris2112"
#property link "http://www.forex-tsd.com"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Blue
#property indicator_level1 -80
#property indicator_level2 -20
#property indicator_level3 -50
//---- input parameters
/************************************************** ***********************
PERIOD_M1 1
PERIOD_M5 5
PERIOD_M15 15
PERIOD_M30 30
PERIOD_H1 60
PERIOD_H4 240
PERIOD_D1 1440
PERIOD_W1 10080
PERIOD_MN1 43200
You must use the numeric value of the timeframe that you want to use
when you set the TimeFrame' value with the indicator inputs.
---------------------------------------
MODE_SMA 0 Simple moving average,
MODE_EMA 1 Exponential moving average,
MODE_SMMA 2 Smoothed moving average,
MODE_LWMA 3 Linear weighted moving average.
You must use the numeric value of the MA Method that you want to use
when you set the 'ma_method' value with the indicator inputs.
************************************************** ************************/
extern int TimeFrame=60;
extern int WilliamsPeriod=14;
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(0,DRAW_LINE);
//---- name for DataWindow and indicator subwindow label
switch(TimeFrame)
{
case 1 : string TimeFrameStr="Period_M1"; break;
case 5 : TimeFrameStr="Period_M5"; break;
case 15 : TimeFrameStr="Period_M15"; break;
case 30 : TimeFrameStr="Period_M30"; break;
case 60 : TimeFrameStr="Period_H1"; break;
case 240 : TimeFrameStr="Period_H4"; break;
case 1440 : TimeFrameStr="Period_D1"; break;
case 10080 : TimeFrameStr="Period_W1"; break;
case 43200 : TimeFrameStr="Period_MN1"; break;
default : TimeFrameStr="Current Timeframe";
}
IndicatorShortName("WPR ("+WilliamsPeriod+") "+TimeFrameStr);
}
//----
return(0);
int start()
{
datetime TimeArray[];
int i,shift,limit,y=0,counted_bars=IndicatorCounted();
// Plot defined timeframe on to current timeframe
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeF rame);
limit=Bars-counted_bars;
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;
/************************************************** *********
Add your main indicator loop below. You can reference an existing
indicator with its iName or iCustom.
Rule 1: Add extern inputs above for all neccesary values
Rule 2: Use 'TimeFrame' for the indicator timeframe
Rule 3: Use 'y' for the indicator's shift value
************************************************** ********/
ExtMapBuffer1[i]=iWPR(NULL,TimeFrame,WilliamsPeriod,y);
}
//
return(0);
}
//+------------------------------------------------------------------+
-
-
In Profit
Juice
//+------------------------------------------------------------------+
//| Juice.mq4 |
//+------------------------------------------------------------------+
#property copyright ""
#property link ""
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Olive
#property indicator_color2 FireBrick
#property indicator_color3 Orange
#property indicator_color4 Pink
#property indicator_color5 Magenta
//---- indicator parameters
extern int Length=7;
extern double Ks=1.5; //multiplier times avg of stdev over the # of CalcBars
extern int CalcBars=96; //put zero if want to calculate on all bars
extern int Advance = 70;
//---- indicator buffers
//---- indicator buffers
double GoodJuice[];
double SoSoJuice[];
double BadJuice[];
double SoSoLine[];
double GoodLine[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexStyle(3,DRAW_LINE,STYLE_DOT,1);
SetIndexStyle(4,DRAW_LINE,STYLE_DOT,1);
//---- indicator buffers mapping
SetIndexBuffer(0,GoodJuice);
SetIndexBuffer(1,SoSoJuice);
SetIndexBuffer(2,BadJuice);
SetIndexBuffer(3,SoSoLine);
SetIndexBuffer(4,GoodLine);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("Juice mod v1 ("+Length+","+Ks+")");
SetIndexShift (1, Advance);
//---- initialization done
SetIndexEmptyValue(0,0);
SetIndexEmptyValue(1,0);
SetIndexEmptyValue(2,0);
SetIndexEmptyValue(3,0);
SetIndexEmptyValue(4,0);
return(0);
}
//+------------------------------------------------------------------+
//| Juice_mod_v1.2 |
//+------------------------------------------------------------------+
int start()
{
int i;
//---- main loop
double sum=0;
if (CalcBars==0) int NBars=Bars-Length; else NBars=CalcBars;
for(i=1; i<=NBars; i++) sum+=iStdDev(NULL,0,Length,MODE_LWMA,0,PRICE_CLOSE ,i);
double avg=sum/NBars;
for(i=Bars-Length-1; i>=0; i--)
{
double Juice=iStdDev(NULL,0,Length,MODE_LWMA,0,PRICE_CLOS E,i);
SoSoLine[i]=avg/Point;
GoodLine[i]=(Ks*avg)/Point;
if((Juice/Point)>=GoodLine[i]){
GoodJuice[i]=Juice/Point;
BadJuice[i]=0;
SoSoJuice[i]=0;
}
if((Juice/Point)<GoodLine[i] && (Juice/Point)>=SoSoLine[i]){
GoodJuice[i]=0;
BadJuice[i]=0;
SoSoJuice[i]=Juice/Point;
}
if((Juice/Point)<SoSoLine[i]){
GoodJuice[i]=0;
BadJuice[i]=Juice/Point;
SoSoJuice[i]=0;
}
}
//---- done
return(0);
}
//+------------------------------------------------------------------+
-
-
In Profit
Level alerts
//+------------------------------------------------------------------+
//| Juice.mq4 |
//| Perky_z |
//| http://fxovereasy.atspace.com/index |
//+------------------------------------------------------------------+
#property copyright "perky"
#property link "http://fxovereasy.atspace.com/index"
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 LimeGreen
#property indicator_color2 FireBrick
#property indicator_color3 Yellow
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
//---- indicator parameters
extern bool DoAlerts = false;
extern int AlertFromPips = 8;
extern int Periyod=7;
extern int thresholdLevel=8;
extern int sosoLevel = 4;
extern bool JuiceLevelsVisible = true;
extern int JuiceStartPips = 4;
extern int JuiceStepPips = 4;
extern int JuiceLevelsNumber = 3;
extern color JuiceLevelColor = Black;
double thresholdLevelPoint;
double sosoLevelPoint;
//---- indicator buffers
double GoodJuice[];
double BadJuice[];
double SoSoJuice[];
double currentJuiceLevel;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 3 additional buffers are used for counting.
IndicatorBuffers(3);
//---- drawing settings
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexDrawBegin(0,Periyod);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+2 );
//---- 2 indicator buffers mapping
if(!SetIndexBuffer(0,GoodJuice) &&
!SetIndexBuffer(1,BadJuice) &&
!SetIndexBuffer(2,SoSoJuice))
Print("cannot set indicator buffers!");
IndicatorDigits(4);
thresholdLevelPoint = thresholdLevel*Point;
sosoLevelPoint = sosoLevel*Point;
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("Juice("+Periyod+","+thresholdL evel+")");
//---- initialization done
return(0);
}
int SetLevelLines()
{
string levelLabel;
if(JuiceLevelsVisible)
{
SetLevelStyle(STYLE_DASH,1,JuiceLevelColor);
for(int i=1; i<= JuiceLevelsNumber; i++)
{
currentJuiceLevel = (JuiceStartPips + (i-1)*JuiceStepPips);
SetLevelValue(i,currentJuiceLevel);
levelLabel = "Level "+i+": "+currentJuiceLevel;
SetIndexLabel(i,levelLabel);
}
}else
{
for(i=1; i<= JuiceLevelsNumber; i++)
{
SetLevelValue(i,0.0);
}
}
}
//+------------------------------------------------------------------+
//| Moving Average of Oscillator |
//+------------------------------------------------------------------+
int start()
{
//if ( Period != 15) Alert ("Juice Is Recommended for 15 Min Chart only!!");
int limit,i;
int counted_bars=IndicatorCounted();
double Juice;
static datetime lastPriceAlertedBar=0;
int barToCheck;
//---- 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;
SetLevelLines();
//---- main loop
for(i=0; i<limit; i++)
{
Juice=iStdDev (NULL,0,Periyod,MODE_EMA,0,PRICE_CLOSE,i);
if(Juice>=thresholdLevelPoint){
GoodJuice[i]=Juice/Point;
BadJuice[i]=0;
SoSoJuice[i]=0;
}else if(Juice<sosoLevelPoint){
BadJuice[i]=Juice/Point;
GoodJuice[i]=0;
SoSoJuice[i] = 0;
}else{
SoSoJuice[i] = Juice/Point;
BadJuice[i]=0;
GoodJuice[i]=0;
}
}
if (DoAlerts)
{
if (Juice > AlertFromPips && Period() == 5 && lastPriceAlertedBar != iTime(NULL,0,barToCheck))
{
Alert("Juice above ",AlertFromPips," for ", Symbol());
PlaySound("Tick.wav");
lastPriceAlertedBar = iTime(NULL,0,barToCheck);
}
}
//---- done
return(0);
}
//+------------------------------------------------------------------+
-
-
In Profit
lsmn angle
//+------------------------------------------------------------------+
//| LSMA_Angle.mq4 |
//| MrPip |
//| |
//| You can use this indicator to measure when the LSMA angle is |
//| "near zero". AngleTreshold determines when the angle for the |
//| LSMA is "about zero": This is when the value is between |
//| [-AngleTreshold, AngleTreshold] (or when the histogram is red). |
//| LSMAPeriod: LSMA period |
//| AngleTreshold: The angle value is "about zero" when it is |
//| between the values [-AngleTreshold, AngleTreshold]. |
//| StartLSMAShift: The starting point to calculate the |
//| angle. This is a shift value to the left from the |
//| observation point. Should be StartEMAShift > EndEMAShift. |
//| EndLSMAShift: The ending point to calculate the |
//| angle. This is a shift value to the left from the |
//| observation point. Should be StartEMAShift > EndEMAShift. |
//| |
//| Modified by MrPip from EMAAngle by jpkfox | |
//| Red for down |
//| Yellow for near zero |
//| Green for up |
//| |
//+------------------------------------------------------------------+
#property copyright "Robert L. Hill aka MrPip"
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 LimeGreen
#property indicator_color2 Yellow
#property indicator_color3 FireBrick
//---- indicator parameters
extern int LSMAPeriod=25;
extern double AngleTreshold=15.0;
extern int StartLSMAShift=4;
extern int EndLSMAShift=0;
//---- indicator buffers
double UpBuffer[];
double DownBuffer[];
double ZeroBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 2 additional buffers are used for counting.
IndicatorBuffers(3);
//---- drawing settings
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,2);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+2 );
//---- 3 indicator buffers mapping
if(!SetIndexBuffer(0,UpBuffer) &&
!SetIndexBuffer(1,DownBuffer) &&
!SetIndexBuffer(2,ZeroBuffer))
Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("LSMAAngle("+LSMAPeriod+","+Ang leTreshold+","+StartLSMAShift+","+EndLSMAShift+")" );
//---- initialization done
return(0);
}
//+------------------------------------------------------------------------+
//| LSMA - Least Squares Moving Average function calculation |
//| LSMA_In_Color Indicator plots the end of the linear regression line |
//+------------------------------------------------------------------------+
double LSMA(int Rperiod, int shift)
{
int i;
double sum;
int length;
double lengthvar;
double tmp;
double wt;
length = Rperiod;
sum = 0;
for(i = length; i >= 1 ; i--)
{
lengthvar = length + 1;
lengthvar /= 3;
tmp = 0;
tmp = ( i - lengthvar)*Close[length-i+shift];
sum+=tmp;
}
wt = sum*6/(length*(length+1));
return(wt);
}
//+------------------------------------------------------------------+
//| The angle for LSMA |
//+------------------------------------------------------------------+
int start()
{
double fEndMA, fStartMA;
double fAngle, mFactor, dFactor;
int nLimit, i;
int nCountedBars;
double angle;
int ShiftDif;
string Sym;
if(EndLSMAShift >= StartLSMAShift)
{
Print("Error: EndLSMAShift >= StartLSMAShift");
StartLSMAShift = 6;
EndLSMAShift = 0;
}
nCountedBars = IndicatorCounted();
//---- check for possible errors
if(nCountedBars<0)
return(-1);
//---- last counted bar will be recounted
if(nCountedBars>0)
nCountedBars--;
nLimit = Bars-nCountedBars;
dFactor = 2*3.14159/180.0;
mFactor = 100000.0;
Sym = StringSubstr(Symbol(),3,3);
if (Sym == "JPY") mFactor = 1000.0;
// if (Symbol() == "USDJPY") mFactor = 1000.0;
ShiftDif = StartLSMAShift-EndLSMAShift;
mFactor /= ShiftDif;
//---- main loop
for(i=0; i<nLimit; i++)
{
fEndMA=LSMA(LSMAPeriod,i+EndLSMAShift);
fStartMA=LSMA(LSMAPeriod,i+StartLSMAShift);
// 10000.0 : Multiply by 10000 so that the fAngle is not too small
// for the indicator Window.
fAngle = mFactor * (fEndMA - fStartMA)/2;
// fAngle = MathArctan(fAngle)/dFactor;
DownBuffer[i] = 0.0;
UpBuffer[i] = 0.0;
ZeroBuffer[i] = 0.0;
if(fAngle > AngleTreshold)
UpBuffer[i] = fAngle;
else if (fAngle < -AngleTreshold)
DownBuffer[i] = fAngle;
else ZeroBuffer[i] = fAngle;
}
return(0);
}
//+------------------------------------------------------------------+
-
-
In Profit
Ind inverse
//+------------------------------------------------------------------+
//| IND Inverse.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2006, ..."
#property link "http://www.forex-tsd.com/"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Maroon
#property indicator_color2 Green
#property indicator_color3 Red
//---- input parameters
//---- buffers
double Buffer[];
double SigBuffer[];
double DirBuffer[];
extern int iPeriod = 1;
extern int cbars = 1000;
//----
//+------------------------------------------------------------------+
//| Init |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorDigits(Digits+2);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,Buffer);
SetIndexStyle(1,DRAW_ARROW);
SetIndexBuffer(1,SigBuffer);
SetIndexEmptyValue(1,0);
SetIndexArrow(1,233);
SetIndexStyle(2,DRAW_ARROW);
SetIndexBuffer(2,DirBuffer);
SetIndexEmptyValue(2,0);
SetIndexArrow(2,234);
//----
return(0);
}
int last = 0;
//+------------------------------------------------------------------+
//| Parabolic Sell And Reverse system |
//+------------------------------------------------------------------+
int start()
{
if(last == 0) ArrayInitialize(DirBuffer,0);
last = Bars;
int b = 0,i = 0;
for(i=0; i<=cbars; i++){
// Easy to read
double HD = High[Highest(NULL,0,MODE_HIGH,(iPeriod* 20),i)];
double LD = Low[Lowest(NULL,0,MODE_LOW,(iPeriod* 20),i)];
double amplitude = HD - LD;
if(amplitude!=0)
Buffer[i]= ((Close[i]-(HD-(amplitude/2)))/amplitude) * iPeriod;
else
Buffer[i]= Close[i] * iPeriod;
}
double dir = 0;
for(i=cbars; i>=0; i--){
SigBuffer[i] = 0;
DirBuffer[i] = 0;
if(Buffer[i]*Buffer[i+1]<0){
if(Buffer[i]<0) DirBuffer[i] = Buffer[i];
else SigBuffer[i] = Buffer[i];
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
-
-
In Profit
10 points
//+------------------------------------------------------------------+
//| 10points 3.mq4 |
//| Copyright 2005, Alejandro Galindo |
//| http://elCactus.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2005, Alejandro Galindo"
#property link "http://elCactus.com"
extern double TakeProfit = 40;
extern double Lots = 0.1;
extern double InitialStop = 0;
extern double TrailingStop = 20;
extern int MaxTrades=10;
extern int Pips=15;
extern int SecureProfit=10;
extern int AccountProtection=1;
extern int OrderstoProtect=3;
extern int ReverseCondition=0;
extern double EURUSDPipValue=10;
extern double GBPUSDPipValue=10;
extern double USDCHFPipValue=10;
extern double USDJPYPipValue=9.715;
extern int StartYear=2005;
extern int StartMonth=1;
extern int EndYear=2005;
extern int EndMonth=12;
extern int EndHour=22;
extern int EndMinute=30;
extern int mm=0;
extern int risk=12;
extern int AccountisNormal=0;
int OpenOrders=0, cnt=0;
int slippage=5;
double sl=0, tp=0;
double BuyPrice=0, SellPrice=0;
double lotsi=0, mylotsi=0;
int mode=0, myOrderType=0;
bool ContinueOpening=True;
double LastPrice=0;
int PreviousOpenOrders=0;
double Profit=0;
int LastTicket=0, LastType=0;
double LastClosePrice=0, LastLots=0;
double Pivot=0;
double PipValue=0;
string text="", text2="";
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
if (AccountisNormal==1)
{
if (mm!=0) { lotsi=MathCeil(AccountBalance()*risk/10000); }
else { lotsi=Lots; }
} else { // then is mini
if (mm!=0) { lotsi=MathCeil(AccountBalance()*risk/10000)/10; }
else { lotsi=Lots; }
}
if (lotsi>100){ lotsi=100; }
OpenOrders=0;
for(cnt=0;cnt<OrdersTotal();cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol()==Symbol())
{
OpenOrders++;
}
}
if (OpenOrders<1)
{
if (TimeYear(CurTime())<StartYear) { return(0); }
if (TimeMonth(CurTime())<StartMonth) { return(0); }
if (TimeYear(CurTime())>EndYear) { return(0); }
if (TimeMonth(CurTime())>EndMonth ) { return(0); }
}
if (Symbol()=="EURUSD") { PipValue=EURUSDPipValue; }
if (Symbol()=="GBPUSD") { PipValue=GBPUSDPipValue; }
if (Symbol()=="USDJPY") { PipValue=USDJPYPipValue; }
if (Symbol()=="USDCHF") { PipValue=USDCHFPipValue; }
if (PipValue==0) { PipValue=5; }
if (PreviousOpenOrders>OpenOrders)
{
for(cnt=OrdersTotal();cnt>=0;cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
mode=OrderType();
if (OrderSymbol()==Symbol())
{
if (mode==OP_BUY) { OrderClose(OrderTicket(),OrderLots(),OrderClosePri ce(),slippage,Blue); }
if (mode==OP_SELL) { OrderClose(OrderTicket(),OrderLots(),OrderClosePri ce(),slippage,Red); }
return(0);
}
}
}
PreviousOpenOrders=OpenOrders;
if (OpenOrders>=MaxTrades)
{
ContinueOpening=False;
} else {
ContinueOpening=True;
}
if (LastPrice==0)
{
for(cnt=0;cnt<OrdersTotal();cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
mode=OrderType();
if (OrderSymbol()==Symbol())
{
LastPrice=OrderOpenPrice();
if (mode==OP_BUY) { myOrderType=2; }
if (mode==OP_SELL) { myOrderType=1; }
}
}
}
if (OpenOrders<1)
{
myOrderType=3;
//if (iMACD(14,26,9,MODE_MAIN,0)>0 and iMACD(14,26,9,MODE_MAIN,0)>iMACD(14,26,9,MODE_MAIN ,1)) then OrderType=2;
if (iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,0)>iMA CD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,1)) { myOrderType=2; }
//if (iMACD(14,26,9,MODE_MAIN,0)<0 and iMACD(14,26,9,MODE_MAIN,0)<iMACD(14,26,9,MODE_MAIN ,1)) then OrderType=1;
if (iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,0)<iMA CD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,1)) { myOrderType=1; }
if (ReverseCondition==1)
{
if (myOrderType==1) { myOrderType=2; }
else { if (myOrderType==2) { myOrderType=1; } }
}
}
// if we have opened positions we take care of them
for(cnt=OrdersTotal();cnt>=0;cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol())
{
if (OrderType()==OP_SELL)
{
if (TrailingStop>0)
{
if (OrderOpenPrice()-Ask>=(TrailingStop+Pips)*Point)
{
if (OrderStopLoss()>(Ask+Point*TrailingStop))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Poi nt*TrailingStop,OrderClosePrice()-TakeProfit*Point-TrailingStop*Point,800,Purple);
return(0);
}
}
}
}
if (OrderType()==OP_BUY)
{
if (TrailingStop>0)
{
if (Bid-OrderOpenPrice()>=(TrailingStop+Pips)*Point)
{
if (OrderStopLoss()<(Bid-Point*TrailingStop))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderClosePrice()+TakeProfit*Po int()+TrailingStop*Point(),800,Yellow);
return(0);
}
}
}
}
}
}
Profit=0;
LastTicket=0;
LastType=0;
LastClosePrice=0;
LastLots=0;
for(cnt=0;cnt<OrdersTotal();cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol()==Symbol())
{
LastTicket=OrderTicket();
if (OrderType()==OP_BUY) { LastType=OP_BUY; }
if (OrderType()==OP_SELL) { LastType=OP_SELL; }
LastClosePrice=OrderClosePrice();
LastLots=OrderLots();
if (LastType==OP_BUY)
{
//Profit=Profit+(Ord(cnt,VAL_CLOSEPRICE)-Ord(cnt,VAL_OPENPRICE))*PipValue*Ord(cnt,VAL_LOTS) ;
if (OrderClosePrice()<OrderOpenPrice())
{ Profit=Profit-(OrderOpenPrice()-OrderClosePrice())*OrderLots()/Point; }
if (OrderClosePrice()>OrderOpenPrice())
{ Profit=Profit+(OrderClosePrice()-OrderOpenPrice())*OrderLots()/Point; }
}
if (LastType==OP_SELL)
{
//Profit=Profit+(Ord(cnt,VAL_OPENPRICE)-Ord(cnt,VAL_CLOSEPRICE))*PipValue*Ord(cnt,VAL_LOTS );
if (OrderClosePrice()>OrderOpenPrice())
{ Profit=Profit-(OrderClosePrice()-OrderOpenPrice())*OrderLots()/Point; }
if (OrderClosePrice()<OrderOpenPrice())
{ Profit=Profit+(OrderOpenPrice()-OrderClosePrice())*OrderLots()/Point; }
}
//Print(Symbol,":",Profit,",",LastLots);
}
}
Profit=Profit*PipValue;
text2="Profit: $"+DoubleToStr(Profit,2)+" +/-";
if (OpenOrders>=(MaxTrades-OrderstoProtect) && AccountProtection==1)
{
//Print(Symbol,":",Profit);
if (Profit>=SecureProfit)
{
OrderClose(LastTicket,LastLots,LastClosePrice,slip page,Yellow);
ContinueOpening=False;
return(0);
}
}
if (!IsTesting())
{
if (myOrderType==3) { text="No conditions to open trades"; }
else { text=" "; }
Comment("LastPrice=",LastPrice," Previous open orders=",PreviousOpenOrders,"\nContinue opening=",ContinueOpening," OrderType=",myOrderType,"\n",text2,"\nLots=",lotsi ,"\n",text);
}
if (myOrderType==1 && ContinueOpening)
{
if ((Bid-LastPrice)>=Pips*Point || OpenOrders<1)
{
SellPrice=Bid;
LastPrice=0;
if (TakeProfit==0) { tp=0; }
else { tp=SellPrice-TakeProfit*Point; }
if (InitialStop==0) { sl=0; }
else { sl=SellPrice+InitialStop*Point; }
if (OpenOrders!=0)
{
mylotsi=lotsi;
for(cnt=1;cnt<=OpenOrders;cnt++)
{
if (MaxTrades>12) { mylotsi=NormalizeDouble(mylotsi*1.5,1); }
else { mylotsi=NormalizeDouble(mylotsi*2,1); }
}
} else { mylotsi=lotsi; }
if (mylotsi>100) { mylotsi=100; }
OrderSend(Symbol(),OP_SELL,mylotsi,SellPrice,slipp age,sl,tp,NULL,0,0,Red);
return(0);
}
}
if (myOrderType==2 && ContinueOpening)
{
if ((LastPrice-Ask)>=Pips*Point || OpenOrders<1)
{
BuyPrice=Ask;
LastPrice=0;
if (TakeProfit==0) { tp=0; }
else { tp=BuyPrice+TakeProfit*Point; }
if (InitialStop==0) { sl=0; }
else { sl=BuyPrice-InitialStop*Point; }
if (OpenOrders!=0) {
mylotsi=lotsi;
for(cnt=1;cnt<=OpenOrders;cnt++)
{
if (MaxTrades>12) { mylotsi=NormalizeDouble(mylotsi*1.5,1); }
else { mylotsi=NormalizeDouble(mylotsi*2,1); }
}
} else { mylotsi=lotsi; }
if (mylotsi>100) { mylotsi=100; }
OrderSend(Symbol(),OP_BUY,mylotsi,BuyPrice,slippag e,sl,tp,NULL,0,0,Blue);
return(0);
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
-
-
nao tem backtest nao tem nada ? e pq num coloca compilado ?
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|
| |
Calendar |
 |
|
| We Buy | We Sell |
| $1.4092 | $1.4528 |
|